diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperations.cs index 95ad4bd19b33..32b6a54bcf16 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperations.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices { + using System.Linq; 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; /// /// DpsCertificateOperations operations. /// - internal partial class DpsCertificateOperations : IServiceOperations, IDpsCertificateOperations + internal partial class DpsCertificateOperations : Microsoft.Rest.IServiceOperations, IDpsCertificateOperations { /// /// Initializes a new instance of the DpsCertificateOperations class. @@ -36,13 +24,13 @@ internal partial class DpsCertificateOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal DpsCertificateOperations(IotDpsClient client) + internal DpsCertificateOperations (IotDpsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -71,13 +59,13 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// 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 /// /// @@ -86,86 +74,99 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (certificateName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.ApiVersion == null) + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("certificateName", certificateName); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("ifMatch", ifMatch); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}").ToString(); _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.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) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (ifMatch != null) + if (this.Client.AcceptLanguage != null) { - if (_httpRequest.Headers.Contains("If-Match")) + if (_httpRequest.Headers.Contains("accept-language")) { - _httpRequest.Headers.Remove("If-Match"); + _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (Client.AcceptLanguage != null) + if (ifMatch != null) { - if (_httpRequest.Headers.Contains("accept-language")) + if (_httpRequest.Headers.Contains("If-Match")) { - _httpRequest.Headers.Remove("accept-language"); + _httpRequest.Headers.Remove("If-Match"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -177,50 +178,51 @@ internal DpsCertificateOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -230,9 +232,10 @@ internal DpsCertificateOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -243,31 +246,32 @@ internal DpsCertificateOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Upload the certificate to the provisioning service. - /// - /// /// Add new certificate or update an existing certificate. - /// + /// /// /// Resource group identifier. /// @@ -281,9 +285,8 @@ internal DpsCertificateOperations(IotDpsClient client) /// 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 certificate body. /// /// /// Headers that will be added to request. @@ -291,13 +294,13 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// 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 /// /// @@ -306,99 +309,111 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - 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)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) + + + + + if (certificateDescription == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateDescription"); + } + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } + if (certificateName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); } if (certificateName != null) { if (certificateName.Length > 256) { - throw new ValidationException(ValidationRules.MaxLength, "certificateName", 256); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "certificateName", 256); } } - CertificateBodyDescription certificateDescription = new CertificateBodyDescription(); - if (certificate != null) - { - certificateDescription.Certificate = certificate; - } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("certificateName", certificateName); tracingParameters.Add("ifMatch", ifMatch); + tracingParameters.Add("certificateDescription", certificateDescription); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (ifMatch != null) + if (this.Client.AcceptLanguage != null) { - if (_httpRequest.Headers.Contains("If-Match")) + if (_httpRequest.Headers.Contains("accept-language")) { - _httpRequest.Headers.Remove("If-Match"); + _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (Client.AcceptLanguage != null) + if (ifMatch != null) { - if (_httpRequest.Headers.Contains("accept-language")) + if (_httpRequest.Headers.Contains("If-Match")) { - _httpRequest.Headers.Remove("accept-language"); + _httpRequest.Headers.Remove("If-Match"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -410,56 +425,57 @@ internal DpsCertificateOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(certificateDescription != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(certificateDescription, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateDescription, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -469,9 +485,10 @@ internal DpsCertificateOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -482,31 +499,32 @@ internal DpsCertificateOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// 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. /// @@ -520,29 +538,28 @@ internal DpsCertificateOperations(IotDpsClient client) /// This is a mandatory field, and is the logical name of the certificate that /// the provisioning service will access by. /// - /// + /// /// This is optional, and it is the Common Name of the certificate. /// - /// + /// /// Raw data within the certificate. /// - /// + /// /// Indicates if certificate has been verified by owner of the private key. /// - /// - /// A description that mentions the purpose of the certificate. Possible values - /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// A description that mentions the purpose of the certificate. /// - /// + /// /// Time the certificate is created. /// - /// + /// /// Time the certificate is last updated. /// - /// + /// /// Indicates if the certificate contains a private key. /// - /// + /// /// Random number generated to indicate Proof of Possession. /// /// @@ -551,10 +568,10 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -563,130 +580,151 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async 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)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } + if (ifMatch == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ifMatch"); } + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } + if (certificateName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); } - if (Client.ApiVersion == null) + + + + + + + + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("certificateName", certificateName); - tracingParameters.Add("certificatename", certificatename); - tracingParameters.Add("certificaterawBytes", certificaterawBytes); - tracingParameters.Add("certificateisVerified", certificateisVerified); - tracingParameters.Add("certificatepurpose", certificatepurpose); - tracingParameters.Add("certificatecreated", certificatecreated); - tracingParameters.Add("certificatelastUpdated", certificatelastUpdated); - tracingParameters.Add("certificatehasPrivateKey", certificatehasPrivateKey); - tracingParameters.Add("certificatenonce", certificatenonce); + tracingParameters.Add("certificateName1", certificateName1); + tracingParameters.Add("certificateRawBytes", certificateRawBytes); + tracingParameters.Add("certificateIsVerified", certificateIsVerified); + tracingParameters.Add("certificatePurpose", certificatePurpose); + tracingParameters.Add("certificateCreated", certificateCreated); + tracingParameters.Add("certificateLastUpdated", certificateLastUpdated); + tracingParameters.Add("certificateHasPrivateKey", certificateHasPrivateKey); + tracingParameters.Add("certificateNonce", certificateNonce); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); - List _queryParameters = new List(); - if (certificatename != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (certificateName1 != null) { - _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificatename))); + _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificateName1))); } - if (certificaterawBytes != null) + if (certificateRawBytes != null) { - _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificaterawBytes, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateRawBytes, this.Client.SerializationSettings).Trim('"')))); } - if (certificateisVerified != null) + if (certificateIsVerified != null) { - _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificateisVerified, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateIsVerified, this.Client.SerializationSettings).Trim('"')))); } - if (certificatepurpose != null) + if (certificatePurpose != null) { - _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatepurpose))); + _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatePurpose))); } - if (certificatecreated != null) + if (certificateCreated != null) { - _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatecreated, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateCreated, this.Client.SerializationSettings).Trim('"')))); } - if (certificatelastUpdated != null) + if (certificateLastUpdated != null) { - _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatelastUpdated, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateLastUpdated, this.Client.SerializationSettings).Trim('"')))); } - if (certificatehasPrivateKey != null) + if (certificateHasPrivateKey != null) { - _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatehasPrivateKey, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateHasPrivateKey, this.Client.SerializationSettings).Trim('"')))); } - if (certificatenonce != null) + if (certificateNonce != null) { - _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificatenonce))); + _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificateNonce))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (ifMatch != null) + if (this.Client.AcceptLanguage != null) { - if (_httpRequest.Headers.Contains("If-Match")) + if (_httpRequest.Headers.Contains("accept-language")) { - _httpRequest.Headers.Remove("If-Match"); + _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (Client.AcceptLanguage != null) + if (ifMatch != null) { - if (_httpRequest.Headers.Contains("accept-language")) + if (_httpRequest.Headers.Contains("If-Match")) { - _httpRequest.Headers.Remove("accept-language"); + _httpRequest.Headers.Remove("If-Match"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -698,50 +736,51 @@ internal DpsCertificateOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; + if ((int)_statusCode != 200 && (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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -751,211 +790,25 @@ internal DpsCertificateOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } 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. /// @@ -973,29 +826,28 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// Name of provisioning service. /// - /// + /// /// Common Name for the certificate. /// - /// + /// /// Raw data of certificate. /// - /// + /// /// Indicates if the certificate has been verified by owner of the private key. /// - /// - /// Description mentioning the purpose of the certificate. Possible values - /// include: 'clientAuthentication', 'serverAuthentication' + /// + /// Description mentioning the purpose of the certificate. /// - /// + /// /// Certificate creation time. /// - /// + /// /// Certificate last updated time. /// - /// + /// /// Indicates if the certificate contains private key. /// - /// + /// /// Random number generated to indicate Proof of Possession. /// /// @@ -1004,13 +856,13 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// 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 /// /// @@ -1019,130 +871,151 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GenerateVerificationCodeWithHttpMessagesAsync(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), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GenerateVerificationCodeWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (certificateName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); } + if (ifMatch == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ifMatch"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.ApiVersion == null) + + + + + + + + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("certificateName", certificateName); tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); - tracingParameters.Add("certificatename", certificatename); - tracingParameters.Add("certificaterawBytes", certificaterawBytes); - tracingParameters.Add("certificateisVerified", certificateisVerified); - tracingParameters.Add("certificatepurpose", certificatepurpose); - tracingParameters.Add("certificatecreated", certificatecreated); - tracingParameters.Add("certificatelastUpdated", certificatelastUpdated); - tracingParameters.Add("certificatehasPrivateKey", certificatehasPrivateKey); - tracingParameters.Add("certificatenonce", certificatenonce); + tracingParameters.Add("certificateName1", certificateName1); + tracingParameters.Add("certificateRawBytes", certificateRawBytes); + tracingParameters.Add("certificateIsVerified", certificateIsVerified); + tracingParameters.Add("certificatePurpose", certificatePurpose); + tracingParameters.Add("certificateCreated", certificateCreated); + tracingParameters.Add("certificateLastUpdated", certificateLastUpdated); + tracingParameters.Add("certificateHasPrivateKey", certificateHasPrivateKey); + tracingParameters.Add("certificateNonce", certificateNonce); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GenerateVerificationCode", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GenerateVerificationCode", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/generateVerificationCode").ToString(); _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); - List _queryParameters = new List(); - if (certificatename != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (certificateName1 != null) { - _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificatename))); + _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificateName1))); } - if (certificaterawBytes != null) + if (certificateRawBytes != null) { - _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificaterawBytes, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateRawBytes, this.Client.SerializationSettings).Trim('"')))); } - if (certificateisVerified != null) + if (certificateIsVerified != null) { - _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificateisVerified, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateIsVerified, this.Client.SerializationSettings).Trim('"')))); } - if (certificatepurpose != null) + if (certificatePurpose != null) { - _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatepurpose))); + _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatePurpose))); } - if (certificatecreated != null) + if (certificateCreated != null) { - _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatecreated, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateCreated, this.Client.SerializationSettings).Trim('"')))); } - if (certificatelastUpdated != null) + if (certificateLastUpdated != null) { - _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatelastUpdated, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateLastUpdated, this.Client.SerializationSettings).Trim('"')))); } - if (certificatehasPrivateKey != null) + if (certificateHasPrivateKey != null) { - _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatehasPrivateKey, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateHasPrivateKey, this.Client.SerializationSettings).Trim('"')))); } - if (certificatenonce != null) + if (certificateNonce != null) { - _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificatenonce))); + _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificateNonce))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (ifMatch != null) + if (this.Client.AcceptLanguage != null) { - if (_httpRequest.Headers.Contains("If-Match")) + if (_httpRequest.Headers.Contains("accept-language")) { - _httpRequest.Headers.Remove("If-Match"); + _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (Client.AcceptLanguage != null) + if (ifMatch != null) { - if (_httpRequest.Headers.Contains("accept-language")) + if (_httpRequest.Headers.Contains("If-Match")) { - _httpRequest.Headers.Remove("accept-language"); + _httpRequest.Headers.Remove("If-Match"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1154,50 +1027,51 @@ internal DpsCertificateOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1207,9 +1081,10 @@ internal DpsCertificateOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1220,32 +1095,33 @@ internal DpsCertificateOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Verify certificate's private key possession. - /// - /// - /// Verifies the certificate's private key possession by providing the leaf + /// Verifies the certificate's private key possession by providing the leaf /// cert issued by the verifying pre uploaded certificate. - /// + /// /// /// The mandatory logical name of the certificate, that the provisioning /// service uses to access. @@ -1259,34 +1135,32 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// Provisioning service name. /// - /// + /// /// Common Name for the certificate. /// - /// + /// /// Raw data of certificate. /// - /// + /// /// Indicates if the certificate has been verified by owner of the private key. /// - /// - /// Describe the purpose of the certificate. Possible values include: - /// 'clientAuthentication', 'serverAuthentication' + /// + /// Describe the purpose of the certificate. /// - /// + /// /// Certificate creation time. /// - /// + /// /// Certificate last updated time. /// - /// + /// /// Indicates if the certificate contains private key. /// - /// + /// /// Random number generated to indicate Proof of Possession. /// - /// - /// base-64 representation of X509 certificate .cer file or just .pem file - /// content. + /// + /// The name of the certificate /// /// /// Headers that will be added to request. @@ -1294,13 +1168,13 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// 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 /// /// @@ -1309,136 +1183,157 @@ internal DpsCertificateOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - 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)) + public async System.Threading.Tasks.Task> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, VerificationCodeRequest request, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + + if (request == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "request"); + } + if (certificateName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "certificateName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "certificateName"); } + if (ifMatch == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ifMatch"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ifMatch"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - VerificationCodeRequest request = new VerificationCodeRequest(); - if (certificate != null) + + + + + + + + + + if (this.Client.ApiVersion == null) { - request.Certificate = certificate; + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("certificateName", certificateName); tracingParameters.Add("ifMatch", ifMatch); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); - tracingParameters.Add("certificatename", certificatename); - tracingParameters.Add("certificaterawBytes", certificaterawBytes); - tracingParameters.Add("certificateisVerified", certificateisVerified); - tracingParameters.Add("certificatepurpose", certificatepurpose); - tracingParameters.Add("certificatecreated", certificatecreated); - tracingParameters.Add("certificatelastUpdated", certificatelastUpdated); - tracingParameters.Add("certificatehasPrivateKey", certificatehasPrivateKey); - tracingParameters.Add("certificatenonce", certificatenonce); + tracingParameters.Add("certificateName1", certificateName1); + tracingParameters.Add("certificateRawBytes", certificateRawBytes); + tracingParameters.Add("certificateIsVerified", certificateIsVerified); + tracingParameters.Add("certificatePurpose", certificatePurpose); + tracingParameters.Add("certificateCreated", certificateCreated); + 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); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "VerifyCertificate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/certificates/{certificateName}/verify").ToString(); _url = _url.Replace("{certificateName}", System.Uri.EscapeDataString(certificateName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); - List _queryParameters = new List(); - if (certificatename != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (certificateName1 != null) { - _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificatename))); + _queryParameters.Add(string.Format("certificate.name={0}", System.Uri.EscapeDataString(certificateName1))); } - if (certificaterawBytes != null) + if (certificateRawBytes != null) { - _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificaterawBytes, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.rawBytes={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateRawBytes, this.Client.SerializationSettings).Trim('"')))); } - if (certificateisVerified != null) + if (certificateIsVerified != null) { - _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificateisVerified, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.isVerified={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateIsVerified, this.Client.SerializationSettings).Trim('"')))); } - if (certificatepurpose != null) + if (certificatePurpose != null) { - _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatepurpose))); + _queryParameters.Add(string.Format("certificate.purpose={0}", System.Uri.EscapeDataString(certificatePurpose))); } - if (certificatecreated != null) + if (certificateCreated != null) { - _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatecreated, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.created={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateCreated, this.Client.SerializationSettings).Trim('"')))); } - if (certificatelastUpdated != null) + if (certificateLastUpdated != null) { - _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatelastUpdated, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.lastUpdated={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateLastUpdated, this.Client.SerializationSettings).Trim('"')))); } - if (certificatehasPrivateKey != null) + if (certificateHasPrivateKey != null) { - _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(certificatehasPrivateKey, Client.SerializationSettings).Trim('"')))); + _queryParameters.Add(string.Format("certificate.hasPrivateKey={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(certificateHasPrivateKey, this.Client.SerializationSettings).Trim('"')))); } - if (certificatenonce != null) + if (certificateNonce != null) { - _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificatenonce))); + _queryParameters.Add(string.Format("certificate.nonce={0}", System.Uri.EscapeDataString(certificateNonce))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (ifMatch != null) + if (this.Client.AcceptLanguage != null) { - if (_httpRequest.Headers.Contains("If-Match")) + if (_httpRequest.Headers.Contains("accept-language")) { - _httpRequest.Headers.Remove("If-Match"); + _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (Client.AcceptLanguage != null) + if (ifMatch != null) { - if (_httpRequest.Headers.Contains("accept-language")) + if (_httpRequest.Headers.Contains("If-Match")) { - _httpRequest.Headers.Remove("accept-language"); + _httpRequest.Headers.Remove("If-Match"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("If-Match", ifMatch); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1450,56 +1345,57 @@ internal DpsCertificateOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(request != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(request, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(request, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1509,9 +1405,10 @@ internal DpsCertificateOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1522,24 +1419,28 @@ internal DpsCertificateOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperationsExtensions.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperationsExtensions.cs index da68b00bbfc8..41331ebb32b8 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperationsExtensions.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificateOperationsExtensions.cs @@ -1,518 +1,424 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for DpsCertificateOperations. + /// Extension methods for DpsCertificateOperations /// public static partial class DpsCertificateOperationsExtensions { - /// - /// Get the certificate from the provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the certificate to retrieve. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of the provisioning service the certificate is associated with. - /// - /// - /// ETag of the certificate. - /// - public static CertificateResponse Get(this IDpsCertificateOperations operations, string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string)) - { - return operations.GetAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).GetAwaiter().GetResult(); - } - - /// - /// Get the certificate from the provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the certificate to retrieve. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of the provisioning service the certificate is associated with. - /// - /// - /// ETag of the certificate. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDpsCertificateOperations operations, string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Upload the certificate to the provisioning service. - /// - /// - /// Add new certificate or update an existing certificate. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// The name of the provisioning service. - /// - /// - /// The name of the certificate create or update. - /// - /// - /// 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. - /// - 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, ifMatch, certificate).GetAwaiter().GetResult(); - } - - /// - /// Upload the certificate to the provisioning service. - /// - /// - /// Add new certificate or update an existing certificate. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// The name of the provisioning service. - /// - /// - /// The name of the certificate create or update. - /// - /// - /// 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, string ifMatch = default(string), string certificate = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, certificateName, ifMatch, certificate, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Get the certificate from the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the certificate to retrieve. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of the provisioning service the certificate is associated with. + /// + /// + /// ETag of the certificate. + /// + public static CertificateResponse Get(this IDpsCertificateOperations operations, string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string)) + { + return ((IDpsCertificateOperations)operations).GetAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch).GetAwaiter().GetResult(); + } - /// - /// Delete the Provisioning Service Certificate. - /// - /// - /// Deletes the specified certificate associated with the Provisioning Service - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// ETag of the certificate - /// - /// - /// The name of the provisioning service. - /// - /// - /// This is a mandatory field, and is the logical name of the certificate that - /// the provisioning service will access by. - /// - /// - /// This is optional, and it is the Common Name of the certificate. - /// - /// - /// Raw data within the certificate. - /// - /// - /// Indicates if certificate has been verified by owner of the private key. - /// - /// - /// A description that mentions the purpose of the certificate. Possible values - /// include: 'clientAuthentication', 'serverAuthentication' - /// - /// - /// Time the certificate is created. - /// - /// - /// Time the certificate is last updated. - /// - /// - /// Indicates if the certificate contains a private key. - /// - /// - /// Random number generated to indicate Proof of Possession. - /// - public static void Delete(this IDpsCertificateOperations operations, 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)) + /// + /// Get the certificate from the provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the certificate to retrieve. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of the provisioning service the certificate is associated with. + /// + /// + /// ETag of the certificate. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IDpsCertificateOperations operations, string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(certificateName, resourceGroupName, provisioningServiceName, ifMatch, null, cancellationToken).ConfigureAwait(false)) { - operations.DeleteAsync(resourceGroupName, ifMatch, provisioningServiceName, certificateName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Add new certificate or update an existing certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the certificate create or update. + /// + /// + /// 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)) + { + return ((IDpsCertificateOperations)operations).CreateOrUpdateAsync(resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch).GetAwaiter().GetResult(); + } - /// - /// Delete the Provisioning Service Certificate. - /// - /// - /// Deletes the specified certificate associated with the Provisioning Service - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// ETag of the certificate - /// - /// - /// The name of the provisioning service. - /// - /// - /// This is a mandatory field, and is the logical name of the certificate that - /// the provisioning service will access by. - /// - /// - /// This is optional, and it is the Common Name of the certificate. - /// - /// - /// Raw data within the certificate. - /// - /// - /// Indicates if certificate has been verified by owner of the private key. - /// - /// - /// A description that mentions the purpose of the certificate. Possible values - /// include: 'clientAuthentication', 'serverAuthentication' - /// - /// - /// Time the certificate is created. - /// - /// - /// Time the certificate is last updated. - /// - /// - /// Indicates if the certificate contains a private key. - /// - /// - /// Random number generated to indicate Proof of Possession. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDpsCertificateOperations operations, 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), CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Add new certificate or update an existing certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// The name of the provisioning service. + /// + /// + /// The name of the certificate create or update. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDpsCertificateOperations operations, string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, certificateName, certificateDescription, ifMatch, null, cancellationToken).ConfigureAwait(false)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ifMatch, provisioningServiceName, certificateName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, null, cancellationToken).ConfigureAwait(false)).Dispose(); + return _result.Body; } + } + /// + /// Deletes the specified certificate assosciated with the Provisioning Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// ETag of the certificate + /// + /// + /// The name of the provisioning service. + /// + /// + /// This is a mandatory field, and is the logical name of the certificate that + /// the provisioning service will access by. + /// + /// + /// This is optional, and it is the Common Name of the certificate. + /// + /// + /// Raw data within the certificate. + /// + /// + /// Indicates if certificate has been verified by owner of the private key. + /// + /// + /// A description that mentions the purpose of the certificate. + /// + /// + /// Time the certificate is created. + /// + /// + /// Time the certificate is last updated. + /// + /// + /// Indicates if the certificate contains a private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + public static void Delete(this IDpsCertificateOperations operations, string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string)) + { + ((IDpsCertificateOperations)operations).DeleteAsync(resourceGroupName, ifMatch, provisioningServiceName, certificateName, certificateName1, certificateRawBytes, certificateIsVerified, certificatePurpose, certificateCreated, certificateLastUpdated, certificateHasPrivateKey, certificateNonce).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. - /// - 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The mandatory logical name of the certificate, that the provisioning - /// service uses to access. - /// - /// - /// ETag of the certificate. This is required to update an existing - /// certificate, and ignored while creating a brand new certificate. - /// - /// - /// name of resource group. - /// - /// - /// Name of provisioning service. - /// - /// - /// Common Name for the certificate. - /// - /// - /// Raw data of certificate. - /// - /// - /// Indicates if the certificate has been verified by owner of the private key. - /// - /// - /// Description mentioning the purpose of the certificate. Possible values - /// include: 'clientAuthentication', 'serverAuthentication' - /// - /// - /// Certificate creation time. - /// - /// - /// Certificate last updated time. - /// - /// - /// Indicates if the certificate contains private key. - /// - /// - /// Random number generated to indicate Proof of Possession. - /// - public static VerificationCodeResponse GenerateVerificationCode(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)) - { - return operations.GenerateVerificationCodeAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce).GetAwaiter().GetResult(); - } - - /// - /// Generate verification code for Proof of Possession. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The mandatory logical name of the certificate, that the provisioning - /// service uses to access. - /// - /// - /// ETag of the certificate. This is required to update an existing - /// certificate, and ignored while creating a brand new certificate. - /// - /// - /// name of resource group. - /// - /// - /// Name of provisioning service. - /// - /// - /// Common Name for the certificate. - /// - /// - /// Raw data of certificate. - /// - /// - /// Indicates if the certificate has been verified by owner of the private key. - /// - /// - /// Description mentioning the purpose of the certificate. Possible values - /// include: 'clientAuthentication', 'serverAuthentication' - /// - /// - /// Certificate creation time. - /// - /// - /// Certificate last updated time. - /// - /// - /// Indicates if the certificate contains private key. - /// - /// - /// Random number generated to indicate Proof of Possession. - /// - /// - /// The cancellation token. - /// - public static async Task GenerateVerificationCodeAsync(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), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GenerateVerificationCodeWithHttpMessagesAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } + /// + /// Deletes the specified certificate assosciated with the Provisioning Service + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// ETag of the certificate + /// + /// + /// The name of the provisioning service. + /// + /// + /// This is a mandatory field, and is the logical name of the certificate that + /// the provisioning service will access by. + /// + /// + /// This is optional, and it is the Common Name of the certificate. + /// + /// + /// Raw data within the certificate. + /// + /// + /// Indicates if certificate has been verified by owner of the private key. + /// + /// + /// A description that mentions the purpose of the certificate. + /// + /// + /// Time the certificate is created. + /// + /// + /// Time the certificate is last updated. + /// + /// + /// Indicates if the certificate contains a private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IDpsCertificateOperations operations, string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ifMatch, provisioningServiceName, certificateName, certificateName1, certificateRawBytes, certificateIsVerified, certificatePurpose, certificateCreated, certificateLastUpdated, certificateHasPrivateKey, certificateNonce, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Generate verification code for Proof of Possession. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// name of resource group. + /// + /// + /// Name of provisioning service. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Description mentioning the purpose of the certificate. + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + public static VerificationCodeResponse GenerateVerificationCode(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string)) + { + return ((IDpsCertificateOperations)operations).GenerateVerificationCodeAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificateName1, certificateRawBytes, certificateIsVerified, certificatePurpose, certificateCreated, certificateLastUpdated, certificateHasPrivateKey, certificateNonce).GetAwaiter().GetResult(); + } - /// - /// Verify certificate's private key possession. - /// - /// - /// Verifies the certificate's private key possession by providing the leaf - /// cert issued by the verifying pre uploaded certificate. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The mandatory logical name of the certificate, that the provisioning - /// service uses to access. - /// - /// - /// ETag of the certificate. - /// - /// - /// Resource group name. - /// - /// - /// Provisioning service name. - /// - /// - /// Common Name for the certificate. - /// - /// - /// Raw data of certificate. - /// - /// - /// Indicates if the certificate has been verified by owner of the private key. - /// - /// - /// Describe the purpose of the certificate. Possible values include: - /// 'clientAuthentication', 'serverAuthentication' - /// - /// - /// Certificate creation time. - /// - /// - /// Certificate last updated time. - /// - /// - /// Indicates if the certificate contains private key. - /// - /// - /// Random number generated to indicate Proof of Possession. - /// - /// - /// 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)) + /// + /// Generate verification code for Proof of Possession. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. This is required to update an existing + /// certificate, and ignored while creating a brand new certificate. + /// + /// + /// name of resource group. + /// + /// + /// Name of provisioning service. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Description mentioning the purpose of the certificate. + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GenerateVerificationCodeAsync(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GenerateVerificationCodeWithHttpMessagesAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificateName1, certificateRawBytes, certificateIsVerified, certificatePurpose, certificateCreated, certificateLastUpdated, certificateHasPrivateKey, certificateNonce, null, cancellationToken).ConfigureAwait(false)) { - return operations.VerifyCertificateAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, certificatename, certificaterawBytes, certificateisVerified, certificatepurpose, certificatecreated, certificatelastUpdated, certificatehasPrivateKey, certificatenonce, certificate).GetAwaiter().GetResult(); + return _result.Body; } + } + /// + /// Verifies the certificate's private key possession by providing the leaf + /// cert issued by the verifying pre uploaded certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. + /// + /// + /// Resource group name. + /// + /// + /// Provisioning service name. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Describe the purpose of the certificate. + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + public static CertificateResponse VerifyCertificate(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, VerificationCodeRequest request, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string)) + { + return ((IDpsCertificateOperations)operations).VerifyCertificateAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, request, certificateName1, certificateRawBytes, certificateIsVerified, certificatePurpose, certificateCreated, certificateLastUpdated, certificateHasPrivateKey, certificateNonce).GetAwaiter().GetResult(); + } - /// - /// Verify certificate's private key possession. - /// - /// - /// Verifies the certificate's private key possession by providing the leaf - /// cert issued by the verifying pre uploaded certificate. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The mandatory logical name of the certificate, that the provisioning - /// service uses to access. - /// - /// - /// ETag of the certificate. - /// - /// - /// Resource group name. - /// - /// - /// Provisioning service name. - /// - /// - /// Common Name for the certificate. - /// - /// - /// Raw data of certificate. - /// - /// - /// Indicates if the certificate has been verified by owner of the private key. - /// - /// - /// Describe the purpose of the certificate. Possible values include: - /// 'clientAuthentication', 'serverAuthentication' - /// - /// - /// Certificate creation time. - /// - /// - /// Certificate last updated time. - /// - /// - /// Indicates if the certificate contains private key. - /// - /// - /// 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, 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)) + /// + /// Verifies the certificate's private key possession by providing the leaf + /// cert issued by the verifying pre uploaded certificate. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. + /// + /// + /// ETag of the certificate. + /// + /// + /// Resource group name. + /// + /// + /// Provisioning service name. + /// + /// + /// Common Name for the certificate. + /// + /// + /// Raw data of certificate. + /// + /// + /// Indicates if the certificate has been verified by owner of the private key. + /// + /// + /// Describe the purpose of the certificate. + /// + /// + /// Certificate creation time. + /// + /// + /// Certificate last updated time. + /// + /// + /// Indicates if the certificate contains private key. + /// + /// + /// Random number generated to indicate Proof of Possession. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task VerifyCertificateAsync(this IDpsCertificateOperations operations, string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, VerificationCodeRequest request, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.VerifyCertificateWithHttpMessagesAsync(certificateName, ifMatch, resourceGroupName, provisioningServiceName, request, certificateName1, 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; - } + return _result.Body; } - + } } } diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificatesOperations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificatesOperations.cs new file mode 100644 index 000000000000..75fee466c2a3 --- /dev/null +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificatesOperations.cs @@ -0,0 +1,250 @@ +// 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 System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// DpsCertificatesOperations operations. + /// + internal partial class DpsCertificatesOperations : Microsoft.Rest.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"); + } + this.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 System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (provisioningServiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("provisioningServiceName", provisioningServiceName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.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(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificatesOperationsExtensions.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificatesOperationsExtensions.cs new file mode 100644 index 000000000000..87a7bef72129 --- /dev/null +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/DpsCertificatesOperationsExtensions.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 +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// 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 ((IDpsCertificatesOperations)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 System.Threading.Tasks.Task ListAsync(this IDpsCertificatesOperations operations, string resourceGroupName, string provisioningServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IDpsCertificateOperations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IDpsCertificateOperations.cs index 9ec14ce8004f..51ae3132f5d7 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IDpsCertificateOperations.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IDpsCertificateOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. 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; /// /// DpsCertificateOperations operations. @@ -26,6 +16,9 @@ public partial interface IDpsCertificateOperations /// /// Get the certificate from the provisioning service. /// + /// + /// Get the certificate from the provisioning service. + /// /// /// Name of the certificate to retrieve. /// @@ -33,8 +26,7 @@ public partial interface IDpsCertificateOperations /// Resource group identifier. /// /// - /// Name of the provisioning service the certificate is associated - /// with. + /// Name of the provisioning service the certificate is associated with. /// /// /// ETag of the certificate. @@ -45,18 +37,16 @@ public partial interface IDpsCertificateOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string certificateName, string resourceGroupName, string provisioningServiceName, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Upload the certificate to the provisioning service. + /// Add new certificate or update an existing certificate. /// /// /// Add new certificate or update an existing certificate. @@ -74,9 +64,8 @@ public partial interface IDpsCertificateOperations /// 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 certificate body. /// /// /// The headers that will be added to request. @@ -84,22 +73,19 @@ public partial interface IDpsCertificateOperations /// /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, string ifMatch = default(string), string certificate = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, string certificateName, CertificateBodyDescription certificateDescription, string ifMatch = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Delete the Provisioning Service Certificate. + /// Deletes the specified certificate assosciated with the Provisioning Service /// /// - /// Deletes the specified certificate associated with the Provisioning - /// Service + /// Deletes the specified certificate assosciated with the Provisioning Service /// /// /// Resource group identifier. @@ -111,34 +97,31 @@ public partial interface IDpsCertificateOperations /// The name of the provisioning service. /// /// - /// This is a mandatory field, and is the logical name of the - /// certificate that the provisioning service will access by. + /// This is a mandatory field, and is the logical name of the certificate that + /// the provisioning service will access by. /// - /// + /// /// This is optional, and it is the Common Name of the certificate. /// - /// + /// /// Raw data within the certificate. /// - /// - /// Indicates if certificate has been verified by owner of the private - /// key. + /// + /// Indicates if certificate has been verified by owner of the private key. /// - /// + /// /// A description that mentions the purpose of the certificate. - /// Possible values include: 'clientAuthentication', - /// 'serverAuthentication' /// - /// + /// /// Time the certificate is created. /// - /// + /// /// Time the certificate is last updated. /// - /// + /// /// Indicates if the certificate contains a private key. /// - /// + /// /// Random number generated to indicate Proof of Possession. /// /// @@ -147,44 +130,20 @@ public partial interface IDpsCertificateOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - 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)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ifMatch, string provisioningServiceName, string certificateName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Generate verification code for Proof of Possession. /// + /// + /// Generate verification code for Proof of Possession. + /// /// - /// The mandatory logical name of the certificate, that the - /// provisioning service uses to access. + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. /// /// /// ETag of the certificate. This is required to update an existing @@ -196,30 +155,28 @@ public partial interface IDpsCertificateOperations /// /// Name of provisioning service. /// - /// + /// /// Common Name for the certificate. /// - /// + /// /// Raw data of certificate. /// - /// - /// Indicates if the certificate has been verified by owner of the - /// private key. + /// + /// Indicates if the certificate has been verified by owner of the private key. /// - /// - /// Description mentioning the purpose of the certificate. Possible - /// values include: 'clientAuthentication', 'serverAuthentication' + /// + /// Description mentioning the purpose of the certificate. /// - /// + /// /// Certificate creation time. /// - /// + /// /// Certificate last updated time. /// - /// + /// /// Indicates if the certificate contains private key. /// - /// + /// /// Random number generated to indicate Proof of Possession. /// /// @@ -228,26 +185,25 @@ public partial interface IDpsCertificateOperations /// /// 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> GenerateVerificationCodeWithHttpMessagesAsync(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), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GenerateVerificationCodeWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Verify certificate's private key possession. + /// Verifies the certificate's private key possession by providing the leaf + /// cert issued by the verifying pre uploaded certificate. /// /// - /// Verifies the certificate's private key possession by providing the - /// leaf cert issued by the verifying pre uploaded certificate. + /// Verifies the certificate's private key possession by providing the leaf + /// cert issued by the verifying pre uploaded certificate. /// /// - /// The mandatory logical name of the certificate, that the - /// provisioning service uses to access. + /// The mandatory logical name of the certificate, that the provisioning + /// service uses to access. /// /// /// ETag of the certificate. @@ -258,35 +214,32 @@ public partial interface IDpsCertificateOperations /// /// Provisioning service name. /// - /// + /// /// Common Name for the certificate. /// - /// + /// /// Raw data of certificate. /// - /// - /// Indicates if the certificate has been verified by owner of the - /// private key. + /// + /// Indicates if the certificate has been verified by owner of the private key. /// - /// - /// Describe the purpose of the certificate. Possible values include: - /// 'clientAuthentication', 'serverAuthentication' + /// + /// Describe the purpose of the certificate. /// - /// + /// /// Certificate creation time. /// - /// + /// /// Certificate last updated time. /// - /// + /// /// Indicates if the certificate contains private key. /// - /// + /// /// Random number generated to indicate Proof of Possession. /// - /// - /// base-64 representation of X509 certificate .cer file or just .pem - /// file content. + /// + /// The name of the certificate /// /// /// The headers that will be added to request. @@ -294,15 +247,13 @@ public partial interface IDpsCertificateOperations /// /// 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> 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)); + System.Threading.Tasks.Task> VerifyCertificateWithHttpMessagesAsync(string certificateName, string ifMatch, string resourceGroupName, string provisioningServiceName, VerificationCodeRequest request, string certificateName1 = default(string), byte[] certificateRawBytes = default(byte[]), bool? certificateIsVerified = default(bool?), string certificatePurpose = default(string), System.DateTimeOffset? certificateCreated = default(System.DateTimeOffset?), System.DateTimeOffset? certificateLastUpdated = default(System.DateTimeOffset?), bool? certificateHasPrivateKey = default(bool?), string certificateNonce = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IDpsCertificatesOperations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IDpsCertificatesOperations.cs new file mode 100644 index 000000000000..e861b7f4af6e --- /dev/null +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IDpsCertificatesOperations.cs @@ -0,0 +1,43 @@ +// 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.Azure; + using Models; + + /// + /// DpsCertificatesOperations operations. + /// + public partial interface IDpsCertificatesOperations + { + /// + /// Get all the certificates tied to the provisioning service. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> ListWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsClient.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsClient.cs index c8d8617c8462..5af258afbe31 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsClient.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsClient.cs @@ -1,24 +1,18 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices { using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using Newtonsoft.Json; /// /// API for using the Azure IoT Hub Device Provisioning Service features. /// - public partial interface IIotDpsClient : System.IDisposable + public partial interface IIotDpsClient : System.IDisposable { /// /// The base URI of the service. @@ -28,61 +22,71 @@ public partial interface IIotDpsClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - JsonSerializerSettings SerializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - JsonSerializerSettings DeserializationSettings { get; } + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - ServiceClientCredentials Credentials { get; } + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + /// - /// The subscription identifier. + /// The API version to use for this operation. /// - string SubscriptionId { get; set; } + string ApiVersion { get;} + /// - /// The version of the API. + /// The subscription identifier. /// - string ApiVersion { get; } + string SubscriptionId { get; set;} + /// /// The preferred language for the response. /// - string AcceptLanguage { get; set; } + string AcceptLanguage { get; set;} + /// /// The retry timeout in seconds for Long Running Operations. Default - /// value is 30. + /// /// value is 30. /// - int? LongRunningOperationRetryTimeout { get; set; } + int? LongRunningOperationRetryTimeout { get; set;} + /// /// 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. + /// /// 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; } + bool? GenerateClientRequestId { get; set;} /// - /// Gets the IOperations. + /// Gets the IOperations /// IOperations Operations { get; } /// - /// Gets the IDpsCertificateOperations. + /// Gets the IDpsCertificateOperations /// IDpsCertificateOperations DpsCertificate { get; } /// - /// Gets the IIotDpsResourceOperations. + /// Gets the IIotDpsResourceOperations /// IIotDpsResourceOperations IotDpsResource { get; } + /// + /// Gets the IDpsCertificatesOperations + /// + IDpsCertificatesOperations DpsCertificates { get; } + } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsResourceOperations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsResourceOperations.cs index 82ef61e6e9c4..60b540360ae9 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsResourceOperations.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IIotDpsResourceOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. 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; /// /// IotDpsResourceOperations operations. @@ -24,7 +14,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices public partial interface IIotDpsResourceOperations { /// - /// Get the non-security related metadata of the provisioning service. + /// Get the metadata of the provisioning service without SAS keys. /// /// /// Get the metadata of the provisioning service without SAS keys. @@ -41,25 +31,25 @@ public partial interface IIotDpsResourceOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. /// /// - /// 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. + /// 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. @@ -76,22 +66,21 @@ public partial interface IIotDpsResourceOperations /// /// 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Update an existing provisioning service's tags. + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method /// /// - /// Update an existing provisioning service's tags. to update other - /// fields use the CreateOrUpdate method + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method /// /// /// Resource group identifier. @@ -99,8 +88,8 @@ public partial interface IIotDpsResourceOperations /// /// Name of provisioning service to create or update. /// - /// - /// Resource tags + /// + /// Updated tag information to set into the provisioning service instance. /// /// /// The headers that will be added to request. @@ -114,12 +103,10 @@ public partial interface IIotDpsResourceOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Delete the Provisioning Service + /// Deletes the Provisioning Service. /// /// /// Deletes the Provisioning Service. @@ -136,15 +123,13 @@ public partial interface IIotDpsResourceOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get all the provisioning services in a subscription. + /// List all the provisioning services for a given subscription id. /// /// /// List all the provisioning services for a given subscription id. @@ -155,20 +140,20 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get a list of all provisioning services in the given resource - /// group. + /// Get a list of all provisioning services in the given resource group. /// + /// + /// Get a list of all provisioning services in the given resource group. + /// /// /// Resource group identifier. /// @@ -178,23 +163,25 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Gets the status of a long running operation, such as create, update - /// or delete a provisioning service. + /// Gets the status of a long running operation, such as create, update or + /// delete a provisioning service. /// + /// + /// Gets the status of a long running operation, such as create, update or + /// delete a provisioning service. + /// /// - /// Operation id corresponding to long running operation. Use this to - /// poll for the status. + /// Operation id corresponding to long running operation. Use this to poll for + /// the status. /// /// /// Resource group identifier. @@ -203,8 +190,8 @@ public partial interface IIotDpsResourceOperations /// Name of provisioning service that the operation is running on. /// /// - /// Async header used to poll on the status of the operation, obtained - /// while creating the long running operation. + /// Async header used to poll on the status of the operation, obtained while + /// creating the long running operation. /// /// /// The headers that will be added to request. @@ -212,18 +199,16 @@ public partial interface IIotDpsResourceOperations /// /// 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> GetOperationResultWithHttpMessagesAsync(string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> GetOperationResultWithHttpMessagesAsync(string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get the list of valid SKUs for a provisioning service. + /// Gets the list of valid SKUs and tiers for a provisioning service. /// /// /// Gets the list of valid SKUs and tiers for a provisioning service. @@ -240,26 +225,25 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListValidSkusWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListValidSkusWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Check if a provisioning service name is available. + /// Check if a provisioning service name is available. This will validate if + /// the name is syntactically valid and if the name is usable /// /// - /// Check if a provisioning service name is available. This will - /// validate if the name is syntactically valid and if the name is - /// usable + /// Check if a provisioning service name is available. This will validate if + /// the name is syntactically valid and if the name is usable /// - /// - /// The name of the Provisioning Service to check. + /// + /// Set the name parameter in the OperationInputs structure to the name of the + /// provisioning service to check. /// /// /// The headers that will be added to request. @@ -267,18 +251,16 @@ public partial interface IIotDpsResourceOperations /// /// 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> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(OperationInputs arguments, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get the security metadata for a provisioning service. + /// List the primary and secondary keys for a provisioning service. /// /// /// List the primary and secondary keys for a provisioning service. @@ -295,18 +277,16 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListKeysWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListKeysWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get a shared access policy by name from a provisioning service. + /// List primary and secondary keys for a specific key name /// /// /// List primary and secondary keys for a specific key name @@ -318,8 +298,7 @@ public partial interface IIotDpsResourceOperations /// Logical key name to get key-values for. /// /// - /// The name of the resource group that contains the provisioning - /// service. + /// The name of the resource group that contains the provisioning service. /// /// /// The headers that will be added to request. @@ -327,25 +306,25 @@ public partial interface IIotDpsResourceOperations /// /// 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> ListKeysForKeyNameWithHttpMessagesAsync(string provisioningServiceName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> ListKeysForKeyNameWithHttpMessagesAsync(string provisioningServiceName, string keyName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// 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. /// /// - /// 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. + /// 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. @@ -362,22 +341,21 @@ public partial interface IIotDpsResourceOperations /// /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Update an existing provisioning service's tags. + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method /// /// - /// Update an existing provisioning service's tags. to update other - /// fields use the CreateOrUpdate method + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method /// /// /// Resource group identifier. @@ -385,8 +363,8 @@ public partial interface IIotDpsResourceOperations /// /// Name of provisioning service to create or update. /// - /// - /// Resource tags + /// + /// Updated tag information to set into the provisioning service instance. /// /// /// The headers that will be added to request. @@ -400,12 +378,10 @@ public partial interface IIotDpsResourceOperations /// /// Thrown when unable to deserialize the response /// - /// - /// Thrown when a required parameter is null - /// - Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Delete the Provisioning Service + /// Deletes the Provisioning Service. /// /// /// Deletes the Provisioning Service. @@ -422,15 +398,13 @@ public partial interface IIotDpsResourceOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get all the provisioning services in a subscription. + /// List all the provisioning services for a given subscription id. /// /// /// List all the provisioning services for a given subscription id. @@ -444,20 +418,20 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get a list of all provisioning services in the given resource - /// group. + /// Get a list of all provisioning services in the given resource group. /// + /// + /// Get a list of all provisioning services in the given resource group. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -467,18 +441,16 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get the list of valid SKUs for a provisioning service. + /// Gets the list of valid SKUs and tiers for a provisioning service. /// /// /// Gets the list of valid SKUs and tiers for a provisioning service. @@ -492,18 +464,16 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListValidSkusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListValidSkusNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// - /// Get the security metadata for a provisioning service. + /// List the primary and secondary keys for a provisioning service. /// /// /// List the primary and secondary keys for a provisioning service. @@ -517,15 +487,13 @@ public partial interface IIotDpsResourceOperations /// /// 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>> ListKeysNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListKeysNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IOperations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IOperations.cs index 4ffca0bd4ec3..c09c8c17ce6f 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IOperations.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IOperations.cs @@ -1,22 +1,12 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. 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; /// /// Operations operations. @@ -26,25 +16,29 @@ public partial interface IOperations /// /// Lists all of the available Microsoft.Devices REST API operations. /// + /// + /// Lists all of the available Microsoft.Devices REST API operations. + /// /// /// 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(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Lists all of the available Microsoft.Devices REST API operations. /// + /// + /// Lists all of the available Microsoft.Devices REST API operations. + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -54,15 +48,13 @@ public partial interface IOperations /// /// 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>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsClient.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsClient.cs index d109c80199ba..5a6bf95d5d13 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsClient.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsClient.cs @@ -1,94 +1,81 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices { + using System.Linq; using Microsoft.Rest; using Microsoft.Rest.Azure; - using Microsoft.Rest.Serialization; using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Net; - using System.Net.Http; /// /// API for using the Azure IoT Hub Device Provisioning Service features. /// - public partial class IotDpsClient : ServiceClient, IIotDpsClient, IAzureClient + public partial class IotDpsClient : Microsoft.Rest.ServiceClient, IIotDpsClient, IAzureClient { /// /// The base URI of the service. /// public System.Uri BaseUri { get; set; } - /// /// Gets or sets json serialization settings. /// - public JsonSerializerSettings SerializationSettings { get; private set; } - + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } /// /// Gets or sets json deserialization settings. /// - public JsonSerializerSettings DeserializationSettings { get; private set; } - + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } /// /// Credentials needed for the client to connect to Azure. /// - public ServiceClientCredentials Credentials { get; private set; } + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } /// - /// The subscription identifier. + /// The API version to use for this operation. /// - public string SubscriptionId { get; set; } + public string ApiVersion { get; private set; } /// - /// The version of the API. + /// The subscription identifier. /// - public string ApiVersion { get; private set; } + public string SubscriptionId { get; set;} /// /// The preferred language for the response. /// - public string AcceptLanguage { get; set; } + public string AcceptLanguage { get; set;} /// - /// 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; } + public int? LongRunningOperationRetryTimeout { get; set;} /// - /// 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. + /// 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; } + public bool? GenerateClientRequestId { get; set;} /// - /// Gets the IOperations. + /// Gets the IOperations /// public virtual IOperations Operations { get; private set; } - /// - /// Gets the IDpsCertificateOperations. + /// Gets the IDpsCertificateOperations /// public virtual IDpsCertificateOperations DpsCertificate { get; private set; } - /// - /// Gets the IIotDpsResourceOperations. + /// Gets the IIotDpsResourceOperations /// public virtual IIotDpsResourceOperations IotDpsResource { get; private set; } - + /// + /// Gets the IDpsCertificatesOperations + /// + public virtual IDpsCertificatesOperations DpsCertificates { get; private set; } /// /// Initializes a new instance of the IotDpsClient class. /// @@ -97,24 +84,22 @@ public partial class IotDpsClient : ServiceClient, IIotDpsClient, /// /// /// 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) + protected IotDpsClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the IotDpsClient class. /// /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected IotDpsClient(params DelegatingHandler[] handlers) : base(handlers) + protected IotDpsClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) { - Initialize(); + this.Initialize(); } - /// - /// Initializes a new instance of the IotDpsClient class. + /// Initializes a new instance of the IotDpsClient class. /// /// /// Optional. The http client handler used to handle http transport. @@ -122,11 +107,10 @@ protected IotDpsClient(params DelegatingHandler[] handlers) : base(handlers) /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected IotDpsClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected IotDpsClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) { - Initialize(); + this.Initialize(); } - /// /// Initializes a new instance of the IotDpsClient class. /// @@ -139,15 +123,14 @@ protected IotDpsClient(HttpClientHandler rootHandler, params DelegatingHandler[] /// /// Thrown when a required parameter is null /// - protected IotDpsClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) + protected IotDpsClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the IotDpsClient class. /// @@ -163,15 +146,15 @@ protected IotDpsClient(System.Uri baseUri, params DelegatingHandler[] handlers) /// /// Thrown when a required parameter is null /// - protected IotDpsClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected IotDpsClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - BaseUri = baseUri; + + this.BaseUri = baseUri; } - /// /// Initializes a new instance of the IotDpsClient class. /// @@ -184,23 +167,23 @@ protected IotDpsClient(System.Uri baseUri, HttpClientHandler rootHandler, params /// /// Thrown when a required parameter is null /// - public IotDpsClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public IotDpsClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the IotDpsClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -211,23 +194,23 @@ public IotDpsClient(ServiceClientCredentials credentials, params DelegatingHandl /// /// Thrown when a required parameter is null /// - public IotDpsClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + public IotDpsClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the IotDpsClient class. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -239,26 +222,26 @@ public IotDpsClient(ServiceClientCredentials credentials, HttpClient httpClient, /// /// Thrown when a required parameter is null /// - public IotDpsClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public IotDpsClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (credentials == null) { throw new System.ArgumentNullException("credentials"); } - Credentials = credentials; - if (Credentials != null) + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the IotDpsClient class. /// /// /// Optional. The base URI of the service. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// @@ -267,7 +250,7 @@ public IotDpsClient(ServiceClientCredentials credentials, HttpClientHandler root /// /// Thrown when a required parameter is null /// - public IotDpsClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) + public IotDpsClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -277,33 +260,30 @@ public IotDpsClient(System.Uri baseUri, ServiceClientCredentials credentials, pa { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// Initializes a new instance of the IotDpsClient class. /// /// /// Optional. The base URI of the service. /// - /// + /// /// Required. Credentials needed for the client to connect to Azure. /// /// /// Optional. The http client handler used to handle http transport. /// - /// - /// Optional. The delegating handlers to add to the http client pipeline. - /// /// /// Thrown when a required parameter is null /// - public IotDpsClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) + public IotDpsClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -313,58 +293,60 @@ public IotDpsClient(System.Uri baseUri, ServiceClientCredentials credentials, Ht { throw new System.ArgumentNullException("credentials"); } - BaseUri = baseUri; - Credentials = credentials; - if (Credentials != null) + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) { - Credentials.InitializeServiceClient(this); + this.Credentials.InitializeServiceClient(this); } + } - /// /// An optional partial-method to perform custom initialization. /// partial void CustomInitialize(); + /// /// Initializes client properties. /// private void Initialize() { - Operations = new Operations(this); - DpsCertificate = new DpsCertificateOperations(this); - IotDpsResource = new IotDpsResourceOperations(this); - BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2017-11-15"; - AcceptLanguage = "en-US"; - LongRunningOperationRetryTimeout = 30; - GenerateClientRequestId = true; - SerializationSettings = new JsonSerializerSettings + this.Operations = new Operations(this); + this.DpsCertificate = new DpsCertificateOperations(this); + this.IotDpsResource = new IotDpsResourceOperations(this); + this.DpsCertificates = new DpsCertificatesOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.ApiVersion = "2017-11-15"; + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; - DeserializationSettings = new JsonSerializerSettings + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, - ContractResolver = new ReadOnlyJsonContractResolver(), - Converters = new List + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List { - new Iso8601TimeSpanConverter() + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() } }; CustomInitialize(); - DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperations.cs index ab861d80033e..00be9f60212d 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperations.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices { + using System.Linq; 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; /// /// IotDpsResourceOperations operations. /// - internal partial class IotDpsResourceOperations : IServiceOperations, IIotDpsResourceOperations + internal partial class IotDpsResourceOperations : Microsoft.Rest.IServiceOperations, IIotDpsResourceOperations { /// /// Initializes a new instance of the IotDpsResourceOperations class. @@ -36,13 +24,13 @@ internal partial class IotDpsResourceOperations : IServiceOperations /// Thrown when a required parameter is null /// - internal IotDpsResourceOperations(IotDpsClient client) + internal IotDpsResourceOperations (IotDpsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -51,11 +39,8 @@ internal IotDpsResourceOperations(IotDpsClient client) public IotDpsClient Client { get; private set; } /// - /// Get the non-security related metadata of the provisioning service. - /// - /// /// Get the metadata of the provisioning service without SAS keys. - /// + /// /// /// Name of the provisioning service to retrieve. /// @@ -68,13 +53,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -83,71 +68,82 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("resourceGroupName", resourceGroupName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -159,50 +155,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -212,9 +209,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -225,34 +223,35 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// 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. /// @@ -263,53 +262,47 @@ internal IotDpsResourceOperations(IotDpsClient client) /// Description of the provisioning service to create or update. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Update an existing provisioning service's tags. - /// - /// - /// Update an existing provisioning service's tags. to update other fields use + /// 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 + /// + /// Updated tag information to set into the provisioning service instance. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, tags, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Delete the Provisioning Service - /// - /// /// Deletes the Provisioning Service. - /// + /// /// /// Name of provisioning service to delete. /// @@ -317,37 +310,34 @@ internal IotDpsResourceOperations(IotDpsClient client) /// Resource group identifier. /// /// - /// The headers that will be added to request. + /// Headers that will be added to request. /// /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// - /// Get all the provisioning services in a subscription. - /// - /// /// List all the provisioning services for a given subscription id. - /// + /// /// /// 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 /// /// @@ -356,59 +346,68 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -420,50 +419,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -473,9 +473,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -486,25 +487,29 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get a list of all provisioning services in the given resource group. /// @@ -517,13 +522,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -532,65 +537,75 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -602,50 +617,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -655,9 +671,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -668,25 +685,29 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Gets the status of a long running operation, such as create, update or /// delete a provisioning service. @@ -711,13 +732,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -726,86 +747,99 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetOperationResultWithHttpMessagesAsync(string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> GetOperationResultWithHttpMessagesAsync(string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (operationId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "operationId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "operationId"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } + if (asyncinfo == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "asyncinfo"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "asyncinfo"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("operationId", operationId); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("asyncinfo", asyncinfo); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetOperationResult", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetOperationResult", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}").ToString(); _url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); if (asyncinfo != null) { _queryParameters.Add(string.Format("asyncinfo={0}", System.Uri.EscapeDataString(asyncinfo))); } - if (Client.ApiVersion != null) + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -817,50 +851,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -870,9 +905,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -883,31 +919,32 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Get the list of valid SKUs for a provisioning service. - /// - /// /// Gets the list of valid SKUs and tiers for a provisioning service. - /// + /// /// /// Name of provisioning service. /// @@ -920,13 +957,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -935,71 +972,82 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListValidSkusWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListValidSkusWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("resourceGroupName", resourceGroupName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListValidSkus", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListValidSkus", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus").ToString(); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1011,50 +1059,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1064,9 +1113,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1077,34 +1127,36 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Check if a provisioning service name is available. - /// - /// /// Check if a provisioning service name is available. This will validate if /// the name is syntactically valid and if the name is usable - /// - /// - /// The name of the Provisioning Service to check. + /// + /// + /// Set the name parameter in the OperationInputs structure to the name of the + /// provisioning service to check. /// /// /// Headers that will be added to request. @@ -1112,13 +1164,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -1127,69 +1179,77 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(OperationInputs arguments, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (arguments == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "arguments"); } - if (Client.ApiVersion == null) + if (arguments != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + arguments.Validate(); } - if (name == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - OperationInputs arguments = new OperationInputs(); - if (name != null) + + if (this.Client.ApiVersion == null) { - arguments.Name = name; + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("arguments", arguments); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CheckProvisioningServiceNameAvailability", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CheckProvisioningServiceNameAvailability", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1201,56 +1261,57 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; if(arguments != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(arguments, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(arguments, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1260,9 +1321,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1273,31 +1335,32 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Get the security metadata for a provisioning service. - /// - /// /// List the primary and secondary keys for a provisioning service. - /// + /// /// /// The provisioning service name to get the shared access keys for. /// @@ -1310,13 +1373,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -1325,71 +1388,82 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListKeysWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListKeysWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("resourceGroupName", resourceGroupName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListKeys", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys").ToString(); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1401,50 +1475,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1454,9 +1529,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1467,31 +1543,32 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Get a shared access policy by name from a provisioning service. - /// - /// /// List primary and secondary keys for a specific key name - /// + /// /// /// Name of the provisioning service. /// @@ -1507,13 +1584,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -1522,77 +1599,89 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task> ListKeysForKeyNameWithHttpMessagesAsync(string provisioningServiceName, string keyName, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task> ListKeysForKeyNameWithHttpMessagesAsync(string provisioningServiceName, string keyName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } + if (keyName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "keyName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "keyName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("keyName", keyName); tracingParameters.Add("resourceGroupName", resourceGroupName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListKeysForKeyName", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListKeysForKeyName", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys").ToString(); _url = _url.Replace("{provisioningServiceName}", System.Uri.EscapeDataString(provisioningServiceName)); _url = _url.Replace("{keyName}", System.Uri.EscapeDataString(keyName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1604,50 +1693,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1657,9 +1747,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1670,34 +1761,35 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// 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. /// @@ -1713,13 +1805,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -1728,80 +1820,91 @@ 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 System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (iotDpsDescription == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "iotDpsDescription"); } - if (resourceGroupName == null) + if (iotDpsDescription != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + iotDpsDescription.Validate(); } - if (provisioningServiceName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (iotDpsDescription == null) + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "iotDpsDescription"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (iotDpsDescription != null) + + if (provisioningServiceName == null) { - iotDpsDescription.Validate(); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("iotDpsDescription", iotDpsDescription); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -1813,56 +1916,57 @@ internal IotDpsResourceOperations(IotDpsClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(iotDpsDescription, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1872,9 +1976,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -1885,16 +1990,16 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } // Deserialize Response @@ -1903,40 +2008,41 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.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 + /// 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 + /// + /// Updated tag information to set into the provisioning service instance. /// /// /// Headers that will be added to request. @@ -1944,13 +2050,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -1959,77 +2065,87 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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)) + public async System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.SubscriptionId == null) + + + + + if (provisioningServiceTags == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceTags"); } - if (resourceGroupName == null) + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - if (provisioningServiceName == null) + + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - TagsResource provisioningServiceTags = new TagsResource(); - if (tags != null) + + if (this.Client.ApiVersion == null) { - provisioningServiceTags.Tags = tags; + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("provisioningServiceName", provisioningServiceName); + tracingParameters.Add("provisioningServiceTags", provisioningServiceTags); + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.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) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2041,61 +2157,62 @@ internal IotDpsResourceOperations(IotDpsClient client) _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); + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(provisioningServiceTags, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.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) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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)); + var ex = new Microsoft.Rest.Azure.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); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.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); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2105,9 +2222,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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(); @@ -2118,31 +2236,32 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Delete the Provisioning Service - /// - /// /// Deletes the Provisioning Service. - /// + /// /// /// Name of provisioning service to delete. /// @@ -2155,10 +2274,10 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// - /// + /// /// Thrown when a required parameter is null /// /// @@ -2167,71 +2286,82 @@ 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string provisioningServiceName, string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + + + + if (provisioningServiceName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "provisioningServiceName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "provisioningServiceName"); } - if (Client.SubscriptionId == null) + + if (this.Client.SubscriptionId == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (resourceGroupName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); } - if (Client.ApiVersion == null) + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("provisioningServiceName", provisioningServiceName); tracingParameters.Add("resourceGroupName", resourceGroupName); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.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("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2243,50 +2373,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2296,26 +2427,28 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new Microsoft.Rest.Azure.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); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Get all the provisioning services in a subscription. - /// - /// /// List all the provisioning services for a given subscription id. - /// + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -2325,13 +2458,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -2340,51 +2473,54 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); 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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2396,50 +2532,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2449,9 +2586,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -2462,25 +2600,29 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Get a list of all provisioning services in the given resource group. /// @@ -2493,13 +2635,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -2508,51 +2650,54 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); 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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2564,50 +2709,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2617,9 +2763,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -2630,31 +2777,32 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Get the list of valid SKUs for a provisioning service. - /// - /// /// Gets the list of valid SKUs and tiers for a provisioning service. - /// + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -2664,13 +2812,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -2679,51 +2827,54 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListValidSkusNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListValidSkusNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListValidSkusNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListValidSkusNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); 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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2735,50 +2886,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2788,9 +2940,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -2801,31 +2954,32 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// - /// Get the security metadata for a provisioning service. - /// - /// /// List the primary and secondary keys for a provisioning service. - /// + /// /// /// The NextLink from the previous successful call to List operation. /// @@ -2835,13 +2989,13 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// 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 /// /// @@ -2850,51 +3004,54 @@ internal IotDpsResourceOperations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListKeysNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListKeysNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListKeysNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListKeysNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); 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("POST"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -2906,50 +3063,51 @@ internal IotDpsResourceOperations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2959,9 +3117,10 @@ internal IotDpsResourceOperations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -2972,24 +3131,28 @@ internal IotDpsResourceOperations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperationsExtensions.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperationsExtensions.cs index 2abc0346cd5d..f37035338726 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperationsExtensions.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/IotDpsResourceOperationsExtensions.cs @@ -1,849 +1,700 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. 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; /// - /// Extension methods for IotDpsResourceOperations. + /// Extension methods for IotDpsResourceOperations /// public static partial class IotDpsResourceOperationsExtensions { - /// - /// Get the non-security related metadata of the provisioning service. - /// - /// - /// Get the metadata of the provisioning service without SAS keys. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the provisioning service to retrieve. - /// - /// - /// Resource group name. - /// - public static ProvisioningServiceDescription Get(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) - { - return operations.GetAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get the non-security related metadata of the provisioning service. - /// - /// - /// Get the metadata of the provisioning service without SAS keys. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the provisioning service to retrieve. - /// - /// - /// Resource group name. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Description of the provisioning service to create or update. - /// - public static ProvisioningServiceDescription CreateOrUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription) - { - return operations.CreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Description of the provisioning service to create or update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update an existing provisioning service's tags. - /// - /// - /// Update an existing provisioning service's tags. to update other fields use - /// the CreateOrUpdate method - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Resource tags - /// - public static ProvisioningServiceDescription Update(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary)) - { - return operations.UpdateAsync(resourceGroupName, provisioningServiceName, tags).GetAwaiter().GetResult(); - } - - /// - /// Update an existing provisioning service's tags. - /// - /// - /// Update an existing provisioning service's tags. to update other fields use - /// the CreateOrUpdate method - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Resource tags - /// - /// - /// The cancellation token. - /// - 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, tags, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete the Provisioning Service - /// - /// - /// Deletes the Provisioning Service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of provisioning service to delete. - /// - /// - /// Resource group identifier. - /// - public static void Delete(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) - { - operations.DeleteAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Delete the Provisioning Service - /// - /// - /// Deletes the Provisioning Service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of provisioning service to delete. - /// - /// - /// Resource group identifier. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Get all the provisioning services in a subscription. - /// - /// - /// List all the provisioning services for a given subscription id. - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListBySubscription(this IIotDpsResourceOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Get all the provisioning services in a subscription. - /// - /// - /// List all the provisioning services for a given subscription id. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IIotDpsResourceOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a list of all provisioning services in the given resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - public static IPage ListByResourceGroup(this IIotDpsResourceOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get a list of all provisioning services in the given resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IIotDpsResourceOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the status of a long running operation, such as create, update or - /// delete a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Operation id corresponding to long running operation. Use this to poll for - /// the status. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service that the operation is running on. - /// - /// - /// Async header used to poll on the status of the operation, obtained while - /// creating the long running operation. - /// - public static AsyncOperationResult GetOperationResult(this IIotDpsResourceOperations operations, string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo) - { - return operations.GetOperationResultAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).GetAwaiter().GetResult(); - } - - /// - /// Gets the status of a long running operation, such as create, update or - /// delete a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Operation id corresponding to long running operation. Use this to poll for - /// the status. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service that the operation is running on. - /// - /// - /// Async header used to poll on the status of the operation, obtained while - /// creating the long running operation. - /// - /// - /// The cancellation token. - /// - public static async Task GetOperationResultAsync(this IIotDpsResourceOperations operations, string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetOperationResultWithHttpMessagesAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get the list of valid SKUs for a provisioning service. - /// - /// - /// Gets the list of valid SKUs and tiers for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of provisioning service. - /// - /// - /// Name of resource group. - /// - public static IPage ListValidSkus(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) - { - return operations.ListValidSkusAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get the list of valid SKUs for a provisioning service. - /// - /// - /// Gets the list of valid SKUs and tiers for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of provisioning service. - /// - /// - /// Name of resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListValidSkusAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListValidSkusWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Check if a provisioning service name is available. - /// - /// - /// Check if a provisioning service name is available. This will validate if - /// the name is syntactically valid and if the name is usable - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Provisioning Service to check. - /// - public static NameAvailabilityInfo CheckProvisioningServiceNameAvailability(this IIotDpsResourceOperations operations, string name) - { - return operations.CheckProvisioningServiceNameAvailabilityAsync(name).GetAwaiter().GetResult(); - } - - /// - /// Check if a provisioning service name is available. - /// - /// - /// Check if a provisioning service name is available. This will validate if - /// the name is syntactically valid and if the name is usable - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the Provisioning Service to check. - /// - /// - /// The cancellation token. - /// - public static async Task CheckProvisioningServiceNameAvailabilityAsync(this IIotDpsResourceOperations operations, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get the security metadata for a provisioning service. - /// - /// - /// List the primary and secondary keys for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The provisioning service name to get the shared access keys for. - /// - /// - /// resource group name - /// - public static IPage ListKeys(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) - { - return operations.ListKeysAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get the security metadata for a provisioning service. - /// - /// - /// List the primary and secondary keys for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The provisioning service name to get the shared access keys for. - /// - /// - /// resource group name - /// - /// - /// The cancellation token. - /// - public static async Task> ListKeysAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListKeysWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a shared access policy by name from a provisioning service. - /// - /// - /// List primary and secondary keys for a specific key name - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the provisioning service. - /// - /// - /// Logical key name to get key-values for. - /// - /// - /// The name of the resource group that contains the provisioning service. - /// - public static SharedAccessSignatureAuthorizationRuleAccessRightsDescription ListKeysForKeyName(this IIotDpsResourceOperations operations, string provisioningServiceName, string keyName, string resourceGroupName) - { - return operations.ListKeysForKeyNameAsync(provisioningServiceName, keyName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get a shared access policy by name from a provisioning service. - /// - /// - /// List primary and secondary keys for a specific key name - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of the provisioning service. - /// - /// - /// Logical key name to get key-values for. - /// - /// - /// The name of the resource group that contains the provisioning service. - /// - /// - /// The cancellation token. - /// - public static async Task ListKeysForKeyNameAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string keyName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListKeysForKeyNameWithHttpMessagesAsync(provisioningServiceName, keyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Description of the provisioning service to create or update. - /// - public static ProvisioningServiceDescription BeginCreateOrUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).GetAwaiter().GetResult(); - } - - /// - /// 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. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Description of the provisioning service to create or update. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update an existing provisioning service's tags. - /// - /// - /// Update an existing provisioning service's tags. to update other fields use - /// the CreateOrUpdate method - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Resource tags - /// - public static ProvisioningServiceDescription BeginUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, IDictionary tags = default(IDictionary)) - { - return operations.BeginUpdateAsync(resourceGroupName, provisioningServiceName, tags).GetAwaiter().GetResult(); - } - - /// - /// Update an existing provisioning service's tags. - /// - /// - /// Update an existing provisioning service's tags. to update other fields use - /// the CreateOrUpdate method - /// - /// - /// The operations group for this extension method. - /// - /// - /// Resource group identifier. - /// - /// - /// Name of provisioning service to create or update. - /// - /// - /// Resource tags - /// - /// - /// The cancellation token. - /// - 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, tags, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete the Provisioning Service - /// - /// - /// Deletes the Provisioning Service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of provisioning service to delete. - /// - /// - /// Resource group identifier. - /// - public static void BeginDelete(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) - { - operations.BeginDeleteAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Delete the Provisioning Service - /// - /// - /// Deletes the Provisioning Service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// Name of provisioning service to delete. - /// - /// - /// Resource group identifier. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Get all the provisioning services in a subscription. - /// - /// - /// List all the provisioning services for a given subscription id. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this IIotDpsResourceOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get all the provisioning services in a subscription. - /// - /// - /// List all the provisioning services for a given subscription id. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a list of all provisioning services in the given resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IIotDpsResourceOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get a list of all provisioning services in the given resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get the list of valid SKUs for a provisioning service. - /// - /// - /// Gets the list of valid SKUs and tiers for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListValidSkusNext(this IIotDpsResourceOperations operations, string nextPageLink) - { - return operations.ListValidSkusNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get the list of valid SKUs for a provisioning service. - /// - /// - /// Gets the list of valid SKUs and tiers for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListValidSkusNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListValidSkusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get the security metadata for a provisioning service. - /// - /// - /// List the primary and secondary keys for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListKeysNext(this IIotDpsResourceOperations operations, string nextPageLink) - { - return operations.ListKeysNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Get the security metadata for a provisioning service. - /// - /// - /// List the primary and secondary keys for a provisioning service. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListKeysNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListKeysNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service to retrieve. + /// + /// + /// Resource group name. + /// + public static ProvisioningServiceDescription Get(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + return ((IIotDpsResourceOperations)operations).GetAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get the metadata of the provisioning service without SAS keys. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service to retrieve. + /// + /// + /// Resource group name. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + public static ProvisioningServiceDescription CreateOrUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription) + { + return ((IIotDpsResourceOperations)operations).CreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + public static ProvisioningServiceDescription Update(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags) + { + return ((IIotDpsResourceOperations)operations).UpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).GetAwaiter().GetResult(); + } + + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + public static void Delete(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + ((IIotDpsResourceOperations)operations).DeleteAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscription(this IIotDpsResourceOperations operations) + { + return ((IIotDpsResourceOperations)operations).ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this IIotDpsResourceOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get a list of all provisioning services in the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IIotDpsResourceOperations operations, string resourceGroupName) + { + return ((IIotDpsResourceOperations)operations).ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all provisioning services in the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this IIotDpsResourceOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the status of a long running operation, such as create, update or + /// delete a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Operation id corresponding to long running operation. Use this to poll for + /// the status. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service that the operation is running on. + /// + /// + /// Async header used to poll on the status of the operation, obtained while + /// creating the long running operation. + /// + public static AsyncOperationResult GetOperationResult(this IIotDpsResourceOperations operations, string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo) + { + return ((IIotDpsResourceOperations)operations).GetOperationResultAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo).GetAwaiter().GetResult(); + } + + /// + /// Gets the status of a long running operation, such as create, update or + /// delete a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Operation id corresponding to long running operation. Use this to poll for + /// the status. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service that the operation is running on. + /// + /// + /// Async header used to poll on the status of the operation, obtained while + /// creating the long running operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetOperationResultAsync(this IIotDpsResourceOperations operations, string operationId, string resourceGroupName, string provisioningServiceName, string asyncinfo, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetOperationResultWithHttpMessagesAsync(operationId, resourceGroupName, provisioningServiceName, asyncinfo, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service. + /// + /// + /// Name of resource group. + /// + public static Microsoft.Rest.Azure.IPage ListValidSkus(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + return ((IIotDpsResourceOperations)operations).ListValidSkusAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service. + /// + /// + /// Name of resource group. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListValidSkusAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListValidSkusWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Check if a provisioning service name is available. This will validate if + /// the name is syntactically valid and if the name is usable + /// + /// + /// The operations group for this extension method. + /// + public static NameAvailabilityInfo CheckProvisioningServiceNameAvailability(this IIotDpsResourceOperations operations, OperationInputs arguments) + { + return ((IIotDpsResourceOperations)operations).CheckProvisioningServiceNameAvailabilityAsync(arguments).GetAwaiter().GetResult(); + } + + /// + /// Check if a provisioning service name is available. This will validate if + /// the name is syntactically valid and if the name is usable + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CheckProvisioningServiceNameAvailabilityAsync(this IIotDpsResourceOperations operations, OperationInputs arguments, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CheckProvisioningServiceNameAvailabilityWithHttpMessagesAsync(arguments, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The provisioning service name to get the shared access keys for. + /// + /// + /// resource group name + /// + public static Microsoft.Rest.Azure.IPage ListKeys(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + return ((IIotDpsResourceOperations)operations).ListKeysAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The provisioning service name to get the shared access keys for. + /// + /// + /// resource group name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListKeysAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListKeysWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List primary and secondary keys for a specific key name + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service. + /// + /// + /// Logical key name to get key-values for. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + public static SharedAccessSignatureAuthorizationRuleAccessRightsDescription ListKeysForKeyName(this IIotDpsResourceOperations operations, string provisioningServiceName, string keyName, string resourceGroupName) + { + return ((IIotDpsResourceOperations)operations).ListKeysForKeyNameAsync(provisioningServiceName, keyName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// List primary and secondary keys for a specific key name + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of the provisioning service. + /// + /// + /// Logical key name to get key-values for. + /// + /// + /// The name of the resource group that contains the provisioning service. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListKeysForKeyNameAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string keyName, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListKeysForKeyNameWithHttpMessagesAsync(provisioningServiceName, keyName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + public static ProvisioningServiceDescription BeginCreateOrUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription) + { + return ((IIotDpsResourceOperations)operations).BeginCreateOrUpdateAsync(resourceGroupName, provisioningServiceName, iotDpsDescription).GetAwaiter().GetResult(); + } + + /// + /// 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. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, ProvisioningServiceDescription iotDpsDescription, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, iotDpsDescription, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + public static ProvisioningServiceDescription BeginUpdate(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags) + { + return ((IIotDpsResourceOperations)operations).BeginUpdateAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags).GetAwaiter().GetResult(); + } + + /// + /// Update an existing provisioning service's tags. to update other fields use + /// the CreateOrUpdate method + /// + /// + /// The operations group for this extension method. + /// + /// + /// Resource group identifier. + /// + /// + /// Name of provisioning service to create or update. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this IIotDpsResourceOperations operations, string resourceGroupName, string provisioningServiceName, TagsResource provisioningServiceTags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, provisioningServiceName, provisioningServiceTags, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + public static void BeginDelete(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName) + { + ((IIotDpsResourceOperations)operations).BeginDeleteAsync(provisioningServiceName, resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the Provisioning Service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Name of provisioning service to delete. + /// + /// + /// Resource group identifier. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IIotDpsResourceOperations operations, string provisioningServiceName, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(provisioningServiceName, resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListBySubscriptionNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return ((IIotDpsResourceOperations)operations).ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List all the provisioning services for a given subscription id. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Get a list of all provisioning services in the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return ((IIotDpsResourceOperations)operations).ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all provisioning services in the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListValidSkusNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return ((IIotDpsResourceOperations)operations).ListValidSkusNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets the list of valid SKUs and tiers for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListValidSkusNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListValidSkusNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListKeysNext(this IIotDpsResourceOperations operations, string nextPageLink) + { + return ((IIotDpsResourceOperations)operations).ListKeysNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// List the primary and secondary keys for a provisioning service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListKeysNextAsync(this IIotDpsResourceOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListKeysNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } } } diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AccessRightsDescription.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AccessRightsDescription.cs index 629d33aad14b..dfba8bd89582 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AccessRightsDescription.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AccessRightsDescription.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models /// /// Defines values for AccessRightsDescription. /// + + public static class AccessRightsDescription { public const string ServiceConfig = "ServiceConfig"; @@ -23,4 +20,4 @@ public static class AccessRightsDescription public const string RegistrationStatusRead = "RegistrationStatusRead"; public const string RegistrationStatusWrite = "RegistrationStatusWrite"; } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AllocationPolicy.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AllocationPolicy.cs index 869a29ddfab9..6f4ccbe3b404 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AllocationPolicy.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AllocationPolicy.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { @@ -14,10 +9,12 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models /// /// Defines values for AllocationPolicy. /// + + public static class AllocationPolicy { public const string Hashed = "Hashed"; public const string GeoLatency = "GeoLatency"; public const string Static = "Static"; } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AsyncOperationResult.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AsyncOperationResult.cs index b34925448456..90795b2f59b7 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AsyncOperationResult.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/AsyncOperationResult.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,17 @@ public AsyncOperationResult() /// /// Initializes a new instance of the AsyncOperationResult class. /// - /// current status of a long running - /// operation. - /// Error message containing code, description and - /// details + + /// current status of a long running operation. + /// + + /// Error message containing code, description and details + /// public AsyncOperationResult(string status = default(string), ErrorMesssage error = default(ErrorMesssage)) + { - Status = status; - Error = error; + this.Status = status; + this.Error = error; CustomInit(); } @@ -45,17 +42,17 @@ public AsyncOperationResult() /// partial void CustomInit(); + /// /// Gets or sets current status of a long running operation. /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "status")] + public string Status {get; set; } /// /// Gets or sets error message containing code, description and details /// - [JsonProperty(PropertyName = "error")] - public ErrorMesssage Error { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + public ErrorMesssage Error {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateBodyDescription.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateBodyDescription.cs index 9f0f9360730b..3858460445b9 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateBodyDescription.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateBodyDescription.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,14 @@ public CertificateBodyDescription() /// /// Initializes a new instance of the CertificateBodyDescription class. /// - /// Base-64 representation of the X509 leaf - /// certificate .cer file or just .pem file content. + + /// Base-64 representation of the X509 leaf certificate .cer file or just .pem + /// file content. + /// public CertificateBodyDescription(string certificate = default(string)) + { - Certificate = certificate; + this.Certificate = certificate; CustomInit(); } @@ -42,12 +39,12 @@ public CertificateBodyDescription() /// partial void CustomInit(); + /// - /// Gets or sets base-64 representation of the X509 leaf certificate - /// .cer file or just .pem file content. + /// Gets or sets base-64 representation of the X509 leaf certificate .cer file + /// or just .pem file content. /// - [JsonProperty(PropertyName = "certificate")] - public string Certificate { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "certificate")] + public string Certificate {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateListDescription.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateListDescription.cs index 4edf2dea0527..68d7bd00b7b3 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateListDescription.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateListDescription.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -31,10 +23,13 @@ public CertificateListDescription() /// /// Initializes a new instance of the CertificateListDescription class. /// - /// The array of Certificate objects. - public CertificateListDescription(IList value = default(IList)) + + /// The array of Certificate objects. + /// + public CertificateListDescription(System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + { - Value = value; + this.Value = value; CustomInit(); } @@ -43,11 +38,11 @@ public CertificateListDescription() /// partial void CustomInit(); + /// /// Gets or sets the array of Certificate objects. /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateProperties.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateProperties.cs index 7d007bb8dbe1..ea04662deb62 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateProperties.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateProperties.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; using System.Linq; /// @@ -31,24 +23,33 @@ public CertificateProperties() /// /// Initializes a new instance of the CertificateProperties class. /// - /// The certificate's subject name. - /// The certificate's expiration date and - /// time. - /// The certificate's thumbprint. - /// Determines whether certificate has been - /// verified. - /// 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?)) + + /// The certificate's subject name. + /// + + /// The certificate's expiration date and time. + /// + + /// The certificate's thumbprint. + /// + + /// Determines whether certificate has been verified. + /// + + /// The certificate's creation date and time. + /// + + /// The certificate's last update date and time. + /// + public CertificateProperties(string subject = default(string), System.DateTimeOffset? expiry = default(System.DateTimeOffset?), string thumbprint = default(string), bool? isVerified = default(bool?), System.DateTimeOffset? created = default(System.DateTimeOffset?), System.DateTimeOffset? updated = default(System.DateTimeOffset?)) + { - Subject = subject; - Expiry = expiry; - Thumbprint = thumbprint; - IsVerified = isVerified; - Created = created; - Updated = updated; + this.Subject = subject; + this.Expiry = expiry; + this.Thumbprint = thumbprint; + this.IsVerified = isVerified; + this.Created = created; + this.Updated = updated; CustomInit(); } @@ -57,44 +58,41 @@ public CertificateProperties() /// partial void CustomInit(); + /// - /// Gets the certificate's subject name. + /// Gets the certificate's subject name. /// - [JsonProperty(PropertyName = "subject")] - public string Subject { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subject")] + public string Subject {get; private set; } /// - /// Gets the certificate's expiration date and time. + /// Gets the certificate's expiration date and time. /// - [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] - [JsonProperty(PropertyName = "expiry")] - public System.DateTime? Expiry { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "expiry")] + public System.DateTimeOffset? Expiry {get; private set; } /// - /// Gets the certificate's thumbprint. + /// Gets the certificate's thumbprint. /// - [JsonProperty(PropertyName = "thumbprint")] - public string Thumbprint { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint {get; private set; } /// /// Gets determines whether certificate has been verified. /// - [JsonProperty(PropertyName = "isVerified")] - public bool? IsVerified { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "isVerified")] + public bool? IsVerified {get; private set; } /// - /// Gets the certificate's creation date and time. + /// Gets the certificate's creation date and time. /// - [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] - [JsonProperty(PropertyName = "created")] - public System.DateTime? Created { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "created")] + public System.DateTimeOffset? Created {get; private set; } /// - /// Gets the certificate's last update date and time. + /// Gets the certificate's last update date and time. /// - [JsonConverter(typeof(DateTimeRfc1123JsonConverter))] - [JsonProperty(PropertyName = "updated")] - public System.DateTime? Updated { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "updated")] + public System.DateTimeOffset? Updated {get; private set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificatePurpose.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificatePurpose.cs index 8d42c4fb0575..285e4fd71ee4 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificatePurpose.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificatePurpose.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models /// /// Defines values for CertificatePurpose. /// + + public static class CertificatePurpose { public const string ClientAuthentication = "clientAuthentication"; public const string ServerAuthentication = "serverAuthentication"; } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateResponse.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateResponse.cs index 2ddbfd09bf8f..e48c5a83da1a 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateResponse.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/CertificateResponse.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; using System.Linq; /// /// The X509 Certificate. /// - public partial class CertificateResponse : IResource + public partial class CertificateResponse : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the CertificateResponse class. @@ -31,18 +23,29 @@ public CertificateResponse() /// /// Initializes a new instance of the CertificateResponse class. /// - /// properties of a certificate - /// The resource identifier. - /// The name of the certificate. - /// The entity tag. - /// The resource type. + + /// properties of a certificate + /// + + /// The resource identifier. + /// + + /// The name of the certificate. + /// + + /// The entity tag. + /// + + /// The resource type. + /// public CertificateResponse(CertificateProperties properties = default(CertificateProperties), string id = default(string), string name = default(string), string etag = default(string), string type = default(string)) + { - Properties = properties; - Id = id; - Name = name; - Etag = etag; - Type = type; + this.Properties = properties; + this.Id = id; + this.Name = name; + this.Etag = etag; + this.Type = type; CustomInit(); } @@ -51,35 +54,35 @@ public CertificateResponse() /// partial void CustomInit(); + /// /// Gets or sets properties of a certificate /// - [JsonProperty(PropertyName = "properties")] - public CertificateProperties Properties { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public CertificateProperties Properties {get; set; } /// /// Gets the resource identifier. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets the name of the certificate. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets the entity tag. /// - [JsonProperty(PropertyName = "etag")] - public string Etag { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "etag")] + public string Etag {get; private set; } /// /// Gets the resource type. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetails.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetails.cs index 80bf511666df..7a08a7f8b297 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetails.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetails.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,16 +23,25 @@ public ErrorDetails() /// /// Initializes a new instance of the ErrorDetails class. /// - /// The error code. - /// The HTTP status code. - /// The error message. - /// The error details. + + /// The error code. + /// + + /// The HTTP status code. + /// + + /// The error message. + /// + + /// The error details. + /// public ErrorDetails(string code = default(string), string httpStatusCode = default(string), string message = default(string), string details = default(string)) + { - Code = code; - HttpStatusCode = httpStatusCode; - Message = message; - Details = details; + this.Code = code; + this.HttpStatusCode = httpStatusCode; + this.Message = message; + this.Details = details; CustomInit(); } @@ -47,29 +50,29 @@ public ErrorDetails() /// partial void CustomInit(); + /// /// Gets the error code. /// - [JsonProperty(PropertyName = "Code")] - public string Code { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Code")] + public string Code {get; private set; } /// /// Gets the HTTP status code. /// - [JsonProperty(PropertyName = "HttpStatusCode")] - public string HttpStatusCode { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "HttpStatusCode")] + public string HttpStatusCode {get; private set; } /// /// Gets the error message. /// - [JsonProperty(PropertyName = "Message")] - public string Message { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "Message")] + public string Message {get; private set; } /// /// Gets the error details. /// - [JsonProperty(PropertyName = "Details")] - public string Details { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "Details")] + public string Details {get; private set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetailsException.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetailsException.cs index d8daf7716fa1..6df20b7ac4fc 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetailsException.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorDetailsException.cs @@ -1,31 +1,25 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; /// /// Exception thrown for an invalid response with ErrorDetails information. /// - public partial class ErrorDetailsException : RestException + public partial class ErrorDetailsException : Microsoft.Rest.RestException { /// /// Gets information about the associated HTTP request. /// - public HttpRequestMessageWrapper Request { get; set; } + public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; } /// /// Gets information about the associated HTTP response. /// - public HttpResponseMessageWrapper Response { get; set; } + public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; } /// /// Gets or sets the body object. @@ -40,7 +34,7 @@ public ErrorDetailsException() } /// - /// Initializes a new instance of the ErrorDetailsException class. + /// Initializes a new instance of the ErrorDetails class. /// /// The exception message. public ErrorDetailsException(string message) @@ -49,7 +43,7 @@ public ErrorDetailsException(string message) } /// - /// Initializes a new instance of the ErrorDetailsException class. + /// Initializes a new instance of the ErrorDetails class. /// /// The exception message. /// Inner exception. @@ -58,4 +52,4 @@ public ErrorDetailsException(string message, System.Exception innerException) { } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorMesssage.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorMesssage.cs index 00ace596ad62..b1548352ed6a 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorMesssage.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ErrorMesssage.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,21 @@ public ErrorMesssage() /// /// Initializes a new instance of the ErrorMesssage class. /// - /// standard error code - /// standard error description - /// detailed summary of error + + /// standard error code + /// + + /// standard error description + /// + + /// detailed summary of error + /// public ErrorMesssage(string code = default(string), string message = default(string), string details = default(string)) + { - Code = code; - Message = message; - Details = details; + this.Code = code; + this.Message = message; + this.Details = details; CustomInit(); } @@ -45,23 +46,23 @@ public ErrorMesssage() /// partial void CustomInit(); + /// /// Gets or sets standard error code /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } /// /// Gets or sets standard error description /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } /// /// Gets or sets detailed summary of error /// - [JsonProperty(PropertyName = "details")] - public string Details { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public string Details {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsPropertiesDescription.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsPropertiesDescription.cs index 3788f433f112..f6c9b22c6ae9 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsPropertiesDescription.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsPropertiesDescription.cs @@ -1,30 +1,21 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// the service specific properties of a provisioning service, including - /// keys, linked iot hubs, current state, and system generated properties - /// such as hostname and idScope + /// the service specific properties of a provisoning service, including keys, + /// linked iot hubs, current state, and system generated properties such as + /// hostname and idScope /// public partial class IotDpsPropertiesDescription { /// - /// Initializes a new instance of the IotDpsPropertiesDescription - /// class. + /// Initializes a new instance of the IotDpsPropertiesDescription class. /// public IotDpsPropertiesDescription() { @@ -32,39 +23,45 @@ public IotDpsPropertiesDescription() } /// - /// Initializes a new instance of the IotDpsPropertiesDescription - /// class. + /// Initializes a new instance of the IotDpsPropertiesDescription class. /// + /// Current state of the provisioning service. - /// Possible values include: 'Activating', 'Active', 'Deleting', - /// 'Deleted', 'ActivationFailed', 'DeletionFailed', 'Transitioning', - /// 'Suspending', 'Suspended', 'Resuming', 'FailingOver', - /// 'FailoverFailed' - /// The ARM provisioning state of the - /// provisioning service. - /// List of IoT hubs associated with this - /// provisioning service. - /// Allocation policy to be used by this - /// provisioning service. Possible values include: 'Hashed', - /// 'GeoLatency', 'Static' - /// Service endpoint for - /// provisioning service. - /// Device endpoint for this - /// provisioning service. - /// Unique identifier of this provisioning - /// 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)) + /// Possible values include: 'Activating', 'Active', 'Deleting', 'Deleted', + /// 'ActivationFailed', 'DeletionFailed', 'Transitioning', 'Suspending', + /// 'Suspended', 'Resuming', 'FailingOver', 'FailoverFailed' + + /// The ARM provisioning state of the provisioning service. + /// + + /// List of IoT hubs assosciated with this provisioning service. + /// + + /// Allocation policy to be used by this provisioning service. + /// Possible values include: 'Hashed', 'GeoLatency', 'Static' + + /// Service endpoint for provisioning service. + /// + + /// Device endpoint for this provisioning service. + /// + + /// Unique identifier of this provisioning service. + /// + + /// List of authorization keys for a provisioning service. + /// + public IotDpsPropertiesDescription(string state = default(string), string provisioningState = default(string), System.Collections.Generic.IList iotHubs = default(System.Collections.Generic.IList), string allocationPolicy = default(string), string serviceOperationsHostName = default(string), string deviceProvisioningHostName = default(string), string idScope = default(string), System.Collections.Generic.IList authorizationPolicies = default(System.Collections.Generic.IList)) + { - State = state; - ProvisioningState = provisioningState; - IotHubs = iotHubs; - AllocationPolicy = allocationPolicy; - ServiceOperationsHostName = serviceOperationsHostName; - DeviceProvisioningHostName = deviceProvisioningHostName; - IdScope = idScope; - AuthorizationPolicies = authorizationPolicies; + this.State = state; + this.ProvisioningState = provisioningState; + this.IotHubs = iotHubs; + this.AllocationPolicy = allocationPolicy; + this.ServiceOperationsHostName = serviceOperationsHostName; + this.DeviceProvisioningHostName = deviceProvisioningHostName; + this.IdScope = idScope; + this.AuthorizationPolicies = authorizationPolicies; CustomInit(); } @@ -73,60 +70,53 @@ public IotDpsPropertiesDescription() /// partial void CustomInit(); + /// - /// Gets or sets current state of the provisioning service. Possible - /// values include: 'Activating', 'Active', 'Deleting', 'Deleted', - /// 'ActivationFailed', 'DeletionFailed', 'Transitioning', - /// 'Suspending', 'Suspended', 'Resuming', 'FailingOver', - /// 'FailoverFailed' + /// Gets or sets current state of the provisioning service. Possible values include: 'Activating', 'Active', 'Deleting', 'Deleted', 'ActivationFailed', 'DeletionFailed', 'Transitioning', 'Suspending', 'Suspended', 'Resuming', 'FailingOver', 'FailoverFailed' /// - [JsonProperty(PropertyName = "state")] - public string State { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "state")] + public string State {get; set; } /// - /// Gets or sets the ARM provisioning state of the provisioning - /// service. + /// Gets or sets the ARM provisioning state of the provisioning service. /// - [JsonProperty(PropertyName = "provisioningState")] - public string ProvisioningState { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; set; } /// - /// Gets or sets list of IoT hubs associated with this provisioning - /// service. + /// Gets or sets list of IoT hubs assosciated with this provisioning service. /// - [JsonProperty(PropertyName = "iotHubs")] - public IList IotHubs { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "iotHubs")] + public System.Collections.Generic.IList IotHubs {get; set; } /// - /// Gets or sets allocation policy to be used by this provisioning - /// service. Possible values include: 'Hashed', 'GeoLatency', 'Static' + /// Gets or sets allocation policy to be used by this provisioning service. Possible values include: 'Hashed', 'GeoLatency', 'Static' /// - [JsonProperty(PropertyName = "allocationPolicy")] - public string AllocationPolicy { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "allocationPolicy")] + public string AllocationPolicy {get; set; } /// /// Gets service endpoint for provisioning service. /// - [JsonProperty(PropertyName = "serviceOperationsHostName")] - public string ServiceOperationsHostName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "serviceOperationsHostName")] + public string ServiceOperationsHostName {get; private set; } /// /// Gets device endpoint for this provisioning service. /// - [JsonProperty(PropertyName = "deviceProvisioningHostName")] - public string DeviceProvisioningHostName { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "deviceProvisioningHostName")] + public string DeviceProvisioningHostName {get; private set; } /// /// Gets unique identifier of this provisioning service. /// - [JsonProperty(PropertyName = "idScope")] - public string IdScope { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "idScope")] + public string IdScope {get; private set; } /// /// Gets or sets list of authorization keys for a provisioning service. /// - [JsonProperty(PropertyName = "authorizationPolicies")] - public IList AuthorizationPolicies { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "authorizationPolicies")] + public System.Collections.Generic.IList AuthorizationPolicies {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSku.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSku.cs index 1412ef27c11f..c9ef4839ebf7 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSku.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSku.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { @@ -14,8 +9,10 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models /// /// Defines values for IotDpsSku. /// + + public static class IotDpsSku { public const string S1 = "S1"; } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuDefinition.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuDefinition.cs index a398d920b714..fc45bf9e0ce1 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuDefinition.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuDefinition.cs @@ -1,20 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// - /// Available SKUs of tier and units. + /// Available Sku's of tier and units. /// public partial class IotDpsSkuDefinition { @@ -29,10 +23,13 @@ public IotDpsSkuDefinition() /// /// Initializes a new instance of the IotDpsSkuDefinition class. /// - /// SKU name. Possible values include: 'S1' + + /// Sku name. + /// Possible values include: 'S1' public IotDpsSkuDefinition(string name = default(string)) + { - Name = name; + this.Name = name; CustomInit(); } @@ -41,11 +38,11 @@ public IotDpsSkuDefinition() /// partial void CustomInit(); + /// - /// Gets or sets SKU name. Possible values include: 'S1' + /// Gets or sets sku name. Possible values include: 'S1' /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuInfo.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuInfo.cs index 2298cbd19cd5..ccbc36fcad2e 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuInfo.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotDpsSkuInfo.cs @@ -1,20 +1,14 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// - /// List of possible provisioning service SKUs. + /// List of possible provisoning service SKUs. /// public partial class IotDpsSkuInfo { @@ -29,15 +23,21 @@ public IotDpsSkuInfo() /// /// Initializes a new instance of the IotDpsSkuInfo class. /// - /// Sku name. Possible values include: 'S1' - /// Pricing tier name of the provisioning - /// service. - /// The number of units to provision + + /// Sku name. + /// Possible values include: 'S1' + + /// Pricing tier name of the provisioning service. + /// + + /// The number of units to provision + /// public IotDpsSkuInfo(string name = default(string), string tier = default(string), long? capacity = default(long?)) + { - Name = name; - Tier = tier; - Capacity = capacity; + this.Name = name; + this.Tier = tier; + this.Capacity = capacity; CustomInit(); } @@ -46,23 +46,23 @@ public IotDpsSkuInfo() /// partial void CustomInit(); + /// - /// Gets or sets sku name. Possible values include: 'S1' + /// Gets or sets sku name. Possible values include: 'S1' /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Gets pricing tier name of the provisioning service. /// - [JsonProperty(PropertyName = "tier")] - public string Tier { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "tier")] + public string Tier {get; private set; } /// /// Gets or sets the number of units to provision /// - [JsonProperty(PropertyName = "capacity")] - public long? Capacity { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "capacity")] + public long? Capacity {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotHubDefinitionDescription.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotHubDefinitionDescription.cs index e23894c16203..74231f52fa6e 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotHubDefinitionDescription.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/IotHubDefinitionDescription.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Newtonsoft.Json; using System.Linq; /// @@ -20,8 +13,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models public partial class IotHubDefinitionDescription { /// - /// Initializes a new instance of the IotHubDefinitionDescription - /// class. + /// Initializes a new instance of the IotHubDefinitionDescription class. /// public IotHubDefinitionDescription() { @@ -29,24 +21,31 @@ public IotHubDefinitionDescription() } /// - /// Initializes a new instance of the IotHubDefinitionDescription - /// class. + /// Initializes a new instance of the IotHubDefinitionDescription class. /// - /// Connection string of the IoT - /// hub. - /// ARM region of the IoT hub. - /// Flag for applying - /// allocationPolicy or not for a given IoT hub. - /// Weight to apply for a given IoT - /// hub. - /// Host name of the IoT hub. + + /// flag for applying allocationPolicy or not for a given iot hub. + /// + + /// weight to apply for a given iot h. + /// + + /// Host name of the IoT hub. + /// + + /// Connection string og the IoT hub. + /// + + /// ARM region of the IoT hub. + /// public IotHubDefinitionDescription(string connectionString, string location, bool? applyAllocationPolicy = default(bool?), int? allocationWeight = default(int?), string name = default(string)) + { - ApplyAllocationPolicy = applyAllocationPolicy; - AllocationWeight = allocationWeight; - Name = name; - ConnectionString = connectionString; - Location = location; + this.ApplyAllocationPolicy = applyAllocationPolicy; + this.AllocationWeight = allocationWeight; + this.Name = name; + this.ConnectionString = connectionString; + this.Location = location; CustomInit(); } @@ -55,53 +54,55 @@ public IotHubDefinitionDescription() /// partial void CustomInit(); + /// - /// Gets or sets flag for applying allocationPolicy or not for a given - /// IoT hub. + /// Gets or sets flag for applying allocationPolicy or not for a given iot hub. /// - [JsonProperty(PropertyName = "applyAllocationPolicy")] - public bool? ApplyAllocationPolicy { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "applyAllocationPolicy")] + public bool? ApplyAllocationPolicy {get; set; } /// - /// Gets or sets weight to apply for a given IoT hub. + /// Gets or sets weight to apply for a given iot h. /// - [JsonProperty(PropertyName = "allocationWeight")] - public int? AllocationWeight { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "allocationWeight")] + public int? AllocationWeight {get; set; } /// /// Gets host name of the IoT hub. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// - /// Gets or sets connection string of the IoT hub. + /// Gets or sets connection string og the IoT hub. /// - [JsonProperty(PropertyName = "connectionString")] - public string ConnectionString { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "connectionString")] + public string ConnectionString {get; set; } /// - /// Gets or sets ARM region of the IoT hub. + /// Gets or sets aRM region of the IoT hub. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (ConnectionString == null) + if (this.ConnectionString == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionString"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ConnectionString"); } - if (Location == null) + if (this.Location == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); } + + + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameAvailabilityInfo.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameAvailabilityInfo.cs index 51623c28e5b0..d6ac3941c0f0 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameAvailabilityInfo.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameAvailabilityInfo.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,17 +23,21 @@ public NameAvailabilityInfo() /// /// Initializes a new instance of the NameAvailabilityInfo class. /// - /// specifies if a name is available or - /// not - /// specifies the reason a name is unavailable. - /// Possible values include: 'Invalid', 'AlreadyExists' - /// message containing a detailed reason name is - /// unavailable + + /// specifies if a name is available or not + /// + + /// specifies the reason a name is unavailable + /// Possible values include: 'Invalid', 'AlreadyExists' + + /// message containing a etailed reason name is unavailable + /// public NameAvailabilityInfo(bool? nameAvailable = default(bool?), string reason = default(string), string message = default(string)) + { - NameAvailable = nameAvailable; - Reason = reason; - Message = message; + this.NameAvailable = nameAvailable; + this.Reason = reason; + this.Message = message; CustomInit(); } @@ -48,25 +46,23 @@ public NameAvailabilityInfo() /// partial void CustomInit(); + /// /// Gets or sets specifies if a name is available or not /// - [JsonProperty(PropertyName = "nameAvailable")] - public bool? NameAvailable { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable {get; set; } /// - /// Gets or sets specifies the reason a name is unavailable. Possible - /// values include: 'Invalid', 'AlreadyExists' + /// Gets or sets specifies the reason a name is unavailable Possible values include: 'Invalid', 'AlreadyExists' /// - [JsonProperty(PropertyName = "reason")] - public string Reason { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "reason")] + public string Reason {get; set; } /// - /// Gets or sets message containing a detailed reason name is - /// unavailable + /// Gets or sets message containing a etailed reason name is unavailable /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameUnavailabilityReason.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameUnavailabilityReason.cs index e81ab9e6f9b7..871d5ed24f9e 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameUnavailabilityReason.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/NameUnavailabilityReason.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { @@ -14,9 +9,11 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models /// /// Defines values for NameUnavailabilityReason. /// + + public static class NameUnavailabilityReason { public const string Invalid = "Invalid"; public const string AlreadyExists = "AlreadyExists"; } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Operation.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Operation.cs index 6af1781fa9d6..b096bf61ad76 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Operation.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Operation.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,17 @@ public Operation() /// /// Initializes a new instance of the Operation class. /// - /// Operation name: {provider}/{resource}/{read | - /// write | action | delete} - /// The object that represents the - /// operation. + + /// Operation name: {provider}/{resource}/{read | write | action | delete} + /// + + /// The object that represents the operation. + /// public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { - Name = name; - Display = display; + this.Name = name; + this.Display = display; CustomInit(); } @@ -45,18 +42,17 @@ public Operation() /// partial void CustomInit(); + /// - /// Gets operation name: {provider}/{resource}/{read | write | action | - /// delete} + /// Gets operation name: {provider}/{resource}/{read | write | action | delete} /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets or sets the object that represents the operation. /// - [JsonProperty(PropertyName = "display")] - public OperationDisplay Display { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public OperationDisplay Display {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationDisplay.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationDisplay.cs index 7dc145ee72e5..b6a29750174b 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationDisplay.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationDisplay.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,14 +23,21 @@ public OperationDisplay() /// /// Initializes a new instance of the OperationDisplay class. /// - /// Service provider: Microsoft Devices. - /// Resource Type: ProvisioningServices. - /// Name of the operation. + + /// Service provider: Microsoft Devices. + /// + + /// Resource Type: ProvisioningServices. + /// + + /// Name of the operation. + /// public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { - Provider = provider; - Resource = resource; - Operation = operation; + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; CustomInit(); } @@ -45,23 +46,23 @@ public OperationDisplay() /// partial void CustomInit(); + /// /// Gets service provider: Microsoft Devices. /// - [JsonProperty(PropertyName = "provider")] - public string Provider { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; private set; } /// /// Gets resource Type: ProvisioningServices. /// - [JsonProperty(PropertyName = "resource")] - public string Resource { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; private set; } /// /// Gets name of the operation. /// - [JsonProperty(PropertyName = "operation")] - public string Operation { get; private set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; private set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationInputs.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationInputs.cs index 49e6b4c2b24c..101e2f2f6baf 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationInputs.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/OperationInputs.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Newtonsoft.Json; using System.Linq; /// @@ -30,11 +23,13 @@ public OperationInputs() /// /// Initializes a new instance of the OperationInputs class. /// - /// The name of the Provisioning Service to - /// check. + + /// The name of the Provisioning Service to check. + /// public OperationInputs(string name) + { - Name = name; + this.Name = name; CustomInit(); } @@ -43,24 +38,25 @@ public OperationInputs(string name) /// partial void CustomInit(); + /// /// Gets or sets the name of the Provisioning Service to check. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Name == null) + if (this.Name == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); } + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Page.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Page.cs index 42a8f2c3653e..12a5f27f73c8 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Page.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Page.cs @@ -1,53 +1,43 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; /// /// Defines a page in Azure responses. /// /// Type of the page content items - [JsonObject] - public class Page : IPage + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage { - /// - /// Gets the link to the next page. - /// - [JsonProperty("nextLink")] - public string NextPageLink { get; private set; } - - [JsonProperty("value")] - private IList Items{ get; set; } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - public IEnumerator GetEnumerator() - { - return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); - } - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A an enumerator that can be used to iterate through the collection. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public System.Collections.Generic.IEnumerator GetEnumerator() + { + return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ProvisioningServiceDescription.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ProvisioningServiceDescription.cs index 7f0e6b4b73c0..eb6ef2ded685 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ProvisioningServiceDescription.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/ProvisioningServiceDescription.cs @@ -1,19 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -22,8 +13,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models public partial class ProvisioningServiceDescription : Resource { /// - /// Initializes a new instance of the ProvisioningServiceDescription - /// class. + /// Initializes a new instance of the ProvisioningServiceDescription class. /// public ProvisioningServiceDescription() { @@ -31,26 +21,40 @@ public ProvisioningServiceDescription() } /// - /// Initializes a new instance of the ProvisioningServiceDescription - /// class. + /// Initializes a new instance of the ProvisioningServiceDescription class. /// - /// The resource location. - /// Service specific properties for a - /// provisioning service - /// SKU info for a provisioning service. - /// The resource identifier. - /// The resource name. - /// The resource type. - /// The resource tags. - /// The Etag field is *not* required. If it is - /// provided in the response body, it must also be provided as a header - /// per the normal ETag convention. - public ProvisioningServiceDescription(string location, IotDpsPropertiesDescription properties, IotDpsSkuInfo sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string etag = default(string)) - : base(location, id, name, type, tags) + + /// The resource identifier. + /// + + /// The resource name. + /// + + /// The resource type. + /// + + /// The resource location. + /// + + /// The resource tags. + /// + + /// The Etag field is *not* required. If it is provided in the response body, + /// it must also be provided as a header per the normal ETag convention. + /// + + /// Service specific properties for a provisioning service + /// + + /// Sku info for a provisioning Service. + /// + public ProvisioningServiceDescription(string location, IotDpsPropertiesDescription properties, IotDpsSkuInfo sku, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string etag = default(string)) + + : base(location, id, name, type, tags) { - Etag = etag; - Properties = properties; - Sku = sku; + this.Etag = etag; + this.Properties = properties; + this.Sku = sku; CustomInit(); } @@ -59,43 +63,46 @@ public ProvisioningServiceDescription() /// partial void CustomInit(); + /// - /// Gets or sets the Etag field is *not* required. If it is provided in - /// the response body, it must also be provided as a header per the - /// normal ETag convention. + /// Gets or sets the Etag field is *not* required. If it is provided in the + /// response body, it must also be provided as a header per the normal ETag + /// convention. /// - [JsonProperty(PropertyName = "etag")] - public string Etag { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "etag")] + public string Etag {get; set; } /// /// Gets or sets service specific properties for a provisioning service /// - [JsonProperty(PropertyName = "properties")] - public IotDpsPropertiesDescription Properties { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public IotDpsPropertiesDescription Properties {get; set; } /// - /// Gets or sets SKU info for a provisioning service. + /// Gets or sets sku info for a provisioning Service. /// - [JsonProperty(PropertyName = "sku")] - public IotDpsSkuInfo Sku { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public IotDpsSkuInfo Sku {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public override void Validate() { base.Validate(); - if (Properties == null) + if (this.Properties == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Properties"); } - if (Sku == null) + if (this.Sku == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Sku"); } + + + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Resource.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Resource.cs index 1a430c4d513d..83ddf4455f01 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Resource.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/Resource.cs @@ -1,26 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// /// The common properties of an Azure resource. /// - public partial class Resource : IResource + public partial class Resource : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the Resource class. @@ -33,18 +23,29 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The resource location. - /// The resource identifier. - /// The resource name. - /// The resource type. - /// The resource tags. - public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + + /// The resource identifier. + /// + + /// The resource name. + /// + + /// The resource type. + /// + + /// The resource location. + /// + + /// The resource tags. + /// + public Resource(string location, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + { - Id = id; - Name = name; - Type = type; - Location = location; - Tags = tags; + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Tags = tags; CustomInit(); } @@ -53,55 +54,59 @@ public Resource() /// partial void CustomInit(); + /// /// Gets the resource identifier. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets the resource name. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets the resource type. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } /// /// Gets or sets the resource location. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } /// /// Gets or sets the resource tags. /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (Location == null) + if (this.Location == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); } - if (Name != null) + + if (this.Name != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$")) + if (!System.Text.RegularExpressions.Regex.IsMatch(this.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]$"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "Name", "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,49}[a-zA-Z0-9]$"); } } + + + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs index fe2aea1eaed3..294730438749 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/SharedAccessSignatureAuthorizationRuleAccessRightsDescription.cs @@ -1,17 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Newtonsoft.Json; using System.Linq; /// @@ -20,9 +13,7 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models public partial class SharedAccessSignatureAuthorizationRuleAccessRightsDescription { /// - /// Initializes a new instance of the - /// SharedAccessSignatureAuthorizationRuleAccessRightsDescription - /// class. + /// Initializes a new instance of the SharedAccessSignatureAuthorizationRuleAccessRightsDescription class. /// public SharedAccessSignatureAuthorizationRuleAccessRightsDescription() { @@ -30,23 +21,29 @@ public SharedAccessSignatureAuthorizationRuleAccessRightsDescription() } /// - /// Initializes a new instance of the - /// SharedAccessSignatureAuthorizationRuleAccessRightsDescription - /// class. + /// Initializes a new instance of the SharedAccessSignatureAuthorizationRuleAccessRightsDescription class. /// - /// Name of the key. - /// Rights that this key has. Possible values - /// include: 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', - /// 'DeviceConnect', 'RegistrationStatusRead', - /// 'RegistrationStatusWrite' - /// Primary SAS key value. - /// Secondary SAS key value. + + /// Name of the key. + /// + + /// Primary SAS key value. + /// + + /// Secondary SAS key value. + /// + + /// Rights that this key has. + /// Possible values include: 'ServiceConfig', 'EnrollmentRead', + /// 'EnrollmentWrite', 'DeviceConnect', 'RegistrationStatusRead', + /// 'RegistrationStatusWrite' public SharedAccessSignatureAuthorizationRuleAccessRightsDescription(string keyName, string rights, string primaryKey = default(string), string secondaryKey = default(string)) + { - KeyName = keyName; - PrimaryKey = primaryKey; - SecondaryKey = secondaryKey; - Rights = rights; + this.KeyName = keyName; + this.PrimaryKey = primaryKey; + this.SecondaryKey = secondaryKey; + this.Rights = rights; CustomInit(); } @@ -55,49 +52,50 @@ public SharedAccessSignatureAuthorizationRuleAccessRightsDescription() /// partial void CustomInit(); + /// /// Gets or sets name of the key. /// - [JsonProperty(PropertyName = "keyName")] - public string KeyName { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "keyName")] + public string KeyName {get; set; } /// /// Gets or sets primary SAS key value. /// - [JsonProperty(PropertyName = "primaryKey")] - public string PrimaryKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "primaryKey")] + public string PrimaryKey {get; set; } /// /// Gets or sets secondary SAS key value. /// - [JsonProperty(PropertyName = "secondaryKey")] - public string SecondaryKey { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "secondaryKey")] + public string SecondaryKey {get; set; } /// - /// Gets or sets rights that this key has. Possible values include: - /// 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', - /// 'DeviceConnect', 'RegistrationStatusRead', - /// 'RegistrationStatusWrite' + /// Gets or sets rights that this key has. Possible values include: 'ServiceConfig', 'EnrollmentRead', 'EnrollmentWrite', 'DeviceConnect', 'RegistrationStatusRead', 'RegistrationStatusWrite' /// - [JsonProperty(PropertyName = "rights")] - public string Rights { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "rights")] + public string Rights {get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (KeyName == null) + if (this.KeyName == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "KeyName"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "KeyName"); } - if (Rights == null) + if (this.Rights == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "Rights"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Rights"); } + + + + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/State.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/State.cs index 4cb71e5ec2f0..a9643a8d358e 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/State.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/State.cs @@ -1,12 +1,7 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { @@ -14,6 +9,8 @@ namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models /// /// Defines values for State. /// + + public static class State { public const string Activating = "Activating"; @@ -29,4 +26,4 @@ public static class State public const string FailingOver = "FailingOver"; public const string FailoverFailed = "FailoverFailed"; } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/TagsResource.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/TagsResource.cs index 3e7e12667151..4b53789427db 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/TagsResource.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/TagsResource.cs @@ -1,18 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// @@ -32,10 +24,13 @@ public TagsResource() /// /// Initializes a new instance of the TagsResource class. /// - /// Resource tags - public TagsResource(IDictionary tags = default(IDictionary)) + + /// Resource tags + /// + public TagsResource(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + { - Tags = tags; + this.Tags = tags; CustomInit(); } @@ -44,11 +39,11 @@ public TagsResource() /// partial void CustomInit(); + /// /// Gets or sets resource tags /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeRequest.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeRequest.cs index 2a7f21b9dfdb..cf0190393e6c 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeRequest.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeRequest.cs @@ -1,16 +1,10 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; /// @@ -29,11 +23,14 @@ public VerificationCodeRequest() /// /// Initializes a new instance of the VerificationCodeRequest class. /// - /// base-64 representation of X509 - /// certificate .cer file or just .pem file content. + + /// base-64 representation of X509 certificate .cer file or just .pem file + /// content. + /// public VerificationCodeRequest(string certificate = default(string)) + { - Certificate = certificate; + this.Certificate = certificate; CustomInit(); } @@ -42,12 +39,12 @@ public VerificationCodeRequest() /// partial void CustomInit(); + /// - /// Gets or sets base-64 representation of X509 certificate .cer file - /// or just .pem file content. + /// Gets or sets base-64 representation of X509 certificate .cer file or just + /// .pem file content. /// - [JsonProperty(PropertyName = "certificate")] - public string Certificate { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "certificate")] + public string Certificate {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponse.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponse.cs index dada77807da1..a782efbdf5e0 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponse.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponse.cs @@ -1,24 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; using System.Linq; /// /// Description of the response of the verification code. /// - public partial class VerificationCodeResponse : IResource + public partial class VerificationCodeResponse : Microsoft.Rest.Azure.IResource { /// /// Initializes a new instance of the VerificationCodeResponse class. @@ -31,17 +23,29 @@ public VerificationCodeResponse() /// /// Initializes a new instance of the VerificationCodeResponse class. /// - /// Name of certificate. - /// Request etag. - /// The resource identifier. - /// The resource type. + + /// Name of certificate. + /// + + /// Request etag. + /// + + /// The resource identifier. + /// + + /// The resource type. + /// + + /// + /// public VerificationCodeResponse(string name = default(string), string etag = default(string), string id = default(string), string type = default(string), VerificationCodeResponseProperties properties = default(VerificationCodeResponseProperties)) + { - Name = name; - Etag = etag; - Id = id; - Type = type; - Properties = properties; + this.Name = name; + this.Etag = etag; + this.Id = id; + this.Type = type; + this.Properties = properties; CustomInit(); } @@ -50,34 +54,35 @@ public VerificationCodeResponse() /// partial void CustomInit(); + /// /// Gets name of certificate. /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } /// /// Gets request etag. /// - [JsonProperty(PropertyName = "etag")] - public string Etag { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "etag")] + public string Etag {get; private set; } /// /// Gets the resource identifier. /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } /// /// Gets the resource type. /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } /// + /// Gets or sets /// - [JsonProperty(PropertyName = "properties")] - public VerificationCodeResponseProperties Properties { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public VerificationCodeResponseProperties Properties {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponseProperties.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponseProperties.cs index e92b0961607e..9a1d03a6bd70 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponseProperties.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Models/VerificationCodeResponseProperties.cs @@ -1,23 +1,16 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices.Models { - using Newtonsoft.Json; using System.Linq; public partial class VerificationCodeResponseProperties { /// - /// Initializes a new instance of the - /// VerificationCodeResponseProperties class. + /// Initializes a new instance of the VerificationCodeResponseProperties class. /// public VerificationCodeResponseProperties() { @@ -25,26 +18,39 @@ public VerificationCodeResponseProperties() } /// - /// Initializes a new instance of the - /// VerificationCodeResponseProperties class. + /// Initializes a new instance of the VerificationCodeResponseProperties class. /// - /// Verification code. - /// Certificate subject. - /// Code expiry. - /// Certificate thumbprint. - /// Indicate if the certificate is verified by - /// owner of private key. - /// Certificate created time. - /// Certificate updated time. + + /// Verification code. + /// + + /// Certificate subject. + /// + + /// Code expiry. + /// + + /// Certificate thumbprint. + /// + + /// Indicate if the certificate is verified by owner of private key. + /// + + /// 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)) + { - VerificationCode = verificationCode; - Subject = subject; - Expiry = expiry; - Thumbprint = thumbprint; - IsVerified = isVerified; - Created = created; - Updated = updated; + this.VerificationCode = verificationCode; + this.Subject = subject; + this.Expiry = expiry; + this.Thumbprint = thumbprint; + this.IsVerified = isVerified; + this.Created = created; + this.Updated = updated; CustomInit(); } @@ -53,48 +59,48 @@ public VerificationCodeResponseProperties() /// partial void CustomInit(); + /// /// Gets or sets verification code. /// - [JsonProperty(PropertyName = "verificationCode")] - public string VerificationCode { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "verificationCode")] + public string VerificationCode {get; set; } /// /// Gets or sets certificate subject. /// - [JsonProperty(PropertyName = "subject")] - public string Subject { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "subject")] + public string Subject {get; set; } /// /// Gets or sets code expiry. /// - [JsonProperty(PropertyName = "expiry")] - public string Expiry { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "expiry")] + public string Expiry {get; set; } /// /// Gets or sets certificate thumbprint. /// - [JsonProperty(PropertyName = "thumbprint")] - public string Thumbprint { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "thumbprint")] + public string Thumbprint {get; set; } /// - /// Gets or sets indicate if the certificate is verified by owner of - /// private key. + /// Gets or sets indicate if the certificate is verified by owner of private + /// key. /// - [JsonProperty(PropertyName = "isVerified")] - public bool? IsVerified { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "isVerified")] + public bool? IsVerified {get; set; } /// /// Gets or sets certificate created time. /// - [JsonProperty(PropertyName = "created")] - public string Created { get; set; } + [Newtonsoft.Json.JsonProperty(PropertyName = "created")] + public string Created {get; set; } /// /// Gets or sets certificate updated time. /// - [JsonProperty(PropertyName = "updated")] - public string Updated { get; set; } - + [Newtonsoft.Json.JsonProperty(PropertyName = "updated")] + public string Updated {get; set; } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Operations.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Operations.cs index d667cdd721bc..5aee6e00f554 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Operations.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/Operations.cs @@ -1,31 +1,19 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices { + using System.Linq; 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; /// /// Operations operations. /// - internal partial class Operations : IServiceOperations, IOperations + internal partial class Operations : Microsoft.Rest.IServiceOperations, IOperations { /// /// Initializes a new instance of the Operations class. @@ -36,13 +24,13 @@ internal partial class Operations : IServiceOperations, IOperation /// /// Thrown when a required parameter is null /// - internal Operations(IotDpsClient client) + internal Operations (IotDpsClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - Client = client; + this.Client = client; } /// @@ -59,13 +47,13 @@ internal Operations(IotDpsClient client) /// /// 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 /// /// @@ -74,54 +62,62 @@ internal Operations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { - if (Client.ApiVersion == null) + + + + + if (this.Client.ApiVersion == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } + // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.Devices/operations").ToString(); - List _queryParameters = new List(); - if (Client.ApiVersion != null) + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -133,50 +129,51 @@ internal Operations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -186,9 +183,10 @@ internal Operations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -199,25 +197,29 @@ internal Operations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } /// /// Lists all of the available Microsoft.Devices REST API operations. /// @@ -230,13 +232,13 @@ internal Operations(IotDpsClient client) /// /// 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 /// /// @@ -245,51 +247,54 @@ internal Operations(IotDpsClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { + if (nextPageLink == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); } // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; string _invocationId = null; if (_shouldTrace) { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); tracingParameters.Add("nextPageLink", nextPageLink); + + tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); } // Construct URL string _url = "{nextLink}"; _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); 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"); + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) { _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); } - if (Client.AcceptLanguage != null) + if (this.Client.AcceptLanguage != null) { if (_httpRequest.Headers.Contains("accept-language")) { _httpRequest.Headers.Remove("accept-language"); } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage); } - if (customHeaders != null) { foreach(var _header in customHeaders) @@ -301,50 +306,51 @@ internal Operations(IotDpsClient client) _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); } } - // Serialize Request string _requestContent = null; // Set Credentials - if (Client.Credentials != null) + if (this.Client.Credentials != null) { cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); } // Send Request if (_shouldTrace) { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); } - HttpStatusCode _statusCode = _httpResponse.StatusCode; + + System.Net.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); + ErrorDetails _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); if (_errorBody != null) { ex.Body = _errorBody; } } - catch (JsonException) + catch (Newtonsoft.Json.JsonException) { // Ignore the exception } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - ServiceClientTracing.Error(_invocationId, ex); + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -354,9 +360,10 @@ internal Operations(IotDpsClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new Microsoft.Rest.Azure.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(); @@ -367,24 +374,28 @@ internal Operations(IotDpsClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); } - catch (JsonException ex) + catch (Newtonsoft.Json.JsonException ex) { _httpRequest.Dispose(); if (_httpResponse != null) { _httpResponse.Dispose(); } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); } } if (_shouldTrace) { - ServiceClientTracing.Exit(_invocationId, _result); + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); } return _result; - } + + + + + } } -} +} \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/OperationsExtensions.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/OperationsExtensions.cs index 572ac046cfb3..8df80f68ce88 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/OperationsExtensions.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/OperationsExtensions.cs @@ -1,87 +1,76 @@ -// // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// +// Licensed under the MIT License. See License.txt in the project root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - +// Changes may cause incorrect behavior and will be lost if the code is regenerated. namespace Microsoft.Azure.Management.DeviceProvisioningServices { - using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Threading; - using System.Threading.Tasks; /// - /// Extension methods for Operations. + /// Extension methods for Operations /// public static partial class OperationsExtensions { - /// - /// Lists all of the available Microsoft.Devices REST API operations. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } + /// + /// Lists all of the available Microsoft.Devices REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IOperations operations) + { + return ((IOperations)operations).ListAsync().GetAwaiter().GetResult(); + } - /// - /// Lists all of the available Microsoft.Devices REST API operations. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + /// + /// Lists all of the available Microsoft.Devices REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + return _result.Body; } + } + /// + /// Lists all of the available Microsoft.Devices REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IOperations operations, string nextPageLink) + { + return ((IOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } - /// - /// Lists all of the available Microsoft.Devices REST API operations. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IOperations operations, string nextPageLink) + /// + /// Lists all of the available Microsoft.Devices REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + return _result.Body; } - - /// - /// Lists all of the available Microsoft.Devices REST API operations. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - + } } } diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/SdkInfo_iotDpsClient.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/SdkInfo_iotDpsClient.cs deleted file mode 100644 index 8415a05d6ada..000000000000 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/Generated/SdkInfo_iotDpsClient.cs +++ /dev/null @@ -1,29 +0,0 @@ - -// -// 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 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", "2017-11-15"), - new Tuple("Devices", "IotDpsResource", "2017-11-15"), - new Tuple("Devices", "Operations", "2017-11-15"), - }.AsEnumerable(); - } - } - } -} diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/README.md b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/README.md index 8dee25d16b2b..22265fb3eaaf 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/README.md +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices.Management.Sdk/README.md @@ -4,31 +4,36 @@ This directory contains management plane service clients of Az.DeviceProvisionin ## Run Generation In this directory, run AutoRest: ``` -rm -r Generated/* autorest --reset -autorest --use:@microsoft.azure/autorest.csharp@2.3.90 -autorest.cmd README.md --version=v2 +autorest --use:@autorest/powershell@4.x ``` ### AutoRest Configuration > see https://aka.ms/autorest ``` yaml -csharp: true -clear-output-folder: true -reflect-api-versions: true +isSdkGenerator: true +powershell: true +title: IotDpsClient openapi-type: arm +reflect-api-versions: true azure-arm: true license-header: MICROSOFT_MIT_NO_VERSION -payload-flattening-threshold: 2 +clear-output-folder: true +useDateTimeOffset: true ``` ### ``` yaml -commit: 679887ace44697c726aba8d2814ee415a5d25e6f +commit: d390062ed96aa6478741b5f5196039540cb90d65 input-file: - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/deviceprovisioningservices/resource-manager/Microsoft.Devices/stable/2017-11-15/iotdps.json output-folder: Generated namespace: Microsoft.Azure.Management.DeviceProvisioningServices + +directive: + - from: swagger-document + where: $ + transform: return $.replace(/SharedAccessSignatureAuthorizationRule\[AccessRightsDescription\]/g, 'SharedAccessSignatureAuthorizationRuleAccessRightsDescription') ``` \ No newline at end of file diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDps/UpdateAzureRmIotDeviceProvisioningService.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDps/UpdateAzureRmIotDeviceProvisioningService.cs index 10affe5d8313..98e816b4893d 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDps/UpdateAzureRmIotDeviceProvisioningService.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDps/UpdateAzureRmIotDeviceProvisioningService.cs @@ -14,17 +14,15 @@ namespace Microsoft.Azure.Commands.Management.DeviceProvisioningServices { - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Management.Automation; using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.Management.DeviceProvisioningServices.Models; using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; using Microsoft.Azure.Management.DeviceProvisioningServices; using Microsoft.Azure.Management.DeviceProvisioningServices.Models; - using Microsoft.WindowsAzure.Commands.Utilities.Common; + using System; + using System.Collections; + using System.Linq; + using System.Management.Automation; using DPSResources = Microsoft.Azure.Commands.Management.DeviceProvisioningServices.Properties.Resources; [Cmdlet("Update", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "IoTDeviceProvisioningService", DefaultParameterSetName = ResourceUpdateParameterSet, SupportsShouldProcess = true)] @@ -202,13 +200,10 @@ private void CreateUpdateIotDps() private void UpdateIotDps() { - Dictionary dictionaryTag = new Dictionary(); - ProvisioningServiceDescription updatedProvisioningServiceDescription = new ProvisioningServiceDescription(); if (this.Reset.IsPresent) { - HashtableToDictionary(this.Tag, dictionaryTag); - updatedProvisioningServiceDescription = this.IotDpsClient.IotDpsResource.Update(this.ResourceGroupName, this.Name, dictionaryTag); + updatedProvisioningServiceDescription = this.IotDpsClient.IotDpsResource.Update(this.ResourceGroupName, this.Name, IotDpsUtils.ToTagsResource(this.Tag.Cast().ToDictionary(kvp => (string)kvp.Key, kvp => (string)kvp.Value))); } else { @@ -220,28 +215,10 @@ private void UpdateIotDps() this.Tag.Add(tag.Key, tag.Value); } } - HashtableToDictionary(this.Tag, dictionaryTag); - updatedProvisioningServiceDescription = this.IotDpsClient.IotDpsResource.Update(this.ResourceGroupName, this.Name, dictionaryTag); + updatedProvisioningServiceDescription = this.IotDpsClient.IotDpsResource.Update(this.ResourceGroupName, this.Name, IotDpsUtils.ToTagsResource(this.Tag.Cast().ToDictionary(kvp => (string)kvp.Key, kvp => (string)kvp.Value))); } this.WritePSObject(updatedProvisioningServiceDescription); } - - private void HashtableToDictionary(Hashtable hashtable, IDictionary dictionary) - { - if (null == hashtable) - { - return; - } - foreach (var each in hashtable.Keys) - { - var key = each.ToString(); - var value = hashtable[key]; - if (null != value) - { - dictionary[key] = (V)value; - } - } - } } } diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/AddAzureRmIotDeviceProvisioningServiceCertificate.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/AddAzureRmIotDeviceProvisioningServiceCertificate.cs index 041795d5824d..83d111794a82 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/AddAzureRmIotDeviceProvisioningServiceCertificate.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/AddAzureRmIotDeviceProvisioningServiceCertificate.cs @@ -167,9 +167,16 @@ private void AddIotDpsCertificate() certificateBodyDescription.Certificate = certificate; CertificateResponse certificateResponse; - certificateResponse = this.IotDpsClient.DpsCertificate.CreateOrUpdate(this.ResourceGroupName, this.Name, this.CertificateName, this.Etag, certificateBodyDescription.Certificate); + if (this.Etag != null) + { + certificateResponse = this.IotDpsClient.DpsCertificate.CreateOrUpdate(this.ResourceGroupName, this.Name, this.CertificateName, certificateBodyDescription, this.Etag); + } + else + { + certificateResponse = this.IotDpsClient.DpsCertificate.CreateOrUpdate(this.ResourceGroupName, this.Name, this.CertificateName, certificateBodyDescription); - this.WriteObject(IotDpsUtils.ToPSCertificateResponse(certificateResponse)); + this.WriteObject(IotDpsUtils.ToPSCertificateResponse(certificateResponse)); + } } } } diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/SetAzureRmIotDeviceProvisioningServiceCertificate.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/SetAzureRmIotDeviceProvisioningServiceCertificate.cs index 638512512e49..6ec865a18e50 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/SetAzureRmIotDeviceProvisioningServiceCertificate.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices/Cmdlet/IotDpsCertificates/SetAzureRmIotDeviceProvisioningServiceCertificate.cs @@ -164,7 +164,7 @@ private void SetIotDpsCertificate() VerificationCodeRequest verificationCodeRequest = new VerificationCodeRequest(); verificationCodeRequest.Certificate = certificate; - CertificateResponse certificateResponse = this.IotDpsClient.DpsCertificate.VerifyCertificate(this.CertificateName, this.Etag,this.ResourceGroupName, this.Name, verificationCodeRequest.Certificate); + CertificateResponse certificateResponse = this.IotDpsClient.DpsCertificate.VerifyCertificate(this.CertificateName, this.Etag,this.ResourceGroupName, this.Name, verificationCodeRequest); this.WriteObject(IotDpsUtils.ToPSCertificateResponse(certificateResponse)); } } diff --git a/src/DeviceProvisioningServices/DeviceProvisioningServices/Common/IotDpsBaseCmdlet.cs b/src/DeviceProvisioningServices/DeviceProvisioningServices/Common/IotDpsBaseCmdlet.cs index 549635c47626..2a5c09a11ca3 100644 --- a/src/DeviceProvisioningServices/DeviceProvisioningServices/Common/IotDpsBaseCmdlet.cs +++ b/src/DeviceProvisioningServices/DeviceProvisioningServices/Common/IotDpsBaseCmdlet.cs @@ -96,7 +96,7 @@ public IotHubDefinitionDescription GetIotDpsHubs(string resourceGroupName, strin public IList GetIotDpsCertificates(string resourceGroupName, string provisioningServiceName) { - CertificateListDescription certificates = this.IotDpsClient.DpsCertificate.List(resourceGroupName, provisioningServiceName); + CertificateListDescription certificates = this.IotDpsClient.DpsCertificates.List(resourceGroupName, provisioningServiceName); return certificates.Value; }