diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IOperations.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IOperations.cs index 0f7f276c2fff..f809c96f99a1 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IOperations.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IOperations.cs @@ -33,7 +33,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -56,7 +56,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/ISignalROperations.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/ISignalROperations.cs index e11e05afe388..a4f9f191eb1a 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/ISignalROperations.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/ISignalROperations.cs @@ -38,7 +38,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -57,7 +57,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -81,7 +81,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -108,7 +108,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -139,7 +139,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -166,7 +166,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -196,7 +196,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -223,7 +223,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -250,7 +250,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -277,7 +277,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -305,7 +305,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -335,7 +335,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -362,7 +362,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -389,7 +389,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -416,7 +416,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -435,7 +435,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -457,7 +457,7 @@ public partial interface ISignalROperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IUsagesOperations.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IUsagesOperations.cs index a216c6980ba9..da6f0f53e17b 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IUsagesOperations.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/IUsagesOperations.cs @@ -35,7 +35,7 @@ public partial interface IUsagesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -57,7 +57,7 @@ public partial interface IUsagesOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponse.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..752c7233d73d --- /dev/null +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,66 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.SignalR.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Contains information about an API error. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// Describes a particular API error with an error + /// code and a message. + public ErrorResponse(ErrorResponseBody error = default(ErrorResponseBody)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets describes a particular API error with an error code + /// and a message. + /// + [JsonProperty(PropertyName = "error")] + public ErrorResponseBody Error { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Error != null) + { + Error.Validate(); + } + } + } +} diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponseBody.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponseBody.cs new file mode 100644 index 000000000000..30037a713727 --- /dev/null +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponseBody.cs @@ -0,0 +1,115 @@ +// +// 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.SignalR.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Describes a particular API error with an error code and a message. + /// + public partial class ErrorResponseBody + { + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + public ErrorResponseBody() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponseBody class. + /// + /// An error code that describes the error condition + /// more precisely than an HTTP status code. + /// Can be used to programmatically handle specific error + /// cases. + /// A message that describes the error in detail + /// and provides debugging information. + /// The target of the particular error (for + /// example, the name of the property in error). + /// Contains nested errors that are related to + /// this error. + public ErrorResponseBody(string code, string message, string target = default(string), IList details = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an error code that describes the error condition more + /// precisely than an HTTP status code. + /// Can be used to programmatically handle specific error cases. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; set; } + + /// + /// Gets or sets a message that describes the error in detail and + /// provides debugging information. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + /// + /// Gets or sets the target of the particular error (for example, the + /// name of the property in error). + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; set; } + + /// + /// Gets or sets contains nested errors that are related to this error. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Code == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Code"); + } + if (Message == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Message"); + } + if (Details != null) + { + foreach (var element in Details) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponseException.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..6ead481b0deb --- /dev/null +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// 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.SignalR.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/FeatureFlags.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/FeatureFlags.cs new file mode 100644 index 000000000000..eca5ab5e3dea --- /dev/null +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/FeatureFlags.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.SignalR.Models +{ + + /// + /// Defines values for FeatureFlags. + /// + public static class FeatureFlags + { + public const string ServiceMode = "ServiceMode"; + public const string EnableConnectivityLogs = "EnableConnectivityLogs"; + } +} diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/LogSpecification.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/LogSpecification.cs new file mode 100644 index 000000000000..f0369b15763d --- /dev/null +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/LogSpecification.cs @@ -0,0 +1,60 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.SignalR.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Specifications of the Logs for Azure Monitoring. + /// + public partial class LogSpecification + { + /// + /// Initializes a new instance of the LogSpecification class. + /// + public LogSpecification() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the LogSpecification class. + /// + /// Name of the log. + /// Localized friendly display name of the + /// log. + public LogSpecification(string name = default(string), string displayName = default(string)) + { + Name = name; + DisplayName = displayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the log. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets localized friendly display name of the log. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + + } +} diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ServiceSpecification.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ServiceSpecification.cs index 536253183624..43a68a22cfe8 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ServiceSpecification.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/ServiceSpecification.cs @@ -33,9 +33,12 @@ public ServiceSpecification() /// /// Specifications of the Metrics /// for Azure Monitoring. - public ServiceSpecification(IList metricSpecifications = default(IList)) + /// Specifications of the Logs for + /// Azure Monitoring. + public ServiceSpecification(IList metricSpecifications = default(IList), IList logSpecifications = default(IList)) { MetricSpecifications = metricSpecifications; + LogSpecifications = logSpecifications; CustomInit(); } @@ -50,5 +53,11 @@ public ServiceSpecification() [JsonProperty(PropertyName = "metricSpecifications")] public IList MetricSpecifications { get; set; } + /// + /// Gets or sets specifications of the Logs for Azure Monitoring. + /// + [JsonProperty(PropertyName = "logSpecifications")] + public IList LogSpecifications { get; set; } + } } diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/SignalRFeature.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/SignalRFeature.cs index 5985cf8961d0..36983158d84a 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/SignalRFeature.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Models/SignalRFeature.cs @@ -33,34 +33,52 @@ public SignalRFeature() /// /// Initializes a new instance of the SignalRFeature class. /// + /// FeatureFlags is the supported features of Azure + /// SignalR service. + /// - ServiceMode: Flag for backend server for SignalR service. Values + /// allowed: "Default": have your own backend server; "Serverless": + /// your application doesn't have a backend server; "Classic": for + /// backward compatibility. Support both Default and Serverless mode + /// but not recommended; "PredefinedOnly": for future use. + /// - EnableConnectivityLogs: "true"/"false", to enable/disable the + /// connectivity log category respectively. Possible values include: + /// 'ServiceMode', 'EnableConnectivityLogs' /// Value of the feature flag. See Azure SignalR - /// service document - /// https://docs.microsoft.com/en-us/azure/azure-signalr/ for allowed - /// values. + /// service document https://docs.microsoft.com/azure/azure-signalr/ + /// for allowed values. /// Optional properties related to this /// feature. - public SignalRFeature(string value, IDictionary properties = default(IDictionary)) + public SignalRFeature(string flag, string value, IDictionary properties = default(IDictionary)) { + Flag = flag; Value = value; Properties = properties; CustomInit(); } - /// - /// Static constructor for SignalRFeature class. - /// - static SignalRFeature() - { - Flag = "ServiceMode"; - } /// /// An initialization method that performs custom operations like setting defaults /// partial void CustomInit(); + /// + /// Gets or sets featureFlags is the supported features of Azure + /// SignalR service. + /// - ServiceMode: Flag for backend server for SignalR service. Values + /// allowed: "Default": have your own backend server; "Serverless": + /// your application doesn't have a backend server; "Classic": for + /// backward compatibility. Support both Default and Serverless mode + /// but not recommended; "PredefinedOnly": for future use. + /// - EnableConnectivityLogs: "true"/"false", to enable/disable the + /// connectivity log category respectively. Possible values include: + /// 'ServiceMode', 'EnableConnectivityLogs' + /// + [JsonProperty(PropertyName = "flag")] + public string Flag { get; set; } + /// /// Gets or sets value of the feature flag. See Azure SignalR service - /// document https://docs.microsoft.com/en-us/azure/azure-signalr/ for + /// document https://docs.microsoft.com/azure/azure-signalr/ for /// allowed values. /// [JsonProperty(PropertyName = "value")] @@ -72,12 +90,6 @@ static SignalRFeature() [JsonProperty(PropertyName = "properties")] public IDictionary Properties { get; set; } - /// - /// Kind of feature. Required. - /// - [JsonProperty(PropertyName = "flag")] - public static string Flag { get; private set; } - /// /// Validate the object. /// @@ -86,6 +98,10 @@ static SignalRFeature() /// public virtual void Validate() { + if (Flag == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Flag"); + } if (Value == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Value"); diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Operations.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Operations.cs index d6004b5c65e0..2bfba544f4ae 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Operations.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/Operations.cs @@ -60,7 +60,7 @@ internal Operations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -159,14 +159,13 @@ internal Operations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -176,10 +175,6 @@ internal Operations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -237,7 +232,7 @@ internal Operations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -333,14 +328,13 @@ internal Operations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -350,10 +344,6 @@ internal Operations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SdkInfo_SignalRManagementClient.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SdkInfo_SignalRManagementClient.cs index 08a097b35da4..f5c6c0579e28 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SdkInfo_SignalRManagementClient.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SdkInfo_SignalRManagementClient.cs @@ -25,16 +25,5 @@ public static IEnumerable> ApiInfo_SignalRManageme }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@1.9.1"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/signalr/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=D:\\workspace\\github\\juniwang\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "59c5761efb6dae1a0cfb624bc1a054e902a855cf"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SignalROperations.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SignalROperations.cs index 48ba52176c31..f53a7e4705e5 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SignalROperations.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/SignalROperations.cs @@ -65,7 +65,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -186,14 +186,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -203,10 +202,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -260,7 +255,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -364,14 +359,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -381,10 +375,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -442,7 +432,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -552,14 +542,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -569,10 +558,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -633,7 +618,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -749,14 +734,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -766,10 +750,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -857,7 +837,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -973,14 +953,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -990,10 +969,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1156,7 +1131,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1279,14 +1254,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1296,10 +1270,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1363,7 +1333,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1488,16 +1458,15 @@ internal SignalROperations(SignalRManagementClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1507,10 +1476,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1531,6 +1496,24 @@ internal SignalROperations(SignalRManagementClient client) _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response if ((int)_statusCode == 201) { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); @@ -1571,7 +1554,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1684,14 +1667,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1701,10 +1683,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1750,7 +1728,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1873,14 +1851,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1890,10 +1867,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1954,7 +1927,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2067,14 +2040,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2084,10 +2056,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2126,7 +2094,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2222,14 +2190,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2239,10 +2206,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2299,7 +2262,7 @@ internal SignalROperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2395,14 +2358,13 @@ internal SignalROperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2412,10 +2374,6 @@ internal SignalROperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/UsagesOperations.cs b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/UsagesOperations.cs index d380d572d05b..54b4cfc6e3b1 100644 --- a/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/UsagesOperations.cs +++ b/sdk/signalr/Microsoft.Azure.Management.SignalR/src/Generated/UsagesOperations.cs @@ -62,7 +62,7 @@ internal UsagesOperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -172,14 +172,13 @@ internal UsagesOperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -189,10 +188,6 @@ internal UsagesOperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -249,7 +244,7 @@ internal UsagesOperations(SignalRManagementClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -345,14 +340,13 @@ internal UsagesOperations(SignalRManagementClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -362,10 +356,6 @@ internal UsagesOperations(SignalRManagementClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex);