diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperations.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperations.cs index 350b8bee2a8b..8069f6cf91d1 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperations.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperations.cs @@ -277,13 +277,14 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// The name of the certificate create or update. /// - /// - /// The certificate body. - /// /// /// ETag of the certificate. This is required to update an existing /// certificate, and ignored while creating a brand new certificate. /// + /// + /// Base-64 representation of the X509 leaf certificate .cer file or just .pem + /// file content. + /// /// /// Headers that will be added to request. /// @@ -305,7 +306,7 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, string ifMatch = default(string), string certificate = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -327,16 +328,10 @@ internal DpsCertificateOperations(IotDpsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); } - if (certificateName != null) + CertificateBodyDescription certificateDescription = new CertificateBodyDescription(); + if (certificate != null) { - if (certificateName.Length > 256) - { - throw new ValidationException(ValidationRules.MaxLength, "certificateName", 256); - } - } - if (certificateDescription == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateDescription"); + certificateDescription.Certificate = certificate; } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -348,8 +343,8 @@ internal DpsCertificateOperations(IotDpsClient client) tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); 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); } @@ -503,7 +498,7 @@ internal DpsCertificateOperations(IotDpsClient client) /// Delete the Provisioning Service Certificate. /// /// - /// Deletes the specified certificate assosciated with the Provisioning Service + /// Deletes the specified certificate associated with the Provisioning Service /// /// /// Resource group identifier. @@ -763,6 +758,197 @@ internal DpsCertificateOperations(IotDpsClient client) return _result; } + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + /// + /// 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 provisioningServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + 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/provisioningServices/{provisioningServiceName}/certificates").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + 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; + } + /// /// Generate verification code for Proof of Possession. /// @@ -1060,9 +1246,6 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// ETag of the certificate. /// - /// - /// The name of the certificate - /// /// /// Resource group name. /// @@ -1094,6 +1277,10 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// Random number generated to indicate Proof of Possession. /// + /// + /// base-64 representation of X509 certificate .cer file or just .pem file + /// content. + /// /// /// Headers that will be added to request. /// @@ -1115,7 +1302,7 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), string certificate = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (certificateName == null) { @@ -1125,10 +1312,6 @@ internal DpsCertificateOperations(IotDpsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); } - if (request == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "request"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1145,6 +1328,11 @@ internal DpsCertificateOperations(IotDpsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + VerificationCodeRequest request = new VerificationCodeRequest(); + if (certificate != null) + { + request.Certificate = certificate; + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1154,7 +1342,6 @@ internal DpsCertificateOperations(IotDpsClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("certificateName", certificateName); tracingParameters.Add("ifMatch", ifMatch); - tracingParameters.Add("request", request); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("certificatename", certificatename); @@ -1165,6 +1352,7 @@ internal DpsCertificateOperations(IotDpsClient client) tracingParameters.Add("certificatelastUpdated", certificatelastUpdated); tracingParameters.Add("certificatehasPrivateKey", certificatehasPrivateKey); tracingParameters.Add("certificatenonce", certificatenonce); + tracingParameters.Add("request", request); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "VerifyCertificate", tracingParameters); } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperationsExtensions.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperationsExtensions.cs index 9f2d1cfa4b8b..da68b00bbfc8 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperationsExtensions.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificateOperationsExtensions.cs @@ -91,16 +91,17 @@ public static partial class DpsCertificateOperationsExtensions /// /// The name of the certificate create or update. /// - /// - /// The certificate body. - /// /// /// ETag of the certificate. This is required to update an existing /// certificate, and ignored while creating a brand new certificate. /// - public static CertificateResponse CreateOrUpdate(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string)) + /// + /// Base-64 representation of the X509 leaf certificate .cer file or just .pem + /// file content. + /// + public static CertificateResponse CreateOrUpdate(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, string certificateName, string ifMatch = default(string), string certificate = default(string)) { - return operations.CreateOrUpdateAsync(resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificate).GetAwaiter().GetResult(); } /// @@ -121,19 +122,20 @@ public static partial class DpsCertificateOperationsExtensions /// /// The name of the certificate create or update. /// - /// - /// The certificate body. - /// /// /// ETag of the certificate. This is required to update an existing /// certificate, and ignored while creating a brand new certificate. /// + /// + /// Base-64 representation of the X509 leaf certificate .cer file or just .pem + /// file content. + /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, string certificateName, string ifMatch = default(string), string certificate = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificate, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -143,7 +145,7 @@ public static partial class DpsCertificateOperationsExtensions /// Delete the Provisioning Service Certificate. /// /// - /// Deletes the specified certificate assosciated with the Provisioning Service + /// Deletes the specified certificate associated with the Provisioning Service /// /// /// The operations group for this extension method. @@ -195,7 +197,7 @@ public static partial class DpsCertificateOperationsExtensions /// Delete the Provisioning Service Certificate. /// /// - /// Deletes the specified certificate assosciated with the Provisioning Service + /// Deletes the specified certificate associated with the Provisioning Service /// /// /// The operations group for this extension method. @@ -246,6 +248,46 @@ public static partial class DpsCertificateOperationsExtensions (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ifMatch, provisioningServiceName, certificateName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + public static CertificateListDescription List(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName) + { + return operations.ListAsync(resourceGroupName, provisioningServiceName).GetAwaiter().GetResult(); + } + + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + /// + /// The cancellation token. + /// + public static async Task ListAsync(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Generate verification code for Proof of Possession. /// @@ -369,9 +411,6 @@ public static partial class DpsCertificateOperationsExtensions /// /// ETag of the certificate. /// - /// - /// The name of the certificate - /// /// /// Resource group name. /// @@ -403,9 +442,13 @@ public static partial class DpsCertificateOperationsExtensions /// /// Random number generated to indicate Proof of Possession. /// - public static CertificateResponse VerifyCertificate(this IDpsCertificateOperations operations, string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string)) + /// + /// base-64 representation of X509 certificate .cer file or just .pem file + /// content. + /// + public static CertificateResponse VerifyCertificate(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), string certificate = default(string)) { - return operations.VerifyCertificateAsync(certificateName, ifMatch, request, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).GetAwaiter().GetResult(); + return operations.VerifyCertificateAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, certificate).GetAwaiter().GetResult(); } /// @@ -425,9 +468,6 @@ public static partial class DpsCertificateOperationsExtensions /// /// ETag of the certificate. /// - /// - /// The name of the certificate - /// /// /// Resource group name. /// @@ -459,12 +499,16 @@ public static partial class DpsCertificateOperationsExtensions /// /// Random number generated to indicate Proof of Possession. /// + /// + /// base-64 representation of X509 certificate .cer file or just .pem file + /// content. + /// /// /// The cancellation token. /// - public static async Task VerifyCertificateAsync(this IDpsCertificateOperations operations, string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task VerifyCertificateAsync(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), string certificate = default(string), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.VerifyCertificateWithHttpMessagesAsync(certificateName, ifMatch, request, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.VerifyCertificateWithHttpMessagesAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, certificate, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificatesOperations.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificatesOperations.cs deleted file mode 100644 index f7c906bfd248..000000000000 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificatesOperations.cs +++ /dev/null @@ -1,245 +0,0 @@ -// -// 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.DeviceProvisioningServices -{ - 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; - - /// - /// DpsCertificatesOperations operations. - /// - internal partial class DpsCertificatesOperations : IServiceOperations, IDpsCertificatesOperations - { - /// - /// Initializes a new instance of the DpsCertificatesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal DpsCertificatesOperations(IotDpsClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the IotDpsClient - /// - public IotDpsClient Client { get; private set; } - - /// - /// Get all the certificates tied to the provisioning service. - /// - /// - /// Name of resource group. - /// - /// - /// Name of provisioning service to retrieve certificates for. - /// - /// - /// 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 provisioningServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (provisioningServiceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); - } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("provisioningServiceName", provisioningServiceName); - 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/provisioningServices/{provisioningServiceName}/certificates").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); - 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/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificatesOperationsExtensions.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificatesOperationsExtensions.cs deleted file mode 100644 index 60f5aaa3abeb..000000000000 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/DpsCertificatesOperationsExtensions.cs +++ /dev/null @@ -1,65 +0,0 @@ -// -// 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.DeviceProvisioningServices -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DpsCertificatesOperations. - /// - public static partial class DpsCertificatesOperationsExtensions - { - /// - /// Get all the certificates tied to the provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of resource group. - /// - /// - /// Name of provisioning service to retrieve certificates for. - /// - public static CertificateListDescription List(this IDpsCertificatesOperations operations, string resourceGroupName, string provisioningServiceName) - { - return operations.ListAsync(resourceGroupName, provisioningServiceName).GetAwaiter().GetResult(); - } - - /// - /// Get all the certificates tied to the provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of resource group. - /// - /// - /// Name of provisioning service to retrieve certificates for. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IDpsCertificatesOperations operations, string resourceGroupName, string provisioningServiceName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IDpsCertificateOperations.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IDpsCertificateOperations.cs index 1fa168aa1853..9ec14ce8004f 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IDpsCertificateOperations.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IDpsCertificateOperations.cs @@ -70,13 +70,14 @@ public partial interface IDpsCertificateOperations /// /// The name of the certificate create or update. /// - /// - /// The certificate body. - /// /// /// ETag of the certificate. This is required to update an existing /// certificate, and ignored while creating a brand new certificate. /// + /// + /// Base-64 representation of the X509 leaf certificate .cer file or + /// just .pem file content. + /// /// /// The headers that will be added to request. /// @@ -92,12 +93,12 @@ public partial interface IDpsCertificateOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, string ifMatch = default(string), string certificate = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the Provisioning Service Certificate. /// /// - /// Deletes the specified certificate assosciated with the Provisioning + /// Deletes the specified certificate associated with the Provisioning /// Service /// /// @@ -154,6 +155,31 @@ public partial interface IDpsCertificateOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// Name of provisioning service to retrieve certificates for. + /// + /// + /// 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 provisioningServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Generate verification code for Proof of Possession. /// /// @@ -226,9 +252,6 @@ public partial interface IDpsCertificateOperations /// /// ETag of the certificate. /// - /// - /// The name of the certificate - /// /// /// Resource group name. /// @@ -261,6 +284,10 @@ public partial interface IDpsCertificateOperations /// /// Random number generated to indicate Proof of Possession. /// + /// + /// base-64 representation of X509 certificate .cer file or just .pem + /// file content. + /// /// /// The headers that will be added to request. /// @@ -276,6 +303,6 @@ public partial interface IDpsCertificateOperations /// /// Thrown when a required parameter is null /// - Task> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, VerificationCodeRequest request, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificatename = default(string), byte[] certificaterawBytes = default(byte[]), bool? certificateisVerified = default(bool?), string certificatepurpose = default(string), System.DateTime? certificatecreated = default(System.DateTime?), System.DateTime? certificatelastUpdated = default(System.DateTime?), bool? certificatehasPrivateKey = default(bool?), string certificatenonce = default(string), string certificate = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IDpsCertificatesOperations.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IDpsCertificatesOperations.cs deleted file mode 100644 index 4a08b9116496..000000000000 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IDpsCertificatesOperations.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// 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.DeviceProvisioningServices -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DpsCertificatesOperations operations. - /// - public partial interface IDpsCertificatesOperations - { - /// - /// Get all the certificates tied to the provisioning service. - /// - /// - /// Name of resource group. - /// - /// - /// Name of provisioning service to retrieve certificates for. - /// - /// - /// 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 provisioningServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsClient.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsClient.cs index 90bb04df9dd4..c8d8617c8462 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsClient.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsClient.cs @@ -51,19 +51,20 @@ public partial interface IIotDpsClient : System.IDisposable string ApiVersion { get; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated - /// and included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When + /// set to true a unique x-ms-client-request-id value is generated and + /// included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } @@ -83,10 +84,5 @@ public partial interface IIotDpsClient : System.IDisposable /// IIotDpsResourceOperations IotDpsResource { get; } - /// - /// Gets the IDpsCertificatesOperations. - /// - IDpsCertificatesOperations DpsCertificates { get; } - } } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsResourceOperations.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsResourceOperations.cs index 38dd659835f4..90576f52d554 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsResourceOperations.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IIotDpsResourceOperations.cs @@ -99,9 +99,8 @@ public partial interface IIotDpsResourceOperations /// /// Name of provisioning service to create or update. /// - /// - /// Updated tag information to set into the provisioning service - /// instance. + /// + /// Resource tags /// /// /// The headers that will be added to request. @@ -118,7 +117,7 @@ public partial interface IIotDpsResourceOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the Provisioning Service /// @@ -259,9 +258,8 @@ public partial interface IIotDpsResourceOperations /// validate if the name is syntactically valid and if the name is /// usable /// - /// - /// Set the name parameter in the OperationInputs structure to the name - /// of the provisioning service to check. + /// + /// The name of the Provisioning Service to check. /// /// /// The headers that will be added to request. @@ -278,7 +276,7 @@ public partial interface IIotDpsResourceOperations /// /// Thrown when a required parameter is null /// - Task> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(OperationInputs arguments, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the security metadata for a provisioning service. /// @@ -340,6 +338,197 @@ public partial interface IIotDpsResourceOperations /// Task> ListKeysForKeyNameWithHttpMessagesAsync(string provisioningServiceName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// List private link resources + /// + /// + /// List private link resources for the given provisioning service + /// + /// + /// The name of the resource group that contains the provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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> ListPrivateLinkResourcesWithHttpMessagesAsync(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 provisioning + /// service + /// + /// + /// The name of the resource group that contains the provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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> GetPrivateLinkResourcesWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List private endpoint connections + /// + /// + /// List private endpoint connection properties + /// + /// + /// The name of the resource group that contains the provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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>> ListPrivateEndpointConnectionsWithHttpMessagesAsync(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 provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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> GetPrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Create or update private endpoint connection + /// + /// + /// Create or update the status of a private endpoint connection with + /// the specified name + /// + /// + /// The name of the resource group that contains the provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a 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> CreateOrUpdatePrivateEndpointConnectionWithHttpMessagesAsync(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 provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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> DeletePrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Create or update the metadata of the provisioning service. /// /// @@ -387,9 +576,8 @@ public partial interface IIotDpsResourceOperations /// /// Name of provisioning service to create or update. /// - /// - /// Updated tag information to set into the provisioning service - /// instance. + /// + /// Resource tags /// /// /// The headers that will be added to request. @@ -406,7 +594,7 @@ public partial interface IIotDpsResourceOperations /// /// Thrown when a required parameter is null /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete the Provisioning Service /// @@ -433,6 +621,74 @@ public partial interface IIotDpsResourceOperations /// Task BeginDeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Create or update private endpoint connection + /// + /// + /// Create or update the status of a private endpoint connection with + /// the specified name + /// + /// + /// The name of the resource group that contains the provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a 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> BeginCreateOrUpdatePrivateEndpointConnectionWithHttpMessagesAsync(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 provisioning + /// service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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> BeginDeletePrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Get all the provisioning services in a subscription. /// /// diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsClient.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsClient.cs index 1077c59836fa..2aa2aad93789 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsClient.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsClient.cs @@ -57,19 +57,20 @@ public partial class IotDpsClient : ServiceClient, IIotDpsClient, public string ApiVersion { get; private set; } /// - /// Gets or sets the preferred language for the response. + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is generated and - /// included in each request. Default is true. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } @@ -89,9 +90,17 @@ public partial class IotDpsClient : ServiceClient, IIotDpsClient, public virtual IIotDpsResourceOperations IotDpsResource { get; private set; } /// - /// Gets the IDpsCertificatesOperations. + /// Initializes a new instance of the IotDpsClient class. /// - public virtual IDpsCertificatesOperations DpsCertificates { get; private set; } + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling IotDpsClient.Dispose(). False: will not dispose provided httpClient + protected IotDpsClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } /// /// Initializes a new instance of the IotDpsClient class. @@ -188,6 +197,33 @@ public IotDpsClient(ServiceClientCredentials credentials, params DelegatingHandl } } + /// + /// Initializes a new instance of the IotDpsClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling IotDpsClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public IotDpsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); + } + } + /// /// Initializes a new instance of the IotDpsClient class. /// @@ -297,9 +333,8 @@ private void Initialize() Operations = new Operations(this); DpsCertificate = new DpsCertificateOperations(this); IotDpsResource = new IotDpsResourceOperations(this); - DpsCertificates = new DpsCertificatesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-11-15"; + ApiVersion = "2020-03-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperations.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperations.cs index 48a881ae3c80..ac8af71fd267 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperations.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperations.cs @@ -288,8 +288,8 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// Name of provisioning service to create or update. /// - /// - /// Updated tag information to set into the provisioning service instance. + /// + /// Resource tags /// /// /// The headers that will be added to request. @@ -297,10 +297,10 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -1103,9 +1103,8 @@ internal IotDpsResourceOperations(IotDpsClient client) /// Check if a provisioning service name is available. This will validate if /// the name is syntactically valid and if the name is usable /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the - /// provisioning service to check. + /// + /// The name of the Provisioning Service to check. /// /// /// Headers that will be added to request. @@ -1128,23 +1127,24 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(OperationInputs arguments, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (arguments == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "arguments"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (arguments != null) + if (name == null) { - arguments.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "name"); } - if (Client.ApiVersion == null) + OperationInputs arguments = new OperationInputs(); + if (name != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + arguments.Name = name; } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1690,22 +1690,16 @@ internal IotDpsResourceOperations(IotDpsClient client) } /// - /// Create or update the metadata of the provisioning service. + /// List private link resources /// /// - /// Create or update the metadata of the provisioning service. The usual - /// pattern to modify a property is to retrieve the provisioning service - /// metadata and security metadata, and then combine them with the modified - /// values in a new body to update the provisioning service. + /// List private link resources for the given provisioning service /// /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. + /// The name of the resource group that contains the provisioning service. /// - /// - /// Description of the provisioning service to create or update. + /// + /// The name of the provisioning service. /// /// /// Headers that will be added to request. @@ -1728,8 +1722,12 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> ListPrivateLinkResourcesWithHttpMessagesAsync(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"); @@ -1738,21 +1736,9 @@ internal IotDpsResourceOperations(IotDpsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (provisioningServiceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); - } - if (iotDpsDescription == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "iotDpsDescription"); - } - if (iotDpsDescription != null) - { - iotDpsDescription.Validate(); - } - if (Client.ApiVersion == null) + if (resourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1762,17 +1748,16 @@ internal IotDpsResourceOperations(IotDpsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("provisioningServiceName", provisioningServiceName); - tracingParameters.Add("iotDpsDescription", iotDpsDescription); + tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListPrivateLinkResources", 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/provisioningServices/{provisioningServiceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -1785,7 +1770,7 @@ internal IotDpsResourceOperations(IotDpsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -1816,12 +1801,6 @@ internal IotDpsResourceOperations(IotDpsClient client) // Serialize Request string _requestContent = null; - if(iotDpsDescription != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotDpsDescription, 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) { @@ -1842,7 +1821,7 @@ internal IotDpsResourceOperations(IotDpsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) + if ((int)_statusCode != 200) { var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1872,7 +1851,7 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1885,25 +1864,7 @@ internal IotDpsResourceOperations(IotDpsClient client) _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); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1923,20 +1884,19 @@ internal IotDpsResourceOperations(IotDpsClient client) } /// - /// Update an existing provisioning service's tags. + /// Get the specified private link resource /// /// - /// Update an existing provisioning service's tags. to update other fields use - /// the CreateOrUpdate method + /// Get the specified private link resource for the given provisioning service /// /// - /// Resource group identifier. + /// The name of the resource group that contains the provisioning service. /// - /// - /// Name of provisioning service to create or update. + /// + /// The name of the provisioning service. /// - /// - /// Updated tag information to set into the provisioning service instance. + /// + /// The name of the private link resource /// /// /// Headers that will be added to request. @@ -1944,7 +1904,7 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1959,8 +1919,12 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetPrivateLinkResourcesWithHttpMessagesAsync(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"); @@ -1969,17 +1933,13 @@ internal IotDpsResourceOperations(IotDpsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (provisioningServiceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); - } - if (provisioningServiceTags == null) + if (resourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceTags"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } - if (Client.ApiVersion == null) + if (groupId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -1989,17 +1949,18 @@ internal IotDpsResourceOperations(IotDpsClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("provisioningServiceName", provisioningServiceName); - tracingParameters.Add("provisioningServiceTags", provisioningServiceTags); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("groupId", groupId); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetPrivateLinkResources", 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/provisioningServices/{provisioningServiceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -2012,7 +1973,7 @@ internal IotDpsResourceOperations(IotDpsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2043,12 +2004,6 @@ internal IotDpsResourceOperations(IotDpsClient client) // Serialize Request string _requestContent = null; - if(provisioningServiceTags != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(provisioningServiceTags, 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) { @@ -2071,14 +2026,13 @@ internal IotDpsResourceOperations(IotDpsClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorDetails _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2088,10 +2042,6 @@ internal IotDpsResourceOperations(IotDpsClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2104,7 +2054,7 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -2117,7 +2067,7 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -2137,16 +2087,16 @@ internal IotDpsResourceOperations(IotDpsClient client) } /// - /// Delete the Provisioning Service + /// List private endpoint connections /// /// - /// Deletes the Provisioning Service. + /// List private endpoint connection properties /// - /// - /// Name of provisioning service to delete. - /// /// - /// Resource group identifier. + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The name of the provisioning service. /// /// /// Headers that will be added to request. @@ -2157,6 +2107,9 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// Thrown when the operation returned an invalid status code /// + /// + /// Thrown when unable to deserialize the response + /// /// /// Thrown when a required parameter is null /// @@ -2166,11 +2119,11 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListPrivateEndpointConnectionsWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (provisioningServiceName == null) + if (Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } if (Client.SubscriptionId == null) { @@ -2180,9 +2133,9 @@ internal IotDpsResourceOperations(IotDpsClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + if (resourceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -2191,17 +2144,17 @@ internal IotDpsResourceOperations(IotDpsClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListPrivateEndpointConnections", 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/provisioningServices/{provisioningServiceName}").ToString(); - _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{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) { @@ -2214,7 +2167,7 @@ internal IotDpsResourceOperations(IotDpsClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.Method = new HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -2265,7 +2218,7 @@ internal IotDpsResourceOperations(IotDpsClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204 && (int)_statusCode != 404) + if ((int)_statusCode != 200) { var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -2295,13 +2248,1373 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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> GetPrivateEndpointConnectionWithHttpMessagesAsync(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, "GetPrivateEndpointConnection", 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/provisioningServices/{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; + } + + /// + /// Create or update private endpoint connection + /// + /// + /// Create or update the status of a private endpoint connection with the + /// specified name + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a private endpoint connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdatePrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdatePrivateEndpointConnectionWithHttpMessagesAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeletePrivateEndpointConnectionWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeletePrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Create or update the metadata of the provisioning service. + /// + /// + /// Create or update the metadata of the provisioning service. The usual + /// pattern to modify a property is to retrieve the provisioning service + /// metadata and security metadata, and then combine them with the modified + /// values in a new body to update the provisioning service. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Description of the provisioning service to create or update. + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (iotDpsDescription == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "iotDpsDescription"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("iotDpsDescription", iotDpsDescription); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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/provisioningServices/{provisioningServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + 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(iotDpsDescription != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(iotDpsDescription, 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; + } + + /// + /// Update an existing provisioning service's tags. + /// + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// Resource tags + /// + /// + /// 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 provisioningServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + TagsResource provisioningServiceTags = new TagsResource(); + if (tags != null) + { + provisioningServiceTags.Tags = tags; + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("provisioningServiceTags", provisioningServiceTags); + 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/provisioningServices/{provisioningServiceName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + 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("PATCH"); + _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(provisioningServiceTags != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(provisioningServiceTags, 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) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + 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; + } + + /// + /// Delete the Provisioning Service + /// + /// + /// Deletes the Provisioning Service. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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 provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (provisioningServiceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("resourceGroupName", resourceGroupName); + 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/provisioningServices/{provisioningServiceName}").ToString(); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + 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 && (int)_statusCode != 404) + { + 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(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Create or update private endpoint connection + /// + /// + /// Create or update the status of a private endpoint connection with the + /// specified name + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a 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> BeginCreateOrUpdatePrivateEndpointConnectionWithHttpMessagesAsync(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"); + } + 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, "BeginCreateOrUpdatePrivateEndpointConnection", 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/provisioningServices/{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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// 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> BeginDeletePrivateEndpointConnectionWithHttpMessagesAsync(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, "BeginDeletePrivateEndpointConnection", 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/provisioningServices/{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); diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperationsExtensions.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperationsExtensions.cs index 76ff87ac2416..7dede66d5329 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperationsExtensions.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/IotDpsResourceOperationsExtensions.cs @@ -13,6 +13,8 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -141,12 +143,12 @@ public static ProvisioningServiceDescription CreateOrUpdate(this IIotDpsResource /// /// Name of provisioning service to create or update. /// - /// - /// Updated tag information to set into the provisioning service instance. + /// + /// Resource tags /// - public static ProvisioningServiceDescription Update(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags) + public static ProvisioningServiceDescription Update(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary)) { - return operations.UpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, provisioningServiceName, tags).GetAwaiter().GetResult(); } /// @@ -165,15 +167,15 @@ public static ProvisioningServiceDescription Update(this IIotDpsResourceOperatio /// /// Name of provisioning service to create or update. /// - /// - /// Updated tag information to set into the provisioning service instance. + /// + /// Resource tags /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, tags, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -404,13 +406,12 @@ public static IPage ListValidSkus(this IIotDpsResourceOpera /// /// The operations group for this extension method. /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the - /// provisioning service to check. + /// + /// The name of the Provisioning Service to check. /// - public static NameAvailabilityInfo CheckProvisioningServiceNameAvailability(this IIotDpsResourceOperations operations, OperationInputs arguments) + public static NameAvailabilityInfo CheckProvisioningServiceNameAvailability(this IIotDpsResourceOperations operations, string name) { - return operations.CheckProvisioningServiceNameAvailabilityAsync(arguments).GetAwaiter().GetResult(); + return operations.CheckProvisioningServiceNameAvailabilityAsync(name).GetAwaiter().GetResult(); } /// @@ -423,16 +424,15 @@ public static NameAvailabilityInfo CheckProvisioningServiceNameAvailability(this /// /// The operations group for this extension method. /// - /// - /// Set the name parameter in the OperationInputs structure to the name of the - /// provisioning service to check. + /// + /// The name of the Provisioning Service to check. /// /// /// The cancellation token. /// - public static async Task CheckProvisioningServiceNameAvailabilityAsync(this IIotDpsResourceOperations operations, OperationInputs arguments, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CheckProvisioningServiceNameAvailabilityAsync(this IIotDpsResourceOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(arguments, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -536,6 +536,314 @@ public static SharedAccessSignatureAuthorizationRuleAccessRightsDescription List } } + /// + /// List private link resources + /// + /// + /// List private link resources for the given provisioning service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The name of the provisioning service. + /// + public static PrivateLinkResources ListPrivateLinkResources(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListPrivateLinkResourcesAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// List private link resources + /// + /// + /// List private link resources for the given provisioning service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The cancellation token. + /// + public static async Task ListPrivateLinkResourcesAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPrivateLinkResourcesWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified private link resource + /// + /// + /// Get the specified private link resource for the given provisioning service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private link resource + /// + public static GroupIdInformation GetPrivateLinkResources(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string groupId) + { + return operations.GetPrivateLinkResourcesAsync(resourceGroupName, resourceName, groupId).GetAwaiter().GetResult(); + } + + /// + /// Get the specified private link resource + /// + /// + /// Get the specified private link resource for the given provisioning service + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private link resource + /// + /// + /// The cancellation token. + /// + public static async Task GetPrivateLinkResourcesAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPrivateLinkResourcesWithHttpMessagesAsync(resourceGroupName, resourceName, groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// 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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + public static IList ListPrivateEndpointConnections(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListPrivateEndpointConnectionsAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The cancellation token. + /// + public static async Task> ListPrivateEndpointConnectionsAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListPrivateEndpointConnectionsWithHttpMessagesAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + public static PrivateEndpointConnection GetPrivateEndpointConnection(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.GetPrivateEndpointConnectionAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task GetPrivateEndpointConnectionAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetPrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Create or update private endpoint connection + /// + /// + /// Create or 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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a private endpoint connection + /// + public static PrivateEndpointConnection CreateOrUpdatePrivateEndpointConnection(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties) + { + return operations.CreateOrUpdatePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Create or update private endpoint connection + /// + /// + /// Create or 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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdatePrivateEndpointConnectionAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdatePrivateEndpointConnectionWithHttpMessagesAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + public static PrivateEndpointConnection DeletePrivateEndpointConnection(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.DeletePrivateEndpointConnectionAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task DeletePrivateEndpointConnectionAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeletePrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Create or update the metadata of the provisioning service. /// @@ -610,12 +918,12 @@ public static ProvisioningServiceDescription BeginCreateOrUpdate(this IIotDpsRes /// /// Name of provisioning service to create or update. /// - /// - /// Updated tag information to set into the provisioning service instance. + /// + /// Resource tags /// - public static ProvisioningServiceDescription BeginUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags) + public static ProvisioningServiceDescription BeginUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary)) { - return operations.BeginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).GetAwaiter().GetResult(); + return operations.BeginUpdateAsync(resourceGroupName, provisioningServiceName, tags).GetAwaiter().GetResult(); } /// @@ -634,15 +942,15 @@ public static ProvisioningServiceDescription BeginUpdate(this IIotDpsResourceOpe /// /// Name of provisioning service to create or update. /// - /// - /// Updated tag information to set into the provisioning service instance. + /// + /// Resource tags /// /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, tags, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -691,6 +999,118 @@ public static void BeginDelete(this IIotDpsResourceOperations operations, string (await operations.BeginDeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } + /// + /// Create or update private endpoint connection + /// + /// + /// Create or 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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a private endpoint connection + /// + public static PrivateEndpointConnection BeginCreateOrUpdatePrivateEndpointConnection(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties) + { + return operations.BeginCreateOrUpdatePrivateEndpointConnectionAsync(resourceGroupName, resourceName, privateEndpointConnectionName, properties).GetAwaiter().GetResult(); + } + + /// + /// Create or update private endpoint connection + /// + /// + /// Create or 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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The properties of a private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdatePrivateEndpointConnectionAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnectionProperties properties, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdatePrivateEndpointConnectionWithHttpMessagesAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + public static PrivateEndpointConnection BeginDeletePrivateEndpointConnection(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.BeginDeletePrivateEndpointConnectionAsync(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 provisioning service. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the private endpoint connection + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeletePrivateEndpointConnectionAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeletePrivateEndpointConnectionWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Get all the provisioning services in a subscription. /// diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/CertificateProperties.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/CertificateProperties.cs index 7d007bb8dbe1..088aa5010cf6 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/CertificateProperties.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/CertificateProperties.cs @@ -37,16 +37,19 @@ public CertificateProperties() /// The certificate's thumbprint. /// Determines whether certificate has been /// verified. + /// base-64 representation of X509 + /// certificate .cer file or just .pem file content. /// The certificate's creation date and /// time. /// The certificate's last update date and /// time. - public CertificateProperties(string subject = default(string), System.DateTime? expiry = default(System.DateTime?), string thumbprint = default(string), bool? isVerified = default(bool?), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?)) + public CertificateProperties(string subject = default(string), System.DateTime? expiry = default(System.DateTime?), string thumbprint = default(string), bool? isVerified = default(bool?), byte[] certificate = default(byte[]), System.DateTime? created = default(System.DateTime?), System.DateTime? updated = default(System.DateTime?)) { Subject = subject; Expiry = expiry; Thumbprint = thumbprint; IsVerified = isVerified; + Certificate = certificate; Created = created; Updated = updated; CustomInit(); @@ -82,6 +85,13 @@ public CertificateProperties() [JsonProperty(PropertyName = "isVerified")] public bool? IsVerified { get; private set; } + /// + /// Gets base-64 representation of X509 certificate .cer file or just + /// .pem file content. + /// + [JsonProperty(PropertyName = "certificate")] + public byte[] Certificate { get; private set; } + /// /// Gets the certificate's creation date and time. /// diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ErrorDetails.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ErrorDetails.cs index 80bf511666df..0568f50d8561 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ErrorDetails.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ErrorDetails.cs @@ -50,25 +50,25 @@ public ErrorDetails() /// /// Gets the error code. /// - [JsonProperty(PropertyName = "Code")] + [JsonProperty(PropertyName = "code")] public string Code { get; private set; } /// /// Gets the HTTP status code. /// - [JsonProperty(PropertyName = "HttpStatusCode")] + [JsonProperty(PropertyName = "httpStatusCode")] public string HttpStatusCode { get; private set; } /// /// Gets the error message. /// - [JsonProperty(PropertyName = "Message")] + [JsonProperty(PropertyName = "message")] public string Message { get; private set; } /// /// Gets the error details. /// - [JsonProperty(PropertyName = "Details")] + [JsonProperty(PropertyName = "details")] public string Details { get; private set; } } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/GroupIdInformation.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/GroupIdInformation.cs new file mode 100644 index 000000000000..f2327ec5fdf2 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/GroupIdInformation.cs @@ -0,0 +1,77 @@ +// +// 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.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The group information for creating a private endpoint on a provisioning + /// service + /// + public partial class GroupIdInformation + { + /// + /// Initializes a new instance of the GroupIdInformation class. + /// + public GroupIdInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GroupIdInformation class. + /// + /// The properties for a group information + /// object + /// 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; } + + /// + /// Gets or sets the properties for a group information object + /// + [JsonProperty(PropertyName = "properties")] + public GroupIdInformationProperties Properties { get; set; } + + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/GroupIdInformationProperties.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/GroupIdInformationProperties.cs new file mode 100644 index 000000000000..3888de1065be --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/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.DeviceProvisioningServices.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/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsPropertiesDescription.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsPropertiesDescription.cs index dee983613f06..7bed355c1392 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsPropertiesDescription.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsPropertiesDescription.cs @@ -16,7 +16,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models using System.Linq; /// - /// the service specific properties of a provisoning service, including + /// the service specific properties of a provisioning service, including /// keys, linked iot hubs, current state, and system generated properties /// such as hostname and idScope /// @@ -40,9 +40,15 @@ public IotDpsPropertiesDescription() /// 'Deleted', 'ActivationFailed', 'DeletionFailed', 'Transitioning', /// 'Suspending', 'Suspended', 'Resuming', 'FailingOver', /// 'FailoverFailed' + /// Whether requests from Public + /// Network are allowed. Possible values include: 'Enabled', + /// 'Disabled' + /// The IP filter rules. + /// Private endpoint + /// connections created on this IotHub /// The ARM provisioning state of the /// provisioning service. - /// List of IoT hubs assosciated with this + /// List of IoT hubs associated with this /// provisioning service. /// Allocation policy to be used by this /// provisioning service. Possible values include: 'Hashed', @@ -55,9 +61,12 @@ public IotDpsPropertiesDescription() /// service. /// List of authorization keys for /// a provisioning service. - public IotDpsPropertiesDescription(string state = default(string), string provisioningState = default(string), IList iotHubs = default(IList), string allocationPolicy = default(string), string serviceOperationsHostName = default(string), string deviceProvisioningHostName = default(string), string idScope = default(string), IList authorizationPolicies = default(IList)) + public IotDpsPropertiesDescription(string state = default(string), string publicNetworkAccess = default(string), IList ipFilterRules = default(IList), IList privateEndpointConnections = default(IList), string provisioningState = default(string), IList iotHubs = default(IList), string allocationPolicy = default(string), string serviceOperationsHostName = default(string), string deviceProvisioningHostName = default(string), string idScope = default(string), IList authorizationPolicies = default(IList)) { State = state; + PublicNetworkAccess = publicNetworkAccess; + IpFilterRules = ipFilterRules; + PrivateEndpointConnections = privateEndpointConnections; ProvisioningState = provisioningState; IotHubs = iotHubs; AllocationPolicy = allocationPolicy; @@ -83,6 +92,25 @@ public IotDpsPropertiesDescription() [JsonProperty(PropertyName = "state")] public string State { 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 private endpoint connections created on this IotHub + /// + [JsonProperty(PropertyName = "privateEndpointConnections")] + public IList PrivateEndpointConnections { get; set; } + /// /// Gets or sets the ARM provisioning state of the provisioning /// service. @@ -91,7 +119,7 @@ public IotDpsPropertiesDescription() public string ProvisioningState { get; set; } /// - /// Gets or sets list of IoT hubs assosciated with this provisioning + /// Gets or sets list of IoT hubs associated with this provisioning /// service. /// [JsonProperty(PropertyName = "iotHubs")] diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuDefinition.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuDefinition.cs index 9cd9ba2244d4..299b122eaf11 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuDefinition.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuDefinition.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models using System.Linq; /// - /// Available Sku's of tier and units. + /// Available SKUs of tier and units. /// public partial class IotDpsSkuDefinition { diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuInfo.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuInfo.cs index 6b0738f5cda6..2298cbd19cd5 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuInfo.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotDpsSkuInfo.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models using System.Linq; /// - /// List of possible provisoning service SKUs. + /// List of possible provisioning service SKUs. /// public partial class IotDpsSkuInfo { diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotHubDefinitionDescription.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotHubDefinitionDescription.cs index 087abaae8f2d..d328c788ab5d 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotHubDefinitionDescription.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IotHubDefinitionDescription.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -32,7 +31,7 @@ public IotHubDefinitionDescription() /// Initializes a new instance of the IotHubDefinitionDescription /// class. /// - /// Connection string og the IoT + /// Connection string of the IoT /// hub. /// ARM region of the IoT hub. /// flag for applying @@ -75,7 +74,7 @@ public IotHubDefinitionDescription() public string Name { get; private set; } /// - /// Gets or sets connection string og the IoT hub. + /// Gets or sets connection string of the IoT hub. /// [JsonProperty(PropertyName = "connectionString")] public string ConnectionString { get; set; } @@ -86,22 +85,5 @@ public IotHubDefinitionDescription() [JsonProperty(PropertyName = "location")] public string Location { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ConnectionString == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); - } - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - } } } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterActionType.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterActionType.cs new file mode 100644 index 000000000000..0f5c4363b261 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterActionType.cs @@ -0,0 +1,60 @@ +// +// 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.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for IpFilterActionType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IpFilterActionType + { + [EnumMember(Value = "Accept")] + Accept, + [EnumMember(Value = "Reject")] + Reject + } + internal static class IpFilterActionTypeEnumExtension + { + internal static string ToSerializedValue(this IpFilterActionType? value) + { + return value == null ? null : ((IpFilterActionType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this IpFilterActionType value) + { + switch( value ) + { + case IpFilterActionType.Accept: + return "Accept"; + case IpFilterActionType.Reject: + return "Reject"; + } + return null; + } + + internal static IpFilterActionType? ParseIpFilterActionType(this string value) + { + switch( value ) + { + case "Accept": + return IpFilterActionType.Accept; + case "Reject": + return IpFilterActionType.Reject; + } + return null; + } + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterRule.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterRule.cs new file mode 100644 index 000000000000..6e220800031c --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterRule.cs @@ -0,0 +1,81 @@ +// +// 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.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The IP filter rules for a provisioning Service. + /// + public partial class IpFilterRule + { + /// + /// Initializes a new instance of the IpFilterRule class. + /// + public IpFilterRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the IpFilterRule class. + /// + /// The name of the IP filter rule. + /// The desired action for requests captured by + /// this rule. Possible values include: 'Accept', 'Reject' + /// A string that contains the IP address range in + /// CIDR notation for the rule. + /// Target for requests captured by this rule. + /// Possible values include: 'all', 'serviceApi', 'deviceApi' + public IpFilterRule(string filterName, IpFilterActionType action, string ipMask, IpFilterTargetType? target = default(IpFilterTargetType?)) + { + FilterName = filterName; + Action = action; + IpMask = ipMask; + Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the IP filter rule. + /// + [JsonProperty(PropertyName = "filterName")] + public string FilterName { get; set; } + + /// + /// Gets or sets the desired action for requests captured by this rule. + /// Possible values include: 'Accept', 'Reject' + /// + [JsonProperty(PropertyName = "action")] + public IpFilterActionType Action { get; set; } + + /// + /// Gets or sets a string that contains the IP address range in CIDR + /// notation for the rule. + /// + [JsonProperty(PropertyName = "ipMask")] + public string IpMask { get; set; } + + /// + /// Gets or sets target for requests captured by this rule. Possible + /// values include: 'all', 'serviceApi', 'deviceApi' + /// + [JsonProperty(PropertyName = "target")] + public IpFilterTargetType? Target { get; set; } + + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterTargetType.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterTargetType.cs new file mode 100644 index 000000000000..83c1487d8f58 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/IpFilterTargetType.cs @@ -0,0 +1,66 @@ +// +// 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.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; + + /// + /// Defines values for IpFilterTargetType. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum IpFilterTargetType + { + [EnumMember(Value = "all")] + All, + [EnumMember(Value = "serviceApi")] + ServiceApi, + [EnumMember(Value = "deviceApi")] + DeviceApi + } + internal static class IpFilterTargetTypeEnumExtension + { + internal static string ToSerializedValue(this IpFilterTargetType? value) + { + return value == null ? null : ((IpFilterTargetType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this IpFilterTargetType value) + { + switch( value ) + { + case IpFilterTargetType.All: + return "all"; + case IpFilterTargetType.ServiceApi: + return "serviceApi"; + case IpFilterTargetType.DeviceApi: + return "deviceApi"; + } + return null; + } + + internal static IpFilterTargetType? ParseIpFilterTargetType(this string value) + { + switch( value ) + { + case "all": + return IpFilterTargetType.All; + case "serviceApi": + return IpFilterTargetType.ServiceApi; + case "deviceApi": + return IpFilterTargetType.DeviceApi; + } + return null; + } + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/NameAvailabilityInfo.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/NameAvailabilityInfo.cs index 12125656a6c0..51623c28e5b0 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/NameAvailabilityInfo.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/NameAvailabilityInfo.cs @@ -33,7 +33,7 @@ public NameAvailabilityInfo() /// not /// specifies the reason a name is unavailable. /// Possible values include: 'Invalid', 'AlreadyExists' - /// message containing a etailed reason name is + /// message containing a detailed reason name is /// unavailable public NameAvailabilityInfo(bool? nameAvailable = default(bool?), string reason = default(string), string message = default(string)) { @@ -62,7 +62,7 @@ public NameAvailabilityInfo() public string Reason { get; set; } /// - /// Gets or sets message containing a etailed reason name is + /// Gets or sets message containing a detailed reason name is /// unavailable /// [JsonProperty(PropertyName = "message")] diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Operation.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Operation.cs index 6af1781fa9d6..55bee1d88311 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Operation.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Operation.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models using System.Linq; /// - /// IoT Hub REST API operation. + /// Provisioning Service REST API operation. /// public partial class Operation { diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/OperationInputs.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/OperationInputs.cs index 49e6b4c2b24c..42e998850135 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/OperationInputs.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/OperationInputs.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -49,18 +48,5 @@ public OperationInputs(string name) [JsonProperty(PropertyName = "name")] public string Name { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } } } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpoint.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..9c58ab9ec9d4 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/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.DeviceProvisioningServices.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/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..c4613dc66ec1 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,78 @@ +// +// 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.DeviceProvisioningServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The private endpoint connection of a provisioning service + /// + 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 properties of a private endpoint + /// connection + /// 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; } + + /// + /// Gets or sets the properties of a private endpoint connection + /// + [JsonProperty(PropertyName = "properties")] + public PrivateEndpointConnectionProperties Properties { get; set; } + + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpointConnectionProperties.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpointConnectionProperties.cs new file mode 100644 index 000000000000..9a57871ec072 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateEndpointConnectionProperties.cs @@ -0,0 +1,64 @@ +// +// 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.DeviceProvisioningServices.Models +{ + 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. + /// + /// The current state + /// of a private endpoint connection + /// The private endpoint property of a + /// private endpoint connection + 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(); + + /// + /// Gets or sets the private endpoint property of a private endpoint + /// connection + /// + [JsonProperty(PropertyName = "privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets the current state of a private endpoint connection + /// + [JsonProperty(PropertyName = "privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkResources.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkResources.cs new file mode 100644 index 000000000000..6a8fa45ae411 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkResources.cs @@ -0,0 +1,55 @@ +// +// 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.DeviceProvisioningServices.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The available private link resources for a provisioning service + /// + public partial class PrivateLinkResources + { + /// + /// Initializes a new instance of the PrivateLinkResources class. + /// + public PrivateLinkResources() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResources class. + /// + /// The list of available private link resources + /// for a provisioning service + public PrivateLinkResources(IList value = default(IList)) + { + Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the list of available private link resources for a + /// provisioning service + /// + [JsonProperty(PropertyName = "value")] + public IList Value { get; set; } + + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..7df8a83c4046 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkServiceConnectionState.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.DeviceProvisioningServices.Models +{ + 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; } + + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkServiceConnectionStatus.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PrivateLinkServiceConnectionStatus.cs new file mode 100644 index 000000000000..93b56e6a613e --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/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.DeviceProvisioningServices.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/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ProvisioningServiceDescription.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ProvisioningServiceDescription.cs index 9ee57bc08986..9e870d978c94 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ProvisioningServiceDescription.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/ProvisioningServiceDescription.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; @@ -79,23 +78,5 @@ public ProvisioningServiceDescription() [JsonProperty(PropertyName = "sku")] public IotDpsSkuInfo Sku { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (Properties == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); - } - if (Sku == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); - } - } } } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PublicNetworkAccess.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..d8bddf61b0b3 --- /dev/null +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/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.DeviceProvisioningServices.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Resource.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Resource.cs index 1a430c4d513d..f5781b1f5f02 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Resource.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/Resource.cs @@ -83,25 +83,5 @@ public Resource() [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - 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/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs index fe2aea1eaed3..3d8c0261747f 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; using Newtonsoft.Json; using System.Linq; @@ -82,22 +81,5 @@ public SharedAccessSignatureAuthorizationRuleAccessRightsDescription() [JsonProperty(PropertyName = "rights")] public string Rights { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (KeyName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "KeyName"); - } - if (Rights == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Rights"); - } - } } } diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/VerificationCodeResponseProperties.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/VerificationCodeResponseProperties.cs index e92b0961607e..712299bf710d 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/VerificationCodeResponseProperties.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/Models/VerificationCodeResponseProperties.cs @@ -34,15 +34,18 @@ public VerificationCodeResponseProperties() /// Certificate thumbprint. /// Indicate if the certificate is verified by /// owner of private key. + /// base-64 representation of X509 + /// certificate .cer file or just .pem file content. /// Certificate created time. /// Certificate updated time. - public VerificationCodeResponseProperties(string verificationCode = default(string), string subject = default(string), string expiry = default(string), string thumbprint = default(string), bool? isVerified = default(bool?), string created = default(string), string updated = default(string)) + public VerificationCodeResponseProperties(string verificationCode = default(string), string subject = default(string), string expiry = default(string), string thumbprint = default(string), bool? isVerified = default(bool?), byte[] certificate = default(byte[]), string created = default(string), string updated = default(string)) { VerificationCode = verificationCode; Subject = subject; Expiry = expiry; Thumbprint = thumbprint; IsVerified = isVerified; + Certificate = certificate; Created = created; Updated = updated; CustomInit(); @@ -84,6 +87,13 @@ public VerificationCodeResponseProperties() [JsonProperty(PropertyName = "isVerified")] public bool? IsVerified { get; set; } + /// + /// Gets or sets base-64 representation of X509 certificate .cer file + /// or just .pem file content. + /// + [JsonProperty(PropertyName = "certificate")] + public byte[] Certificate { get; set; } + /// /// Gets or sets certificate created time. /// diff --git a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/SdkInfo_iotDpsClient.cs b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/SdkInfo_iotDpsClient.cs index e0e84a89f3de..3b70d953c078 100644 --- a/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/SdkInfo_iotDpsClient.cs +++ b/sdk/deviceprovisioningservices/Microsoft.Azure.Management.DeviceProvisioningServices/src/Generated/SdkInfo_iotDpsClient.cs @@ -1,21 +1,29 @@ -using System; -using System.Collections.Generic; -using System.Linq; +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// -internal static partial class SdkInfo +namespace Microsoft.Azure.Management.DeviceProvisioningServices { - public static IEnumerable> ApiInfo_iotDpsClient - { - get - { - return new Tuple[] - { - new Tuple("Devices", "DpsCertificate", "2017-11-15"), - new Tuple("Devices", "DpsCertificates", "2017-11-15"), - new Tuple("Devices", "IotDpsResource", "2017-11-15"), - new Tuple("Devices", "Operations", "2017-11-15"), - }.AsEnumerable(); - } - } + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_iotDpsClient + { + get + { + return new Tuple[] + { + new Tuple("Devices", "DpsCertificate", "2020-03-01"), + new Tuple("Devices", "IotDpsResource", "2020-03-01"), + new Tuple("Devices", "Operations", "2020-03-01"), + }.AsEnumerable(); + } + } + } }