diff --git a/eng/mgmt/mgmtmetadata/iotcentral_resource-manager.txt b/eng/mgmt/mgmtmetadata/iotcentral_resource-manager.txt index 28885110f6976..a1a50026f2f89 100644 --- a/eng/mgmt/mgmtmetadata/iotcentral_resource-manager.txt +++ b/eng/mgmt/mgmtmetadata/iotcentral_resource-manager.txt @@ -3,12 +3,12 @@ AutoRest installed successfully. Commencing code generation Generating CSharp code Executing AutoRest command -cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/iotcentral/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\Users\pochen\Github\azure-sdk-for-net\sdk\iotcentral\Microsoft.Azure.Management.IotCentral\src\Generated -2020-01-02 19:34:34 UTC +cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/iotcentral/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=D:\azure-sdk-for-net\sdk\iotcentral\Microsoft.Azure.Management.IotCentral\src\Generated +2020-03-05 20:09:29 UTC Azure-rest-api-specs repository information GitHub fork: Azure Branch: master -Commit: 4676d9187988aa6793ff704aa39c5f495b40f6e0 +Commit: 57ba23526b8ef2ddd52165d54e20d66f5563e8f4 AutoRest information Requested version: latest -Bootstrapper version: autorest@2.0.4407 +Bootstrapper version: autorest@3.0.6187 diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs index acbd90b300e3f..e4f13f598650a 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs @@ -65,7 +65,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -82,10 +82,6 @@ internal AppsOperations(IotCentralClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -98,6 +94,7 @@ internal AppsOperations(IotCentralClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -105,6 +102,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -117,9 +115,9 @@ internal AppsOperations(IotCentralClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -181,13 +179,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -197,6 +196,10 @@ internal AppsOperations(IotCentralClient 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); @@ -325,7 +328,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -342,14 +345,11 @@ internal AppsOperations(IotCentralClient client) /// public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -357,6 +357,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); } @@ -365,9 +366,9 @@ internal AppsOperations(IotCentralClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/IoTApps").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -429,13 +430,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -445,6 +447,10 @@ internal AppsOperations(IotCentralClient 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); @@ -501,7 +507,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -518,10 +524,6 @@ internal AppsOperations(IotCentralClient client) /// public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -530,6 +532,7 @@ internal AppsOperations(IotCentralClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -537,6 +540,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); @@ -547,9 +551,9 @@ internal AppsOperations(IotCentralClient client) _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -611,13 +615,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -627,6 +632,10 @@ internal AppsOperations(IotCentralClient 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); @@ -684,7 +693,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -701,10 +710,6 @@ internal AppsOperations(IotCentralClient client) /// public async Task> CheckNameAvailabilityWithHttpMessagesAsync(OperationInputs operationInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -717,6 +722,7 @@ internal AppsOperations(IotCentralClient client) { operationInputs.Validate(); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -724,6 +730,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("operationInputs", operationInputs); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); @@ -733,9 +740,9 @@ internal AppsOperations(IotCentralClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkNameAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -803,13 +810,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -819,6 +827,10 @@ internal AppsOperations(IotCentralClient 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); @@ -876,7 +888,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -893,10 +905,6 @@ internal AppsOperations(IotCentralClient client) /// public async Task> CheckSubdomainAvailabilityWithHttpMessagesAsync(OperationInputs operationInputs, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -909,6 +917,7 @@ internal AppsOperations(IotCentralClient client) { operationInputs.Validate(); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -916,6 +925,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("operationInputs", operationInputs); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CheckSubdomainAvailability", tracingParameters); @@ -925,9 +935,9 @@ internal AppsOperations(IotCentralClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/checkSubdomainAvailability").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -995,13 +1005,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1011,6 +1022,10 @@ internal AppsOperations(IotCentralClient 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); @@ -1064,7 +1079,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1081,14 +1096,11 @@ internal AppsOperations(IotCentralClient client) /// public async Task>> ListTemplatesWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1096,6 +1108,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListTemplates", tracingParameters); } @@ -1104,9 +1117,9 @@ internal AppsOperations(IotCentralClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.IoTCentral/appTemplates").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1168,13 +1181,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1184,6 +1198,10 @@ internal AppsOperations(IotCentralClient 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); @@ -1249,7 +1267,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1266,10 +1284,6 @@ internal AppsOperations(IotCentralClient client) /// public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1290,6 +1304,7 @@ internal AppsOperations(IotCentralClient client) { app.Validate(); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1297,6 +1312,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("app", app); @@ -1310,9 +1326,9 @@ internal AppsOperations(IotCentralClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1380,13 +1396,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1396,6 +1413,10 @@ internal AppsOperations(IotCentralClient 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); @@ -1476,7 +1497,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1493,10 +1514,6 @@ internal AppsOperations(IotCentralClient client) /// public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1513,6 +1530,7 @@ internal AppsOperations(IotCentralClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "appPatch"); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1520,6 +1538,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("appPatch", appPatch); @@ -1533,9 +1552,9 @@ internal AppsOperations(IotCentralClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1603,13 +1622,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 202) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1619,6 +1639,10 @@ internal AppsOperations(IotCentralClient 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); @@ -1678,7 +1702,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1692,10 +1716,6 @@ internal AppsOperations(IotCentralClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1708,6 +1728,7 @@ internal AppsOperations(IotCentralClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1715,6 +1736,7 @@ internal AppsOperations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); @@ -1727,9 +1749,9 @@ internal AppsOperations(IotCentralClient client) _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -1791,13 +1813,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1807,6 +1830,10 @@ internal AppsOperations(IotCentralClient 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); @@ -1845,7 +1872,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1941,13 +1968,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1957,6 +1985,10 @@ internal AppsOperations(IotCentralClient 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); @@ -2013,7 +2045,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2109,13 +2141,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2125,6 +2158,10 @@ internal AppsOperations(IotCentralClient 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); @@ -2181,7 +2218,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2277,13 +2314,14 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2293,6 +2331,10 @@ internal AppsOperations(IotCentralClient 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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs index 88bcfe63dae50..534090f46244f 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs @@ -39,7 +39,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -72,7 +72,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -101,7 +101,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -127,7 +127,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -143,7 +143,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -166,7 +166,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -189,7 +189,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -212,7 +212,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -231,7 +231,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -264,7 +264,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -293,7 +293,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -319,7 +319,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -338,7 +338,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -360,7 +360,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -382,7 +382,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IOperations.cs index 2c1a6c152b0dc..76541811542c2 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IOperations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs index 7bb89715d466a..ae9f2efd9b97d 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs @@ -111,20 +111,6 @@ public override void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); } - if (DisplayName != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(DisplayName, "^.{1,200}$")) - { - throw new ValidationException(ValidationRules.Pattern, "DisplayName", "^.{1,200}$"); - } - } - if (Subdomain != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(Subdomain, "^[a-z0-9-]{1,63}$")) - { - throw new ValidationException(ValidationRules.Pattern, "Subdomain", "^[a-z0-9-]{1,63}$"); - } - } if (Sku != null) { Sku.Validate(); diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs index 2817821d780ea..3cbd09426950c 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs @@ -92,28 +92,5 @@ public AppPatch() [JsonProperty(PropertyName = "properties.template")] public string Template { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DisplayName != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(DisplayName, "^.{1,200}$")) - { - throw new ValidationException(ValidationRules.Pattern, "DisplayName", "^.{1,200}$"); - } - } - if (Subdomain != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(Subdomain, "^[a-z0-9-]{1,63}$")) - { - throw new ValidationException(ValidationRules.Pattern, "Subdomain", "^[a-z0-9-]{1,63}$"); - } - } - } } } diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponseBody.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CloudErrorBody.cs similarity index 81% rename from sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponseBody.cs rename to sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CloudErrorBody.cs index 9aa1e14dab0bd..6ca9f55e5c605 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponseBody.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CloudErrorBody.cs @@ -18,25 +18,25 @@ namespace Microsoft.Azure.Management.IotCentral.Models /// /// Details of error response. /// - public partial class ErrorResponseBody + public partial class CloudErrorBody { /// - /// Initializes a new instance of the ErrorResponseBody class. + /// Initializes a new instance of the CloudErrorBody class. /// - public ErrorResponseBody() + public CloudErrorBody() { CustomInit(); } /// - /// Initializes a new instance of the ErrorResponseBody class. + /// Initializes a new instance of the CloudErrorBody class. /// /// The error code. /// The error message. /// The target of the particular error. /// A list of additional details about the /// error. - public ErrorResponseBody(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + public CloudErrorBody(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) { Code = code; Message = message; @@ -72,7 +72,7 @@ public ErrorResponseBody() /// Gets or sets a list of additional details about the error. /// [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } + public IList Details { get; set; } } } diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetails.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetails.cs deleted file mode 100644 index 8c7527fe80986..0000000000000 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetails.cs +++ /dev/null @@ -1,81 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.IotCentral.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Error details. - /// - [Rest.Serialization.JsonTransformation] - public partial class ErrorDetails - { - /// - /// Initializes a new instance of the ErrorDetails class. - /// - public ErrorDetails() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorDetails class. - /// - /// The error code. - /// The error message. - /// The target of the particular error. - /// A list of additional details about the - /// error. - public ErrorDetails(string code = default(string), string message = default(string), 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 the error code. - /// - [JsonProperty(PropertyName = "error.code")] - public string Code { get; private set; } - - /// - /// Gets the error message. - /// - [JsonProperty(PropertyName = "error.message")] - public string Message { get; private set; } - - /// - /// Gets the target of the particular error. - /// - [JsonProperty(PropertyName = "error.target")] - public string Target { get; private set; } - - /// - /// Gets or sets a list of additional details about the error. - /// - [JsonProperty(PropertyName = "error.details")] - public IList Details { get; set; } - - } -} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetailsException.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetailsException.cs deleted file mode 100644 index acc80ee264f6c..0000000000000 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetailsException.cs +++ /dev/null @@ -1,61 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.IotCentral.Models -{ - using Microsoft.Rest; - - /// - /// Exception thrown for an invalid response with ErrorDetails information. - /// - public partial class ErrorDetailsException : 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 ErrorDetails Body { get; set; } - - /// - /// Initializes a new instance of the ErrorDetailsException class. - /// - public ErrorDetailsException() - { - } - - /// - /// Initializes a new instance of the ErrorDetailsException class. - /// - /// The exception message. - public ErrorDetailsException(string message) - : this(message, null) - { - } - - /// - /// Initializes a new instance of the ErrorDetailsException class. - /// - /// The exception message. - /// Inner exception. - public ErrorDetailsException(string message, System.Exception innerException) - : base(message, innerException) - { - } - } -} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/OperationInputs.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/OperationInputs.cs index f2114661cd089..a26c6c2700bce 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/OperationInputs.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/OperationInputs.cs @@ -71,13 +71,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (Name != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[a-z0-9-]{1,63}$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^[a-z0-9-]{1,63}$"); - } - } } } } diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs index f1330a2219b3f..d8c3c98596ce2 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs @@ -95,13 +95,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Location"); } - if (Name != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$"); - } - } } } } diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs index ea0a0e51cc93c..da9786aab0a2d 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs @@ -59,27 +59,18 @@ internal Operations(IotCentralClient 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 - /// - /// - /// Thrown when a required parameter is null - /// /// /// A response object containing the response body and response headers. /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (Client.ApiVersion == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } + string apiVersion = "2018-09-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -87,6 +78,7 @@ internal Operations(IotCentralClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); } @@ -94,9 +86,9 @@ internal Operations(IotCentralClient client) var _baseUrl = Client.BaseUri.AbsoluteUri; var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.IoTCentral/operations").ToString(); List _queryParameters = new List(); - if (Client.ApiVersion != null) + if (apiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); } if (_queryParameters.Count > 0) { @@ -158,13 +150,14 @@ internal Operations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -174,6 +167,10 @@ internal Operations(IotCentralClient 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); @@ -230,7 +227,7 @@ internal Operations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -326,13 +323,14 @@ internal Operations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new ErrorDetailsException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new CloudException(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); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { + ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -342,6 +340,10 @@ internal Operations(IotCentralClient 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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs index 08b3cbe78158f..d1e261ed5ac2e 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs @@ -26,11 +26,11 @@ public static IEnumerable> ApiInfo_IotCentralClien } // BEGIN: Code Generation Metadata Section public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4407"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/iotcentral/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=C:\\Users\\pochen\\Github\\azure-sdk-for-net\\sdk\\iotcentral\\Microsoft.Azure.Management.IotCentral\\src\\Generated"; + public static readonly String AutoRestBootStrapperVersion = "autorest@3.0.6187"; + public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/iotcentral/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp.output-folder=D:\\azure-sdk-for-net\\sdk\\iotcentral\\Microsoft.Azure.Management.IotCentral\\src\\Generated"; public static readonly String GithubForkName = "Azure"; public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "4676d9187988aa6793ff704aa39c5f495b40f6e0"; + public static readonly String GithubCommidId = "57ba23526b8ef2ddd52165d54e20d66f5563e8f4"; public static readonly String CodeGenerationErrors = ""; public static readonly String GithubRepoName = "azure-rest-api-specs"; // END: Code Generation Metadata Section diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Microsoft.Azure.Management.IotCentral.csproj b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Microsoft.Azure.Management.IotCentral.csproj index fc621e049ee03..7eb936a97c19d 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Microsoft.Azure.Management.IotCentral.csproj +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Microsoft.Azure.Management.IotCentral.csproj @@ -8,11 +8,11 @@ Provides management capabilities for Microsoft Azure IotCentral. Microsoft Azure IotCentral Management Microsoft.Azure.Management.IotCentral - 2.1.0 + 2.2.0 Microsoft Azure IotCentral;IotCentral management;IotCentral; diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Properties/AssemblyInfo.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Properties/AssemblyInfo.cs index b87ec0d1f3a79..852680e5f0156 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Properties/AssemblyInfo.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Properties/AssemblyInfo.cs @@ -7,8 +7,8 @@ [assembly: AssemblyTitle("Microsoft Azure IotCentral Management Library")] [assembly: AssemblyDescription("Provides management functionality for Microsoft Azure IotCentral Resources.")] -[assembly: AssemblyVersion("2.1.0.0")] -[assembly: AssemblyFileVersion("2.1.0.0")] +[assembly: AssemblyVersion("2.2.0.0")] +[assembly: AssemblyFileVersion("2.2.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Microsoft Azure .NET SDK")] diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/tests/ScenarioTests/IotCentralLifeCycleTests.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/tests/ScenarioTests/IotCentralLifeCycleTests.cs index dfbf99da0d7a6..2c8cbadd965c5 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/tests/ScenarioTests/IotCentralLifeCycleTests.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/tests/ScenarioTests/IotCentralLifeCycleTests.cs @@ -15,6 +15,7 @@ namespace IotCentral.Tests.ScenarioTests using Newtonsoft.Json.Linq; using Xunit; using Microsoft.Rest; + using Microsoft.Rest.Azure; public class IotCentralLifeCycleTests : IotCentralTestBase { @@ -147,32 +148,6 @@ public void TestAppWhenNullAppSkuInfo() Assert.True(exceptionThrown); } - [Fact] - public void TestAppWhenInvalidSubdomain() - { - var exceptionThrown = false; - try - { - App app = new App() - { - Location = IotCentralTestUtilities.DefaultLocation, - Sku = new AppSkuInfo() - { - Name = "ST1" - }, - Subdomain = "SOME-INVALID-SUBDOMAIN", - DisplayName = IotCentralTestUtilities.DefaultUpdateResourceName - }; - app.Validate(); - } - catch (Exception ex) - { - exceptionThrown = true; - Assert.Equal(typeof(ValidationException), ex.GetType()); - } - Assert.True(exceptionThrown); - } - [Fact] public void TestAppSkuInfoWhenNullInput() { @@ -207,24 +182,6 @@ public void TestOperationInputsWhenNullInput() Assert.True(exceptionThrown); } - [Fact] - public void TestOperationInputsWhenInvalidInput() - { - var exceptionThrown = false; - try - { - var nameInput = "SOMEINVALIDINPUT"; - OperationInputs operationInput = new OperationInputs(nameInput); - operationInput.Validate(); - } - catch (Exception ex) - { - exceptionThrown = true; - Assert.Equal(typeof(ValidationException), ex.GetType()); - } - Assert.True(exceptionThrown); - } - [Fact] public void TestResourceWhenNullLocation() {