diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperations.cs index 05f3d63080b3b..4c1ad03ca942c 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperations.cs @@ -469,13 +469,12 @@ internal CertificatesOperations(IotHubClient client) /// /// The name of the certificate /// - /// - /// The certificate body. - /// /// /// ETag of the Certificate. Do not specify for creating a brand new /// certificate. Required to update an existing certificate. /// + /// + /// /// /// Headers that will be added to request. /// @@ -497,7 +496,7 @@ internal CertificatesOperations(IotHubClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, string ifMatch = default(string), CertificateProperties properties = default(CertificateProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -526,9 +525,10 @@ internal CertificatesOperations(IotHubClient client) throw new ValidationException(ValidationRules.Pattern, "certificateName", "^[A-Za-z0-9-._]{1,64}$"); } } - if (certificateDescription == null) + CertificateDescription certificateDescription = new CertificateDescription(); + if (properties != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateDescription"); + certificateDescription.Properties = properties; } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -540,8 +540,8 @@ internal CertificatesOperations(IotHubClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("certificateName", certificateName); - tracingParameters.Add("certificateDescription", certificateDescription); tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("certificateDescription", certificateDescription); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } @@ -1157,12 +1157,13 @@ internal CertificatesOperations(IotHubClient client) /// /// The name of the certificate /// - /// - /// The name of the certificate - /// /// /// ETag of the Certificate. /// + /// + /// base-64 representation of X509 certificate .cer file or just .pem file + /// content. + /// /// /// Headers that will be added to request. /// @@ -1184,7 +1185,7 @@ internal CertificatesOperations(IotHubClient client) /// /// A response object containing the response body and response headers. /// - public async Task> VerifyWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, CertificateVerificationDescription certificateVerificationBody, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> VerifyWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, string ifMatch, string certificate = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1213,14 +1214,15 @@ internal CertificatesOperations(IotHubClient client) throw new ValidationException(ValidationRules.Pattern, "certificateName", "^[A-Za-z0-9-._]{1,64}$"); } } - if (certificateVerificationBody == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateVerificationBody"); - } if (ifMatch == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } + CertificateVerificationDescription certificateVerificationBody = new CertificateVerificationDescription(); + if (certificate != null) + { + certificateVerificationBody.Certificate = certificate; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1231,8 +1233,8 @@ internal CertificatesOperations(IotHubClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("certificateName", certificateName); - tracingParameters.Add("certificateVerificationBody", certificateVerificationBody); tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("certificateVerificationBody", certificateVerificationBody); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Verify", tracingParameters); } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperationsExtensions.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperationsExtensions.cs index 1d1557a386364..74ac5afad1f05 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperationsExtensions.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/CertificatesOperationsExtensions.cs @@ -137,16 +137,15 @@ public static CertificateDescription Get(this ICertificatesOperations operations /// /// The name of the certificate /// - /// - /// The certificate body. - /// /// /// ETag of the Certificate. Do not specify for creating a brand new /// certificate. Required to update an existing certificate. /// - public static CertificateDescription CreateOrUpdate(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string)) + /// + /// + public static CertificateDescription CreateOrUpdate(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, string ifMatch = default(string), CertificateProperties properties = default(CertificateProperties)) { - return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, resourceName, certificateName, ifMatch, properties).GetAwaiter().GetResult(); } /// @@ -167,19 +166,18 @@ public static CertificateDescription Get(this ICertificatesOperations operations /// /// The name of the certificate /// - /// - /// The certificate body. - /// /// /// ETag of the Certificate. Do not specify for creating a brand new /// certificate. Required to update an existing certificate. /// + /// + /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, string ifMatch = default(string), CertificateProperties properties = default(CertificateProperties), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, certificateName, certificateDescription, ifMatch, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, certificateName, ifMatch, properties, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -319,15 +317,16 @@ public static CertificateWithNonceDescription GenerateVerificationCode(this ICer /// /// The name of the certificate /// - /// - /// The name of the certificate - /// /// /// ETag of the Certificate. /// - public static CertificateDescription Verify(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, CertificateVerificationDescription certificateVerificationBody, string ifMatch) + /// + /// base-64 representation of X509 certificate .cer file or just .pem file + /// content. + /// + public static CertificateDescription Verify(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, string ifMatch, string certificate = default(string)) { - return operations.VerifyAsync(resourceGroupName, resourceName, certificateName, certificateVerificationBody, ifMatch).GetAwaiter().GetResult(); + return operations.VerifyAsync(resourceGroupName, resourceName, certificateName, ifMatch, certificate).GetAwaiter().GetResult(); } /// @@ -349,18 +348,19 @@ public static CertificateDescription Verify(this ICertificatesOperations operati /// /// The name of the certificate /// - /// - /// The name of the certificate - /// /// /// ETag of the Certificate. /// + /// + /// base-64 representation of X509 certificate .cer file or just .pem file + /// content. + /// /// /// The cancellation token. /// - public static async Task VerifyAsync(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, CertificateVerificationDescription certificateVerificationBody, string ifMatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task VerifyAsync(this ICertificatesOperations operations, string resourceGroupName, string resourceName, string certificateName, string ifMatch, string certificate = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.VerifyWithHttpMessagesAsync(resourceGroupName, resourceName, certificateName, certificateVerificationBody, ifMatch, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.VerifyWithHttpMessagesAsync(resourceGroupName, resourceName, certificateName, ifMatch, certificate, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/ICertificatesOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/ICertificatesOperations.cs index aa2b3e2e6b23f..d2f47b57ce3d3 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/ICertificatesOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/ICertificatesOperations.cs @@ -97,13 +97,12 @@ public partial interface ICertificatesOperations /// /// The name of the certificate /// - /// - /// The certificate body. - /// /// /// ETag of the Certificate. Do not specify for creating a brand new /// certificate. Required to update an existing certificate. /// + /// + /// /// /// The headers that will be added to request. /// @@ -119,7 +118,7 @@ public partial interface ICertificatesOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, string ifMatch = default(string), CertificateProperties properties = default(CertificateProperties), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an X509 certificate. /// @@ -203,12 +202,13 @@ public partial interface ICertificatesOperations /// /// The name of the certificate /// - /// - /// The name of the certificate - /// /// /// ETag of the Certificate. /// + /// + /// base-64 representation of X509 certificate .cer file or just .pem + /// file content. + /// /// /// The headers that will be added to request. /// @@ -224,6 +224,6 @@ public partial interface ICertificatesOperations /// /// Thrown when a required parameter is null /// - Task> VerifyWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, CertificateVerificationDescription certificateVerificationBody, string ifMatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> VerifyWithHttpMessagesAsync(string resourceGroupName, string resourceName, string certificateName, string ifMatch, string certificate = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubClient.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubClient.cs index a17e240376a52..18fa146b2ea3d 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubClient.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubClient.cs @@ -94,5 +94,15 @@ public partial interface IIotHubClient : System.IDisposable /// IIotHubOperations IotHub { get; } + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs index 6c2670299f9b5..85a458e6e999c 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubOperations.cs @@ -24,19 +24,21 @@ namespace Microsoft.Azure.Management.IotHub public partial interface IIotHubOperations { /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary + /// region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary + /// region. To learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// /// /// The headers that will be added to request. @@ -50,21 +52,23 @@ public partial interface IIotHubOperations /// /// Thrown when a required parameter is null /// - Task ManualFailoverWithHttpMessagesAsync(string iotHubName, FailoverInput failoverInput, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task ManualFailoverWithHttpMessagesAsync(string iotHubName, string resourceGroupName, string failoverRegion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary + /// region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary + /// region. To learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// /// /// The headers that will be added to request. @@ -78,6 +82,6 @@ public partial interface IIotHubOperations /// /// Thrown when a required parameter is null /// - Task BeginManualFailoverWithHttpMessagesAsync(string iotHubName, FailoverInput failoverInput, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task BeginManualFailoverWithHttpMessagesAsync(string iotHubName, string resourceGroupName, string failoverRegion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubResourceOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubResourceOperations.cs index 1d0809f02b6a8..12beeb14661bd 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubResourceOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IIotHubResourceOperations.cs @@ -102,8 +102,8 @@ public partial interface IIotHubResourceOperations /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// /// /// The headers that will be added to request. @@ -120,7 +120,7 @@ public partial interface IIotHubResourceOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, TagsResource iotHubTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an IoT hub /// @@ -341,6 +341,8 @@ public partial interface IIotHubResourceOperations /// /// The name of the consumer group to add. /// + /// + /// /// /// The headers that will be added to request. /// @@ -356,7 +358,7 @@ public partial interface IIotHubResourceOperations /// /// Thrown when a required parameter is null /// - Task> CreateEventHubConsumerGroupWithHttpMessagesAsync(string resourceGroupName, string resourceName, string eventHubEndpointName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateEventHubConsumerGroupWithHttpMessagesAsync(string resourceGroupName, string resourceName, string eventHubEndpointName, string name, EventHubConsumerGroupName properties = default(EventHubConsumerGroupName), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete a consumer group from an Event Hub-compatible endpoint in an /// IoT hub @@ -517,9 +519,8 @@ public partial interface IIotHubResourceOperations /// /// Check if an IoT hub name is available. /// - /// - /// Set the name parameter in the OperationInputs structure to the name - /// of the IoT hub to check. + /// + /// The name of the IoT hub to check. /// /// /// The headers that will be added to request. @@ -536,7 +537,7 @@ public partial interface IIotHubResourceOperations /// /// Thrown when a required parameter is null /// - Task> CheckNameAvailabilityWithHttpMessagesAsync(OperationInputs operationInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckNameAvailabilityWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Test all routes /// @@ -787,8 +788,8 @@ public partial interface IIotHubResourceOperations /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// /// /// The headers that will be added to request. @@ -805,7 +806,7 @@ public partial interface IIotHubResourceOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, TagsResource iotHubTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an IoT hub /// diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..227cc2b290d6b --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,216 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + public partial interface IPrivateEndpointConnectionsOperations + { + /// + /// List private endpoint connections + /// + /// + /// List private endpoint connection properties + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get private endpoint connection + /// + /// + /// Get private endpoint connection properties + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the + /// specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the + /// specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..e1536b6eda20f --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IPrivateLinkResourcesOperations.cs @@ -0,0 +1,86 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + public partial interface IPrivateLinkResourcesOperations + { + /// + /// List private link resources + /// + /// + /// List private link resources for the given IotHub + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified private link resource + /// + /// + /// Get the specified private link resource for the given IotHub + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private link resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs index a24aed577c984..02a8710892d32 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubClient.cs @@ -99,6 +99,16 @@ public partial class IotHubClient : ServiceClient, IIotHubClient, /// public virtual IIotHubOperations IotHub { get; private set; } + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + /// /// Initializes a new instance of the IotHubClient class. /// @@ -345,8 +355,10 @@ private void Initialize() ResourceProviderCommon = new ResourceProviderCommonOperations(this); Certificates = new CertificatesOperations(this); IotHub = new IotHubOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-07-01-preview"; + ApiVersion = "2020-08-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs index 7134be018cc59..e5cef03471795 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperations.cs @@ -51,19 +51,20 @@ internal IotHubOperations(IotHubClient client) public IotHubClient Client { get; private set; } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// /// /// The headers that will be added to request. @@ -71,27 +72,28 @@ internal IotHubOperations(IotHubClient client) /// /// The cancellation token. /// - public async Task ManualFailoverWithHttpMessagesAsync(string iotHubName, FailoverInput failoverInput, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task ManualFailoverWithHttpMessagesAsync(string iotHubName, string resourceGroupName, string failoverRegion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginManualFailoverWithHttpMessagesAsync(iotHubName, failoverInput, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginManualFailoverWithHttpMessagesAsync(iotHubName, resourceGroupName, failoverRegion, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// /// /// Headers that will be added to request. @@ -111,20 +113,12 @@ internal IotHubOperations(IotHubClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginManualFailoverWithHttpMessagesAsync(string iotHubName, FailoverInput failoverInput, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task BeginManualFailoverWithHttpMessagesAsync(string iotHubName, string resourceGroupName, string failoverRegion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (iotHubName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "iotHubName"); } - if (failoverInput == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "failoverInput"); - } - if (failoverInput != null) - { - failoverInput.Validate(); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -137,6 +131,15 @@ internal IotHubOperations(IotHubClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + if (failoverRegion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "failoverRegion"); + } + FailoverInput failoverInput = new FailoverInput(); + if (failoverRegion != null) + { + failoverInput.FailoverRegion = failoverRegion; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -145,8 +148,8 @@ internal IotHubOperations(IotHubClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("iotHubName", iotHubName); - tracingParameters.Add("failoverInput", failoverInput); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("failoverInput", failoverInput); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "BeginManualFailover", tracingParameters); } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs index 6dbd00354cf62..41b30a9fcb09a 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubOperationsExtensions.cs @@ -22,101 +22,105 @@ namespace Microsoft.Azure.Management.IotHub public static partial class IotHubOperationsExtensions { /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// - public static void ManualFailover(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName) + public static void ManualFailover(this IIotHubOperations operations, string iotHubName, string resourceGroupName, string failoverRegion) { - operations.ManualFailoverAsync(iotHubName, failoverInput, resourceGroupName).GetAwaiter().GetResult(); + operations.ManualFailoverAsync(iotHubName, resourceGroupName, failoverRegion).GetAwaiter().GetResult(); } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// /// /// The cancellation token. /// - public static async Task ManualFailoverAsync(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task ManualFailoverAsync(this IIotHubOperations operations, string iotHubName, string resourceGroupName, string failoverRegion, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.ManualFailoverWithHttpMessagesAsync(iotHubName, failoverInput, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.ManualFailoverWithHttpMessagesAsync(iotHubName, resourceGroupName, failoverRegion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// - public static void BeginManualFailover(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName) + public static void BeginManualFailover(this IIotHubOperations operations, string iotHubName, string resourceGroupName, string failoverRegion) { - operations.BeginManualFailoverAsync(iotHubName, failoverInput, resourceGroupName).GetAwaiter().GetResult(); + operations.BeginManualFailoverAsync(iotHubName, resourceGroupName, failoverRegion).GetAwaiter().GetResult(); } /// - /// Manual Failover Fail over + /// Manually initiate a failover for the IoT Hub to its secondary region /// /// - /// Perform manual fail over of given hub + /// Manually initiate a failover for the IoT Hub to its secondary region. To + /// learn more, see https://aka.ms/manualfailover /// /// /// The operations group for this extension method. /// /// - /// IotHub to fail over - /// - /// - /// Region to failover to. Must be a azure DR pair + /// Name of the IoT hub to failover /// /// - /// resource group which Iot Hub belongs to + /// Name of the resource group containing the IoT hub resource + /// + /// + /// Region the hub will be failed over to /// /// /// The cancellation token. /// - public static async Task BeginManualFailoverAsync(this IIotHubOperations operations, string iotHubName, FailoverInput failoverInput, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginManualFailoverAsync(this IIotHubOperations operations, string iotHubName, string resourceGroupName, string failoverRegion, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginManualFailoverWithHttpMessagesAsync(iotHubName, failoverInput, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.BeginManualFailoverWithHttpMessagesAsync(iotHubName, resourceGroupName, failoverRegion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperations.cs index de5d6616e2e4e..9a3690a48439f 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperations.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperations.cs @@ -292,8 +292,8 @@ internal IotHubResourceOperations(IotHubClient client) /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// /// /// The headers that will be added to request. @@ -301,10 +301,10 @@ internal IotHubResourceOperations(IotHubClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, TagsResource iotHubTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, iotHubTags, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -1519,6 +1519,8 @@ internal IotHubResourceOperations(IotHubClient client) /// /// The name of the consumer group to add. /// + /// + /// /// /// Headers that will be added to request. /// @@ -1540,7 +1542,7 @@ internal IotHubResourceOperations(IotHubClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateEventHubConsumerGroupWithHttpMessagesAsync(string resourceGroupName, string resourceName, string eventHubEndpointName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateEventHubConsumerGroupWithHttpMessagesAsync(string resourceGroupName, string resourceName, string eventHubEndpointName, string name, EventHubConsumerGroupName properties = default(EventHubConsumerGroupName), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1566,6 +1568,11 @@ internal IotHubResourceOperations(IotHubClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "name"); } + EventHubConsumerGroupBodyDescription consumerGroupBody = new EventHubConsumerGroupBodyDescription(); + if (properties != null) + { + consumerGroupBody.Properties = properties; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1577,6 +1584,7 @@ internal IotHubResourceOperations(IotHubClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("eventHubEndpointName", eventHubEndpointName); tracingParameters.Add("name", name); + tracingParameters.Add("consumerGroupBody", consumerGroupBody); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateEventHubConsumerGroup", tracingParameters); } @@ -1631,6 +1639,12 @@ internal IotHubResourceOperations(IotHubClient client) // Serialize Request string _requestContent = null; + if(consumerGroupBody != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(consumerGroupBody, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } // Set Credentials if (Client.Credentials != null) { @@ -2698,9 +2712,8 @@ internal IotHubResourceOperations(IotHubClient client) /// /// Check if an IoT hub name is available. /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the - /// IoT hub to check. + /// + /// The name of the IoT hub to check. /// /// /// Headers that will be added to request. @@ -2723,7 +2736,7 @@ internal IotHubResourceOperations(IotHubClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CheckNameAvailabilityWithHttpMessagesAsync(OperationInputs operationInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CheckNameAvailabilityWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -2733,13 +2746,14 @@ internal IotHubResourceOperations(IotHubClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (operationInputs == null) + if (name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "operationInputs"); + throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (operationInputs != null) + OperationInputs operationInputs = new OperationInputs(); + if (name != null) { - operationInputs.Validate(); + operationInputs.Name = name; } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -4399,8 +4413,8 @@ internal IotHubResourceOperations(IotHubClient client) /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// /// /// Headers that will be added to request. @@ -4423,7 +4437,7 @@ internal IotHubResourceOperations(IotHubClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, TagsResource iotHubTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { @@ -4437,14 +4451,15 @@ internal IotHubResourceOperations(IotHubClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } - if (iotHubTags == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "iotHubTags"); - } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + TagsResource iotHubTags = new TagsResource(); + if (tags != null) + { + iotHubTags.Tags = tags; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperationsExtensions.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperationsExtensions.cs index 6c423b599e808..e41ae9fa64594 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperationsExtensions.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/IotHubResourceOperationsExtensions.cs @@ -13,6 +13,8 @@ namespace Microsoft.Azure.Management.IotHub using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -149,12 +151,12 @@ public static IotHubDescription Get(this IIotHubResourceOperations operations, s /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// - public static IotHubDescription Update(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, TagsResource iotHubTags) + public static IotHubDescription Update(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) { - return operations.UpdateAsync(resourceGroupName, resourceName, iotHubTags).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); } /// @@ -173,15 +175,15 @@ public static IotHubDescription Update(this IIotHubResourceOperations operations /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, TagsResource iotHubTags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, iotHubTags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -538,9 +540,11 @@ public static EventHubConsumerGroupInfo GetEventHubConsumerGroup(this IIotHubRes /// /// The name of the consumer group to add. /// - public static EventHubConsumerGroupInfo CreateEventHubConsumerGroup(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, string eventHubEndpointName, string name) + /// + /// + public static EventHubConsumerGroupInfo CreateEventHubConsumerGroup(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, string eventHubEndpointName, string name, EventHubConsumerGroupName properties = default(EventHubConsumerGroupName)) { - return operations.CreateEventHubConsumerGroupAsync(resourceGroupName, resourceName, eventHubEndpointName, name).GetAwaiter().GetResult(); + return operations.CreateEventHubConsumerGroupAsync(resourceGroupName, resourceName, eventHubEndpointName, name, properties).GetAwaiter().GetResult(); } /// @@ -564,12 +568,14 @@ public static EventHubConsumerGroupInfo CreateEventHubConsumerGroup(this IIotHub /// /// The name of the consumer group to add. /// + /// + /// /// /// The cancellation token. /// - public static async Task CreateEventHubConsumerGroupAsync(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, string eventHubEndpointName, string name, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateEventHubConsumerGroupAsync(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, string eventHubEndpointName, string name, EventHubConsumerGroupName properties = default(EventHubConsumerGroupName), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateEventHubConsumerGroupWithHttpMessagesAsync(resourceGroupName, resourceName, eventHubEndpointName, name, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateEventHubConsumerGroupWithHttpMessagesAsync(resourceGroupName, resourceName, eventHubEndpointName, name, properties, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -835,13 +841,12 @@ public static IPage GetEndpointHealth(this IIotHubResourceOp /// /// The operations group for this extension method. /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the - /// IoT hub to check. + /// + /// The name of the IoT hub to check. /// - public static IotHubNameAvailabilityInfo CheckNameAvailability(this IIotHubResourceOperations operations, OperationInputs operationInputs) + public static IotHubNameAvailabilityInfo CheckNameAvailability(this IIotHubResourceOperations operations, string name) { - return operations.CheckNameAvailabilityAsync(operationInputs).GetAwaiter().GetResult(); + return operations.CheckNameAvailabilityAsync(name).GetAwaiter().GetResult(); } /// @@ -853,16 +858,15 @@ public static IotHubNameAvailabilityInfo CheckNameAvailability(this IIotHubResou /// /// The operations group for this extension method. /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the - /// IoT hub to check. + /// + /// The name of the IoT hub to check. /// /// /// The cancellation token. /// - public static async Task CheckNameAvailabilityAsync(this IIotHubResourceOperations operations, OperationInputs operationInputs, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckNameAvailabilityAsync(this IIotHubResourceOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(operationInputs, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -1280,12 +1284,12 @@ public static JobResponse ImportDevices(this IIotHubResourceOperations operation /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// - public static IotHubDescription BeginUpdate(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, TagsResource iotHubTags) + public static IotHubDescription BeginUpdate(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary)) { - return operations.BeginUpdateAsync(resourceGroupName, resourceName, iotHubTags).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(resourceGroupName, resourceName, tags).GetAwaiter().GetResult(); } /// @@ -1304,15 +1308,15 @@ public static IotHubDescription BeginUpdate(this IIotHubResourceOperations opera /// /// Name of iot hub to update. /// - /// - /// Updated tag information to set into the iot hub instance. + /// + /// Resource tags /// /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, TagsResource iotHubTags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IIotHubResourceOperations operations, string resourceGroupName, string resourceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, iotHubTags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, tags, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/AuthenticationType.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/AuthenticationType.cs new file mode 100644 index 0000000000000..927b2548df33a --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/AuthenticationType.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + + /// + /// Defines values for AuthenticationType. + /// + public static class AuthenticationType + { + public const string KeyBased = "keyBased"; + public const string IdentityBased = "identityBased"; + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthData.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthData.cs index 7e81c9abf2e42..495dc1ed57ca8 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthData.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthData.cs @@ -10,6 +10,8 @@ namespace Microsoft.Azure.Management.IotHub.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Linq; @@ -43,11 +45,23 @@ public EndpointHealthData() /// shows that the IoT Hub has not established a connection with the /// endpoint. No messages have been delivered to or rejected from this /// endpoint. Possible values include: 'unknown', 'healthy', - /// 'unhealthy', 'dead' - public EndpointHealthData(string endpointId = default(string), string healthStatus = default(string)) + /// 'degraded', 'unhealthy', 'dead' + /// Last error obtained when a message + /// failed to be delivered to iot hub + /// Time at which the last known error + /// occurred + /// Last time iot hub + /// successfully sent a message to the endpoint + /// Last time iot hub tried to send a + /// message to the endpoint + public EndpointHealthData(string endpointId = default(string), string healthStatus = default(string), string lastKnownError = default(string), System.DateTime? lastKnownErrorTime = default(System.DateTime?), System.DateTime? lastSuccessfulSendAttemptTime = default(System.DateTime?), System.DateTime? lastSendAttemptTime = default(System.DateTime?)) { EndpointId = endpointId; HealthStatus = healthStatus; + LastKnownError = lastKnownError; + LastKnownErrorTime = lastKnownErrorTime; + LastSuccessfulSendAttemptTime = lastSuccessfulSendAttemptTime; + LastSendAttemptTime = lastSendAttemptTime; CustomInit(); } @@ -75,10 +89,41 @@ public EndpointHealthData() /// issues with endpoints. The 'unknown' status shows that the IoT Hub /// has not established a connection with the endpoint. No messages /// have been delivered to or rejected from this endpoint. Possible - /// values include: 'unknown', 'healthy', 'unhealthy', 'dead' + /// values include: 'unknown', 'healthy', 'degraded', 'unhealthy', + /// 'dead' /// [JsonProperty(PropertyName = "healthStatus")] public string HealthStatus { get; set; } + /// + /// Gets or sets last error obtained when a message failed to be + /// delivered to iot hub + /// + [JsonProperty(PropertyName = "lastKnownError")] + public string LastKnownError { get; set; } + + /// + /// Gets or sets time at which the last known error occurred + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "lastKnownErrorTime")] + public System.DateTime? LastKnownErrorTime { get; set; } + + /// + /// Gets or sets last time iot hub successfully sent a message to the + /// endpoint + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "lastSuccessfulSendAttemptTime")] + public System.DateTime? LastSuccessfulSendAttemptTime { get; set; } + + /// + /// Gets or sets last time iot hub tried to send a message to the + /// endpoint + /// + [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] + [JsonProperty(PropertyName = "lastSendAttemptTime")] + public System.DateTime? LastSendAttemptTime { get; set; } + } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthStatus.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthStatus.cs index 82fd7f09e03a0..b5de1f7c9d01d 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthStatus.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EndpointHealthStatus.cs @@ -18,6 +18,7 @@ public static class EndpointHealthStatus { public const string Unknown = "unknown"; public const string Healthy = "healthy"; + public const string Degraded = "degraded"; public const string Unhealthy = "unhealthy"; public const string Dead = "dead"; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EventHubConsumerGroupBodyDescription.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EventHubConsumerGroupBodyDescription.cs new file mode 100644 index 0000000000000..ddf50f27990f1 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EventHubConsumerGroupBodyDescription.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The EventHub consumer group. + /// + public partial class EventHubConsumerGroupBodyDescription + { + /// + /// Initializes a new instance of the + /// EventHubConsumerGroupBodyDescription class. + /// + public EventHubConsumerGroupBodyDescription() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// EventHubConsumerGroupBodyDescription class. + /// + public EventHubConsumerGroupBodyDescription(EventHubConsumerGroupName properties = default(EventHubConsumerGroupName)) + { + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "properties")] + public EventHubConsumerGroupName Properties { get; set; } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EventHubConsumerGroupName.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EventHubConsumerGroupName.cs new file mode 100644 index 0000000000000..c090911174d5a --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/EventHubConsumerGroupName.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The EventHub consumer group name. + /// + public partial class EventHubConsumerGroupName + { + /// + /// Initializes a new instance of the EventHubConsumerGroupName class. + /// + public EventHubConsumerGroupName() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EventHubConsumerGroupName class. + /// + /// EventHub consumer group name + public EventHubConsumerGroupName(string name = default(string)) + { + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets eventHub consumer group name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ExportDevicesRequest.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ExportDevicesRequest.cs index 3e002e7271eb1..21fb528b09978 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ExportDevicesRequest.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ExportDevicesRequest.cs @@ -35,10 +35,26 @@ public ExportDevicesRequest() /// URI. /// The value indicating whether keys should /// be excluded during export. - public ExportDevicesRequest(string exportBlobContainerUri, bool excludeKeys) + /// The name of the blob that will be + /// created in the provided output blob container. This blob will + /// contain the exported device registry information for the IoT + /// Hub. + /// Specifies authentication type + /// being used for connecting to the storage account. Possible values + /// include: 'keyBased', 'identityBased' + /// The value indicating whether + /// configurations should be exported. + /// The name of the blob that will + /// be created in the provided output blob container. This blob will + /// contain the exported configurations for the Iot Hub. + public ExportDevicesRequest(string exportBlobContainerUri, bool excludeKeys, string exportBlobName = default(string), string authenticationType = default(string), bool? includeConfigurations = default(bool?), string configurationsBlobName = default(string)) { ExportBlobContainerUri = exportBlobContainerUri; ExcludeKeys = excludeKeys; + ExportBlobName = exportBlobName; + AuthenticationType = authenticationType; + IncludeConfigurations = includeConfigurations; + ConfigurationsBlobName = configurationsBlobName; CustomInit(); } @@ -60,6 +76,37 @@ public ExportDevicesRequest(string exportBlobContainerUri, bool excludeKeys) [JsonProperty(PropertyName = "excludeKeys")] public bool ExcludeKeys { get; set; } + /// + /// Gets or sets the name of the blob that will be created in the + /// provided output blob container. This blob will contain the exported + /// device registry information for the IoT Hub. + /// + [JsonProperty(PropertyName = "exportBlobName")] + public string ExportBlobName { get; set; } + + /// + /// Gets or sets specifies authentication type being used for + /// connecting to the storage account. Possible values include: + /// 'keyBased', 'identityBased' + /// + [JsonProperty(PropertyName = "authenticationType")] + public string AuthenticationType { get; set; } + + /// + /// Gets or sets the value indicating whether configurations should be + /// exported. + /// + [JsonProperty(PropertyName = "includeConfigurations")] + public bool? IncludeConfigurations { get; set; } + + /// + /// Gets or sets the name of the blob that will be created in the + /// provided output blob container. This blob will contain the exported + /// configurations for the Iot Hub. + /// + [JsonProperty(PropertyName = "configurationsBlobName")] + public string ConfigurationsBlobName { get; set; } + /// /// Validate the object. /// diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/GroupIdInformation.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/GroupIdInformation.cs new file mode 100644 index 0000000000000..a646ed0f9a277 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/GroupIdInformation.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The group information for creating a private endpoint on an IotHub + /// + public partial class GroupIdInformation + { + /// + /// Initializes a new instance of the GroupIdInformation class. + /// + public GroupIdInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GroupIdInformation class. + /// + /// The resource identifier. + /// The resource name. + /// The resource type. + public GroupIdInformation(GroupIdInformationProperties properties, string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public GroupIdInformationProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$"); + } + } + } + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/GroupIdInformationProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/GroupIdInformationProperties.cs new file mode 100644 index 0000000000000..847cf84527782 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/GroupIdInformationProperties.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The properties for a group information object + /// + public partial class GroupIdInformationProperties + { + /// + /// Initializes a new instance of the GroupIdInformationProperties + /// class. + /// + public GroupIdInformationProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GroupIdInformationProperties + /// class. + /// + /// The group id + /// The required members for a specific + /// group id + /// The required DNS zones for a + /// specific group id + public GroupIdInformationProperties(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the group id + /// + [JsonProperty(PropertyName = "groupId")] + public string GroupId { get; set; } + + /// + /// Gets or sets the required members for a specific group id + /// + [JsonProperty(PropertyName = "requiredMembers")] + public IList RequiredMembers { get; set; } + + /// + /// Gets or sets the required DNS zones for a specific group id + /// + [JsonProperty(PropertyName = "requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ImportDevicesRequest.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ImportDevicesRequest.cs index 7863c58693d55..8fb9ed0843915 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ImportDevicesRequest.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/ImportDevicesRequest.cs @@ -35,10 +35,27 @@ public ImportDevicesRequest() /// URI. /// The output blob container /// URI. - public ImportDevicesRequest(string inputBlobContainerUri, string outputBlobContainerUri) + /// The blob name to be used when importing + /// from the provided input blob container. + /// The blob name to use for storing the + /// status of the import job. + /// Specifies authentication type + /// being used for connecting to the storage account. Possible values + /// include: 'keyBased', 'identityBased' + /// The value indicating whether + /// configurations should be imported. + /// The blob name to be used when + /// importing configurations from the provided input blob + /// container. + public ImportDevicesRequest(string inputBlobContainerUri, string outputBlobContainerUri, string inputBlobName = default(string), string outputBlobName = default(string), string authenticationType = default(string), bool? includeConfigurations = default(bool?), string configurationsBlobName = default(string)) { InputBlobContainerUri = inputBlobContainerUri; OutputBlobContainerUri = outputBlobContainerUri; + InputBlobName = inputBlobName; + OutputBlobName = outputBlobName; + AuthenticationType = authenticationType; + IncludeConfigurations = includeConfigurations; + ConfigurationsBlobName = configurationsBlobName; CustomInit(); } @@ -59,6 +76,42 @@ public ImportDevicesRequest(string inputBlobContainerUri, string outputBlobConta [JsonProperty(PropertyName = "outputBlobContainerUri")] public string OutputBlobContainerUri { get; set; } + /// + /// Gets or sets the blob name to be used when importing from the + /// provided input blob container. + /// + [JsonProperty(PropertyName = "inputBlobName")] + public string InputBlobName { get; set; } + + /// + /// Gets or sets the blob name to use for storing the status of the + /// import job. + /// + [JsonProperty(PropertyName = "outputBlobName")] + public string OutputBlobName { get; set; } + + /// + /// Gets or sets specifies authentication type being used for + /// connecting to the storage account. Possible values include: + /// 'keyBased', 'identityBased' + /// + [JsonProperty(PropertyName = "authenticationType")] + public string AuthenticationType { get; set; } + + /// + /// Gets or sets the value indicating whether configurations should be + /// imported. + /// + [JsonProperty(PropertyName = "includeConfigurations")] + public bool? IncludeConfigurations { get; set; } + + /// + /// Gets or sets the blob name to be used when importing configurations + /// from the provided input blob container. + /// + [JsonProperty(PropertyName = "configurationsBlobName")] + public string ConfigurationsBlobName { get; set; } + /// /// Validate the object. /// diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs index 81b9b6254fe03..0adf8e3c46fe7 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubLocationDescription.cs @@ -30,9 +30,13 @@ public IotHubLocationDescription() /// /// Initializes a new instance of the IotHubLocationDescription class. /// - /// Azure Geo Regions - /// Specific Role assigned to this location. - /// Possible values include: 'primary', 'secondary' + /// The name of the Azure region + /// The role of the region, can be either primary or + /// secondary. The primary region is where the IoT hub is currently + /// provisioned. The secondary region is the Azure disaster recovery + /// (DR) paired region and also the region where the IoT hub can + /// failover to. Possible values include: 'primary', + /// 'secondary' public IotHubLocationDescription(string location = default(string), string role = default(string)) { Location = location; @@ -46,14 +50,17 @@ public IotHubLocationDescription() partial void CustomInit(); /// - /// Gets or sets azure Geo Regions + /// Gets or sets the name of the Azure region /// [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// - /// Gets or sets specific Role assigned to this location. Possible - /// values include: 'primary', 'secondary' + /// Gets or sets the role of the region, can be either primary or + /// secondary. The primary region is where the IoT hub is currently + /// provisioned. The secondary region is the Azure disaster recovery + /// (DR) paired region and also the region where the IoT hub can + /// failover to. Possible values include: 'primary', 'secondary' /// [JsonProperty(PropertyName = "role")] public string Role { get; set; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs index 77b4a13002f32..529baa2ca1e5e 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubProperties.cs @@ -33,7 +33,15 @@ public IotHubProperties() /// /// The shared access policies you /// can use to secure a connection to the IoT hub. + /// Whether requests from Public + /// Network are allowed. Possible values include: 'Enabled', + /// 'Disabled' /// The IP filter rules. + /// Specifies the minimum TLS version to + /// support for this hub. Can be set to "1.2" to have clients that use + /// a TLS version below 1.2 to be rejected. + /// Private endpoint + /// connections created on this IotHub /// The provisioning state. /// The hub state. /// The name of the host. @@ -53,17 +61,18 @@ public IotHubProperties() /// If True, file upload /// notifications are enabled. /// IoT hub comments. - /// The device streams properties of - /// iothub. /// The capabilities and features enabled for /// the IoT hub. Possible values include: 'None', /// 'DeviceManagement' /// Primary and secondary location for iot /// hub - public IotHubProperties(IList authorizationPolicies = default(IList), IList ipFilterRules = default(IList), string provisioningState = default(string), string state = default(string), string hostName = default(string), IDictionary eventHubEndpoints = default(IDictionary), RoutingProperties routing = default(RoutingProperties), IDictionary storageEndpoints = default(IDictionary), IDictionary messagingEndpoints = default(IDictionary), bool? enableFileUploadNotifications = default(bool?), CloudToDeviceProperties cloudToDevice = default(CloudToDeviceProperties), string comments = default(string), IotHubPropertiesDeviceStreams deviceStreams = default(IotHubPropertiesDeviceStreams), string features = default(string), IList locations = default(IList)) + public IotHubProperties(IList authorizationPolicies = default(IList), string publicNetworkAccess = default(string), IList ipFilterRules = default(IList), string minTlsVersion = default(string), IList privateEndpointConnections = default(IList), string provisioningState = default(string), string state = default(string), string hostName = default(string), IDictionary eventHubEndpoints = default(IDictionary), RoutingProperties routing = default(RoutingProperties), IDictionary storageEndpoints = default(IDictionary), IDictionary messagingEndpoints = default(IDictionary), bool? enableFileUploadNotifications = default(bool?), CloudToDeviceProperties cloudToDevice = default(CloudToDeviceProperties), string comments = default(string), string features = default(string), IList locations = default(IList)) { AuthorizationPolicies = authorizationPolicies; + PublicNetworkAccess = publicNetworkAccess; IpFilterRules = ipFilterRules; + MinTlsVersion = minTlsVersion; + PrivateEndpointConnections = privateEndpointConnections; ProvisioningState = provisioningState; State = state; HostName = hostName; @@ -74,7 +83,6 @@ public IotHubProperties() EnableFileUploadNotifications = enableFileUploadNotifications; CloudToDevice = cloudToDevice; Comments = comments; - DeviceStreams = deviceStreams; Features = features; Locations = locations; CustomInit(); @@ -92,12 +100,33 @@ public IotHubProperties() [JsonProperty(PropertyName = "authorizationPolicies")] public IList AuthorizationPolicies { get; set; } + /// + /// Gets or sets whether requests from Public Network are allowed. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + /// /// Gets or sets the IP filter rules. /// [JsonProperty(PropertyName = "ipFilterRules")] public IList IpFilterRules { get; set; } + /// + /// Gets or sets specifies the minimum TLS version to support for this + /// hub. Can be set to "1.2" to have clients that use a TLS version + /// below 1.2 to be rejected. + /// + [JsonProperty(PropertyName = "minTlsVersion")] + public string MinTlsVersion { get; set; } + + /// + /// Gets or sets private endpoint connections created on this IotHub + /// + [JsonProperty(PropertyName = "privateEndpointConnections")] + public IList PrivateEndpointConnections { get; set; } + /// /// Gets the provisioning state. /// @@ -166,12 +195,6 @@ public IotHubProperties() [JsonProperty(PropertyName = "comments")] public string Comments { get; set; } - /// - /// Gets or sets the device streams properties of iothub. - /// - [JsonProperty(PropertyName = "deviceStreams")] - public IotHubPropertiesDeviceStreams DeviceStreams { get; set; } - /// /// Gets or sets the capabilities and features enabled for the IoT hub. /// Possible values include: 'None', 'DeviceManagement' @@ -213,6 +236,16 @@ public virtual void Validate() } } } + if (PrivateEndpointConnections != null) + { + foreach (var element2 in PrivateEndpointConnections) + { + if (element2 != null) + { + element2.Validate(); + } + } + } if (Routing != null) { Routing.Validate(); diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpoint.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 0000000000000..31925eecab112 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The private endpoint property of a private endpoint connection + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The resource identifier. + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 0000000000000..be46ac71b2f93 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,99 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The private endpoint connection of an IotHub + /// + public partial class PrivateEndpointConnection : IResource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// The resource identifier. + /// The resource name. + /// The resource type. + public PrivateEndpointConnection(PrivateEndpointConnectionProperties properties, string id = default(string), string name = default(string), string type = default(string)) + { + Id = id; + Name = name; + Type = type; + Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the resource identifier. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the resource name. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// + [JsonProperty(PropertyName = "properties")] + public PrivateEndpointConnectionProperties Properties { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + } + if (Name != null) + { + if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "Name", "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$"); + } + } + if (Properties != null) + { + Properties.Validate(); + } + } + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 0000000000000..35544f7366917 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,75 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The properties of a private endpoint connection + /// + public partial class PrivateEndpointConnectionProperties + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionProperties class. + /// + public PrivateEndpointConnectionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionProperties class. + /// + public PrivateEndpointConnectionProperties(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpoint privateEndpoint = default(PrivateEndpoint)) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// + [JsonProperty(PropertyName = "privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// + [JsonProperty(PropertyName = "privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateLinkServiceConnectionState"); + } + if (PrivateLinkServiceConnectionState != null) + { + PrivateLinkServiceConnectionState.Validate(); + } + } + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkResources.cs similarity index 55% rename from sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs rename to sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkResources.cs index 19f258e077c38..91ba3e59537d7 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/IotHubPropertiesDeviceStreams.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkResources.cs @@ -16,28 +16,26 @@ namespace Microsoft.Azure.Management.IotHub.Models using System.Linq; /// - /// The device streams properties of iothub. + /// The available private link resources for an IotHub /// - public partial class IotHubPropertiesDeviceStreams + public partial class PrivateLinkResources { /// - /// Initializes a new instance of the IotHubPropertiesDeviceStreams - /// class. + /// Initializes a new instance of the PrivateLinkResources class. /// - public IotHubPropertiesDeviceStreams() + public PrivateLinkResources() { CustomInit(); } /// - /// Initializes a new instance of the IotHubPropertiesDeviceStreams - /// class. + /// Initializes a new instance of the PrivateLinkResources class. /// - /// List of Device Streams - /// Endpoints. - public IotHubPropertiesDeviceStreams(IList streamingEndpoints = default(IList)) + /// The list of available private link resources + /// for an IotHub + public PrivateLinkResources(IList value = default(IList)) { - StreamingEndpoints = streamingEndpoints; + Value = value; CustomInit(); } @@ -47,10 +45,11 @@ public IotHubPropertiesDeviceStreams() partial void CustomInit(); /// - /// Gets or sets list of Device Streams Endpoints. + /// Gets or sets the list of available private link resources for an + /// IotHub /// - [JsonProperty(PropertyName = "streamingEndpoints")] - public IList StreamingEndpoints { get; set; } + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 0000000000000..aa79980459699 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -0,0 +1,93 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The current state of a private endpoint connection + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// The status of a private endpoint connection. + /// Possible values include: 'Pending', 'Approved', 'Rejected', + /// 'Disconnected' + /// The description for the current state of + /// a private endpoint connection + /// Actions required for a private + /// endpoint connection + public PrivateLinkServiceConnectionState(string status, string description, string actionsRequired = default(string)) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the status of a private endpoint connection. Possible + /// values include: 'Pending', 'Approved', 'Rejected', 'Disconnected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the description for the current state of a private + /// endpoint connection + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets actions required for a private endpoint connection + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Status == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Status"); + } + if (Description == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Description"); + } + } + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkServiceConnectionStatus.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkServiceConnectionStatus.cs new file mode 100644 index 0000000000000..e5a5b857a5e6f --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PrivateLinkServiceConnectionStatus.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + + /// + /// Defines values for PrivateLinkServiceConnectionStatus. + /// + public static class PrivateLinkServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + public const string Disconnected = "Disconnected"; + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PublicNetworkAccess.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 0000000000000..944b50bb89f8b --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RouteProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RouteProperties.cs index 5744aeca3274e..0bca2ab9baf46 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RouteProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RouteProperties.cs @@ -39,8 +39,7 @@ public RouteProperties() /// The source that the routing rule is to be /// applied to, such as DeviceMessages. Possible values include: /// 'Invalid', 'DeviceMessages', 'TwinChangeEvents', - /// 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents', - /// 'DigitalTwinChangeEvents' + /// 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents' /// The list of endpoints to which messages /// that satisfy the condition are routed. Currently only one endpoint /// is allowed. @@ -77,7 +76,7 @@ public RouteProperties() /// Gets or sets the source that the routing rule is to be applied to, /// such as DeviceMessages. Possible values include: 'Invalid', /// 'DeviceMessages', 'TwinChangeEvents', 'DeviceLifecycleEvents', - /// 'DeviceJobLifecycleEvents', 'DigitalTwinChangeEvents' + /// 'DeviceJobLifecycleEvents' /// [JsonProperty(PropertyName = "source")] public string Source { get; set; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingEventHubProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingEventHubProperties.cs index f6cd5537a17d6..f5c4b14f197a0 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingEventHubProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingEventHubProperties.cs @@ -30,20 +30,32 @@ public RoutingEventHubProperties() /// /// Initializes a new instance of the RoutingEventHubProperties class. /// - /// The connection string of the event - /// hub endpoint. /// The name that identifies this endpoint. The name /// can only include alphanumeric characters, periods, underscores, /// hyphens and has a maximum length of 64 characters. The following /// names are reserved: events, fileNotifications, $default. Endpoint /// names must be unique across endpoint types. + /// Id of the event hub endpoint + /// The connection string of the event + /// hub endpoint. + /// The url of the event hub endpoint. It + /// must include the protocol sb:// + /// Event hub name on the event hub + /// namespace + /// Method used to authenticate + /// against the event hub endpoint. Possible values include: + /// 'keyBased', 'identityBased' /// The subscription identifier of the /// event hub endpoint. /// The name of the resource group of the /// event hub endpoint. - public RoutingEventHubProperties(string connectionString, string name, string subscriptionId = default(string), string resourceGroup = default(string)) + public RoutingEventHubProperties(string name, string id = default(string), string connectionString = default(string), string endpointUri = default(string), string entityPath = default(string), string authenticationType = default(string), string subscriptionId = default(string), string resourceGroup = default(string)) { + Id = id; ConnectionString = connectionString; + EndpointUri = endpointUri; + EntityPath = entityPath; + AuthenticationType = authenticationType; Name = name; SubscriptionId = subscriptionId; ResourceGroup = resourceGroup; @@ -55,12 +67,38 @@ public RoutingEventHubProperties() /// partial void CustomInit(); + /// + /// Gets or sets id of the event hub endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + /// /// Gets or sets the connection string of the event hub endpoint. /// [JsonProperty(PropertyName = "connectionString")] public string ConnectionString { get; set; } + /// + /// Gets or sets the url of the event hub endpoint. It must include the + /// protocol sb:// + /// + [JsonProperty(PropertyName = "endpointUri")] + public string EndpointUri { get; set; } + + /// + /// Gets or sets event hub name on the event hub namespace + /// + [JsonProperty(PropertyName = "entityPath")] + public string EntityPath { get; set; } + + /// + /// Gets or sets method used to authenticate against the event hub + /// endpoint. Possible values include: 'keyBased', 'identityBased' + /// + [JsonProperty(PropertyName = "authenticationType")] + public string AuthenticationType { get; set; } + /// /// Gets or sets the name that identifies this endpoint. The name can /// only include alphanumeric characters, periods, underscores, hyphens @@ -92,10 +130,6 @@ public RoutingEventHubProperties() /// public virtual void Validate() { - if (ConnectionString == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); - } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs index 43333e1f90204..be3a8272ff3f7 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingProperties.cs @@ -44,7 +44,8 @@ public RoutingProperties() /// built-in eventhub endpoint. /// The list of user-provided enrichments /// that the IoT hub applies to messages to be delivered to built-in - /// and custom endpoints. See: https://aka.ms/iotmsgenrich + /// and custom endpoints. See: + /// https://aka.ms/telemetryoneventgrid public RoutingProperties(RoutingEndpoints endpoints = default(RoutingEndpoints), IList routes = default(IList), FallbackRouteProperties fallbackRoute = default(FallbackRouteProperties), IList enrichments = default(IList)) { Endpoints = endpoints; @@ -87,7 +88,7 @@ public RoutingProperties() /// /// Gets or sets the list of user-provided enrichments that the IoT hub /// applies to messages to be delivered to built-in and custom - /// endpoints. See: https://aka.ms/iotmsgenrich + /// endpoints. See: https://aka.ms/telemetryoneventgrid /// [JsonProperty(PropertyName = "enrichments")] public IList Enrichments { get; set; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusQueueEndpointProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusQueueEndpointProperties.cs index 69a7c9b3527e3..66202dd4a90dc 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusQueueEndpointProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusQueueEndpointProperties.cs @@ -32,21 +32,33 @@ public RoutingServiceBusQueueEndpointProperties() /// Initializes a new instance of the /// RoutingServiceBusQueueEndpointProperties class. /// - /// The connection string of the service - /// bus queue endpoint. /// The name that identifies this endpoint. The name /// can only include alphanumeric characters, periods, underscores, /// hyphens and has a maximum length of 64 characters. The following /// names are reserved: events, fileNotifications, $default. Endpoint /// names must be unique across endpoint types. The name need not be /// the same as the actual queue name. + /// Id of the service bus queue endpoint + /// The connection string of the service + /// bus queue endpoint. + /// The url of the service bus queue + /// endpoint. It must include the protocol sb:// + /// Queue name on the service bus + /// namespace + /// Method used to authenticate + /// against the service bus queue endpoint. Possible values include: + /// 'keyBased', 'identityBased' /// The subscription identifier of the /// service bus queue endpoint. /// The name of the resource group of the /// service bus queue endpoint. - public RoutingServiceBusQueueEndpointProperties(string connectionString, string name, string subscriptionId = default(string), string resourceGroup = default(string)) + public RoutingServiceBusQueueEndpointProperties(string name, string id = default(string), string connectionString = default(string), string endpointUri = default(string), string entityPath = default(string), string authenticationType = default(string), string subscriptionId = default(string), string resourceGroup = default(string)) { + Id = id; ConnectionString = connectionString; + EndpointUri = endpointUri; + EntityPath = entityPath; + AuthenticationType = authenticationType; Name = name; SubscriptionId = subscriptionId; ResourceGroup = resourceGroup; @@ -58,6 +70,12 @@ public RoutingServiceBusQueueEndpointProperties() /// partial void CustomInit(); + /// + /// Gets or sets id of the service bus queue endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + /// /// Gets or sets the connection string of the service bus queue /// endpoint. @@ -65,6 +83,27 @@ public RoutingServiceBusQueueEndpointProperties() [JsonProperty(PropertyName = "connectionString")] public string ConnectionString { get; set; } + /// + /// Gets or sets the url of the service bus queue endpoint. It must + /// include the protocol sb:// + /// + [JsonProperty(PropertyName = "endpointUri")] + public string EndpointUri { get; set; } + + /// + /// Gets or sets queue name on the service bus namespace + /// + [JsonProperty(PropertyName = "entityPath")] + public string EntityPath { get; set; } + + /// + /// Gets or sets method used to authenticate against the service bus + /// queue endpoint. Possible values include: 'keyBased', + /// 'identityBased' + /// + [JsonProperty(PropertyName = "authenticationType")] + public string AuthenticationType { get; set; } + /// /// Gets or sets the name that identifies this endpoint. The name can /// only include alphanumeric characters, periods, underscores, hyphens @@ -98,10 +137,6 @@ public RoutingServiceBusQueueEndpointProperties() /// public virtual void Validate() { - if (ConnectionString == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); - } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusTopicEndpointProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusTopicEndpointProperties.cs index 05db867e03527..2c9627da6f751 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusTopicEndpointProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingServiceBusTopicEndpointProperties.cs @@ -32,21 +32,33 @@ public RoutingServiceBusTopicEndpointProperties() /// Initializes a new instance of the /// RoutingServiceBusTopicEndpointProperties class. /// - /// The connection string of the service - /// bus topic endpoint. /// The name that identifies this endpoint. The name /// can only include alphanumeric characters, periods, underscores, /// hyphens and has a maximum length of 64 characters. The following /// names are reserved: events, fileNotifications, $default. Endpoint /// names must be unique across endpoint types. The name need not be /// the same as the actual topic name. + /// Id of the service bus topic endpoint + /// The connection string of the service + /// bus topic endpoint. + /// The url of the service bus topic + /// endpoint. It must include the protocol sb:// + /// Queue name on the service bus + /// topic + /// Method used to authenticate + /// against the service bus topic endpoint. Possible values include: + /// 'keyBased', 'identityBased' /// The subscription identifier of the /// service bus topic endpoint. /// The name of the resource group of the /// service bus topic endpoint. - public RoutingServiceBusTopicEndpointProperties(string connectionString, string name, string subscriptionId = default(string), string resourceGroup = default(string)) + public RoutingServiceBusTopicEndpointProperties(string name, string id = default(string), string connectionString = default(string), string endpointUri = default(string), string entityPath = default(string), string authenticationType = default(string), string subscriptionId = default(string), string resourceGroup = default(string)) { + Id = id; ConnectionString = connectionString; + EndpointUri = endpointUri; + EntityPath = entityPath; + AuthenticationType = authenticationType; Name = name; SubscriptionId = subscriptionId; ResourceGroup = resourceGroup; @@ -58,6 +70,12 @@ public RoutingServiceBusTopicEndpointProperties() /// partial void CustomInit(); + /// + /// Gets or sets id of the service bus topic endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + /// /// Gets or sets the connection string of the service bus topic /// endpoint. @@ -65,6 +83,27 @@ public RoutingServiceBusTopicEndpointProperties() [JsonProperty(PropertyName = "connectionString")] public string ConnectionString { get; set; } + /// + /// Gets or sets the url of the service bus topic endpoint. It must + /// include the protocol sb:// + /// + [JsonProperty(PropertyName = "endpointUri")] + public string EndpointUri { get; set; } + + /// + /// Gets or sets queue name on the service bus topic + /// + [JsonProperty(PropertyName = "entityPath")] + public string EntityPath { get; set; } + + /// + /// Gets or sets method used to authenticate against the service bus + /// topic endpoint. Possible values include: 'keyBased', + /// 'identityBased' + /// + [JsonProperty(PropertyName = "authenticationType")] + public string AuthenticationType { get; set; } + /// /// Gets or sets the name that identifies this endpoint. The name can /// only include alphanumeric characters, periods, underscores, hyphens @@ -98,10 +137,6 @@ public RoutingServiceBusTopicEndpointProperties() /// public virtual void Validate() { - if (ConnectionString == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); - } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingSource.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingSource.cs index dd90eed51d44d..e1caf2ad9a7f4 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingSource.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingSource.cs @@ -21,6 +21,5 @@ public static class RoutingSource public const string TwinChangeEvents = "TwinChangeEvents"; public const string DeviceLifecycleEvents = "DeviceLifecycleEvents"; public const string DeviceJobLifecycleEvents = "DeviceJobLifecycleEvents"; - public const string DigitalTwinChangeEvents = "DigitalTwinChangeEvents"; } } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingStorageContainerProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingStorageContainerProperties.cs index 58e6c19b3fdd2..31fb6a8c21d79 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingStorageContainerProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/RoutingStorageContainerProperties.cs @@ -32,8 +32,6 @@ public RoutingStorageContainerProperties() /// Initializes a new instance of the RoutingStorageContainerProperties /// class. /// - /// The connection string of the storage - /// account. /// The name that identifies this endpoint. The name /// can only include alphanumeric characters, periods, underscores, /// hyphens and has a maximum length of 64 characters. The following @@ -41,6 +39,14 @@ public RoutingStorageContainerProperties() /// names must be unique across endpoint types. /// The name of storage container in the /// storage account. + /// Id of the storage container endpoint + /// The connection string of the storage + /// account. + /// The url of the storage endpoint. It must + /// include the protocol https:// + /// Method used to authenticate + /// against the storage endpoint. Possible values include: 'keyBased', + /// 'identityBased' /// The subscription identifier of the /// storage account. /// The name of the resource group of the @@ -58,9 +64,12 @@ public RoutingStorageContainerProperties() /// to blobs. Supported values are 'avro', 'avrodeflate', and 'JSON'. /// Default value is 'avro'. Possible values include: 'Avro', /// 'AvroDeflate', 'JSON' - public RoutingStorageContainerProperties(string connectionString, string name, string containerName, string subscriptionId = default(string), string resourceGroup = default(string), string fileNameFormat = default(string), int? batchFrequencyInSeconds = default(int?), int? maxChunkSizeInBytes = default(int?), string encoding = default(string)) + public RoutingStorageContainerProperties(string name, string containerName, string id = default(string), string connectionString = default(string), string endpointUri = default(string), string authenticationType = default(string), string subscriptionId = default(string), string resourceGroup = default(string), string fileNameFormat = default(string), int? batchFrequencyInSeconds = default(int?), int? maxChunkSizeInBytes = default(int?), string encoding = default(string)) { + Id = id; ConnectionString = connectionString; + EndpointUri = endpointUri; + AuthenticationType = authenticationType; Name = name; SubscriptionId = subscriptionId; ResourceGroup = resourceGroup; @@ -77,12 +86,32 @@ public RoutingStorageContainerProperties() /// partial void CustomInit(); + /// + /// Gets or sets id of the storage container endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; set; } + /// /// Gets or sets the connection string of the storage account. /// [JsonProperty(PropertyName = "connectionString")] public string ConnectionString { get; set; } + /// + /// Gets or sets the url of the storage endpoint. It must include the + /// protocol https:// + /// + [JsonProperty(PropertyName = "endpointUri")] + public string EndpointUri { get; set; } + + /// + /// Gets or sets method used to authenticate against the storage + /// endpoint. Possible values include: 'keyBased', 'identityBased' + /// + [JsonProperty(PropertyName = "authenticationType")] + public string AuthenticationType { get; set; } + /// /// Gets or sets the name that identifies this endpoint. The name can /// only include alphanumeric characters, periods, underscores, hyphens @@ -152,10 +181,6 @@ public RoutingStorageContainerProperties() /// public virtual void Validate() { - if (ConnectionString == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); - } if (Name == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/StorageEndpointProperties.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/StorageEndpointProperties.cs index 9cc407931a64a..b7d2f3400fddc 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/StorageEndpointProperties.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/StorageEndpointProperties.cs @@ -38,11 +38,15 @@ public StorageEndpointProperties() /// The period of time for which the SAS /// URI generated by IoT Hub for file upload is valid. See: /// https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-file-upload#file-upload-notification-configuration-options. - public StorageEndpointProperties(string connectionString, string containerName, System.TimeSpan? sasTtlAsIso8601 = default(System.TimeSpan?)) + /// Specifies authentication type + /// being used for connecting to the storage account. Possible values + /// include: 'keyBased', 'identityBased' + public StorageEndpointProperties(string connectionString, string containerName, System.TimeSpan? sasTtlAsIso8601 = default(System.TimeSpan?), string authenticationType = default(string)) { SasTtlAsIso8601 = sasTtlAsIso8601; ConnectionString = connectionString; ContainerName = containerName; + AuthenticationType = authenticationType; CustomInit(); } @@ -74,6 +78,14 @@ public StorageEndpointProperties() [JsonProperty(PropertyName = "containerName")] public string ContainerName { get; set; } + /// + /// Gets or sets specifies authentication type being used for + /// connecting to the storage account. Possible values include: + /// 'keyBased', 'identityBased' + /// + [JsonProperty(PropertyName = "authenticationType")] + public string AuthenticationType { get; set; } + /// /// Validate the object. /// diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/TestAllRoutesInput.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/TestAllRoutesInput.cs index 67b3d0c42d074..84ad4754dafa0 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/TestAllRoutesInput.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/Models/TestAllRoutesInput.cs @@ -31,8 +31,7 @@ public TestAllRoutesInput() /// /// Routing source. Possible values /// include: 'Invalid', 'DeviceMessages', 'TwinChangeEvents', - /// 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents', - /// 'DigitalTwinChangeEvents' + /// 'DeviceLifecycleEvents', 'DeviceJobLifecycleEvents' /// Routing message /// Routing Twin Reference public TestAllRoutesInput(string routingSource = default(string), RoutingMessage message = default(RoutingMessage), RoutingTwin twin = default(RoutingTwin)) @@ -51,7 +50,7 @@ public TestAllRoutesInput() /// /// Gets or sets routing source. Possible values include: 'Invalid', /// 'DeviceMessages', 'TwinChangeEvents', 'DeviceLifecycleEvents', - /// 'DeviceJobLifecycleEvents', 'DigitalTwinChangeEvents' + /// 'DeviceJobLifecycleEvents' /// [JsonProperty(PropertyName = "routingSource")] public string RoutingSource { get; set; } diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..836d59767d77e --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,973 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionsOperations(IotHubClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotHubClient + /// + public IotHubClient Client { get; private set; } + + /// + /// List private endpoint connections + /// + /// + /// List private endpoint connection properties + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get private endpoint connection + /// + /// + /// Get private endpoint connection properties + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (properties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "properties"); + } + if (properties != null) + { + properties.Validate(); + } + PrivateEndpointConnection privateEndpointConnection = new PrivateEndpointConnection(); + if (properties != null) + { + privateEndpointConnection.Properties = properties; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("privateEndpointConnection", privateEndpointConnection); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(privateEndpointConnection != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateEndpointConnection, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 0000000000000..bd26ae703d460 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,341 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateEndpointConnectionsOperations. + /// + public static partial class PrivateEndpointConnectionsOperationsExtensions + { + /// + /// List private endpoint connections + /// + /// + /// List private endpoint connection properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + public static IList List(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// List private endpoint connections + /// + /// + /// List private endpoint connection properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get private endpoint connection + /// + /// + /// Get private endpoint connection properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Get private endpoint connection + /// + /// + /// Get private endpoint connection properties + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + public static PrivateEndpointConnection Update(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties) + { + return operations.UpdateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + public static PrivateEndpointConnection Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.DeleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + public static PrivateEndpointConnection BeginUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties) + { + return operations.BeginUpdateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Update private endpoint connection + /// + /// + /// Update the status of a private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task BeginUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + public static PrivateEndpointConnection BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.BeginDeleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Delete private endpoint connection + /// + /// + /// Delete private endpoint connection with the specified name + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 0000000000000..222d4d1583ef7 --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,451 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourcesOperations(IotHubClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotHubClient + /// + public IotHubClient Client { get; private set; } + + /// + /// List private link resources + /// + /// + /// List private link resources for the given IotHub + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified private link resource + /// + /// + /// Get the specified private link resource for the given IotHub + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private link resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/iotHubs/{resourceName}/privateLinkResources/{groupId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 0000000000000..366f151918bbf --- /dev/null +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,123 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.IotHub +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateLinkResourcesOperations. + /// + public static partial class PrivateLinkResourcesOperationsExtensions + { + /// + /// List private link resources + /// + /// + /// List private link resources for the given IotHub + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + public static PrivateLinkResources List(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// List private link resources + /// + /// + /// List private link resources for the given IotHub + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified private link resource + /// + /// + /// Get the specified private link resource for the given IotHub + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private link resource + /// + public static GroupIdInformation Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, string groupId) + { + return operations.GetAsync(resourceGroupName, resourceName, groupId).GetAwaiter().GetResult(); + } + + /// + /// Get the specified private link resource + /// + /// + /// Get the specified private link resource for the given IotHub + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT hub. + /// + /// + /// The name of the IoT hub. + /// + /// + /// The name of the private link resource + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string resourceName, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs index d7f57f93b58b3..a939003c14f0c 100644 --- a/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs +++ b/sdk/iothub/Microsoft.Azure.Management.IotHub/src/Generated/SdkInfo_iotHubClient.cs @@ -19,24 +19,15 @@ public static IEnumerable> ApiInfo_iotHubClient { return new Tuple[] { - new Tuple("Devices", "Certificates", "2019-07-01-preview"), - new Tuple("Devices", "IotHub", "2019-07-01-preview"), - new Tuple("Devices", "IotHubResource", "2019-07-01-preview"), - new Tuple("Devices", "Operations", "2019-07-01-preview"), - new Tuple("Devices", "ResourceProviderCommon", "2019-07-01-preview"), + new Tuple("Devices", "Certificates", "2020-08-01"), + new Tuple("Devices", "IotHub", "2020-08-01"), + new Tuple("Devices", "IotHubResource", "2020-08-01"), + new Tuple("Devices", "Operations", "2020-08-01"), + new Tuple("Devices", "PrivateEndpointConnections", "2020-08-01"), + new Tuple("Devices", "PrivateLinkResources", "2020-08-01"), + new Tuple("Devices", "ResourceProviderCommon", "2020-08-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/iothub/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "a942bf5703a34a66ca0fb7190bdb6e0c0875e12a"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -