diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperations.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperations.cs
index 927c2afbfbe87..ea09d2d6aef6a 100644
--- a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperations.cs
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperations.cs
@@ -68,7 +68,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -214,14 +214,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -231,10 +230,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -425,7 +420,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -550,14 +545,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -567,10 +561,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -624,7 +614,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -728,14 +718,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -745,10 +734,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -802,7 +787,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -906,14 +891,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -923,10 +907,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -989,7 +969,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1135,14 +1115,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -1152,10 +1131,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -1200,6 +1175,206 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
return _result;
}
+ ///
+ /// Check the name availability in the target location.
+ ///
+ ///
+ /// The region name which the operation will lookup into.
+ ///
+ ///
+ /// The name of the capacity.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CheckNameAvailabilityWithHttpMessagesAsync(string location, CheckCapacityNameAvailabilityParameters capacityParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (location == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "location");
+ }
+ if (capacityParameters == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "capacityParameters");
+ }
+ if (capacityParameters != null)
+ {
+ capacityParameters.Validate();
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("location", location);
+ tracingParameters.Add("capacityParameters", capacityParameters);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/locations/{location}/checkNameAvailability").ToString();
+ _url = _url.Replace("{location}", System.Uri.EscapeDataString(location));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(capacityParameters != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(capacityParameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
///
/// Provisions the specified Dedicated capacity based on the configuration
/// specified in the request.
@@ -1222,7 +1397,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1383,14 +1558,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
string _responseContent = null;
if ((int)_statusCode != 200 && (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;
}
}
@@ -1400,10 +1574,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -1484,7 +1654,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1627,14 +1797,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
string _responseContent = null;
if ((int)_statusCode != 200 && (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;
}
}
@@ -1644,10 +1813,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -1695,7 +1860,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1852,14 +2017,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -1869,10 +2033,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -1953,7 +2113,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -2096,14 +2256,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -2113,10 +2272,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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);
@@ -2161,7 +2316,7 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -2304,14 +2459,13 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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;
}
}
@@ -2321,10 +2475,6 @@ internal CapacitiesOperations(PowerBIDedicatedManagementClient 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/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperationsExtensions.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperationsExtensions.cs
index 10a9a5f779ef9..a5a02d0d3748e 100644
--- a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperationsExtensions.cs
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/CapacitiesOperationsExtensions.cs
@@ -444,6 +444,46 @@ public static SkuEnumerationForExistingResourceResult ListSkusForCapacity(this I
}
}
+ ///
+ /// Check the name availability in the target location.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The region name which the operation will lookup into.
+ ///
+ ///
+ /// The name of the capacity.
+ ///
+ public static CheckCapacityNameAvailabilityResult CheckNameAvailability(this ICapacitiesOperations operations, string location, CheckCapacityNameAvailabilityParameters capacityParameters)
+ {
+ return operations.CheckNameAvailabilityAsync(location, capacityParameters).GetAwaiter().GetResult();
+ }
+
+ ///
+ /// Check the name availability in the target location.
+ ///
+ ///
+ /// The operations group for this extension method.
+ ///
+ ///
+ /// The region name which the operation will lookup into.
+ ///
+ ///
+ /// The name of the capacity.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CheckNameAvailabilityAsync(this ICapacitiesOperations operations, string location, CheckCapacityNameAvailabilityParameters capacityParameters, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(location, capacityParameters, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
///
/// Provisions the specified Dedicated capacity based on the configuration
/// specified in the request.
diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/ICapacitiesOperations.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/ICapacitiesOperations.cs
index 985174e0c941b..009d86f2cdc0a 100644
--- a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/ICapacitiesOperations.cs
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/ICapacitiesOperations.cs
@@ -41,7 +41,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -73,7 +73,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -101,7 +101,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -130,7 +130,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -158,7 +158,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -183,7 +183,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -204,7 +204,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -223,7 +223,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -242,7 +242,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -270,7 +270,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -281,6 +281,31 @@ public partial interface ICapacitiesOperations
///
Task> ListSkusForCapacityWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
+ /// Check the name availability in the target location.
+ ///
+ ///
+ /// The region name which the operation will lookup into.
+ ///
+ ///
+ /// The name of the capacity.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CheckNameAvailabilityWithHttpMessagesAsync(string location, CheckCapacityNameAvailabilityParameters capacityParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
/// Provisions the specified Dedicated capacity based on the
/// configuration specified in the request.
///
@@ -302,7 +327,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -330,7 +355,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -359,7 +384,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -387,7 +412,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -412,7 +437,7 @@ public partial interface ICapacitiesOperations
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/CheckCapacityNameAvailabilityParameters.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/CheckCapacityNameAvailabilityParameters.cs
new file mode 100644
index 0000000000000..aa391123f62a6
--- /dev/null
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/CheckCapacityNameAvailabilityParameters.cs
@@ -0,0 +1,86 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIDedicated.Models
+{
+ using Microsoft.Rest;
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// Details of capacity name request body.
+ ///
+ public partial class CheckCapacityNameAvailabilityParameters
+ {
+ ///
+ /// Initializes a new instance of the
+ /// CheckCapacityNameAvailabilityParameters class.
+ ///
+ public CheckCapacityNameAvailabilityParameters()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the
+ /// CheckCapacityNameAvailabilityParameters class.
+ ///
+ /// Name for checking availability.
+ /// The resource type of PowerBI dedicated.
+ public CheckCapacityNameAvailabilityParameters(string name = default(string), string type = default(string))
+ {
+ Name = name;
+ Type = type;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets name for checking availability.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the resource type of PowerBI dedicated.
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Validate the object.
+ ///
+ ///
+ /// Thrown if validation fails
+ ///
+ public virtual void Validate()
+ {
+ if (Name != null)
+ {
+ if (Name.Length > 63)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "Name", 63);
+ }
+ if (Name.Length < 3)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "Name", 3);
+ }
+ if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[a-z][a-z0-9]*$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "Name", "^[a-z][a-z0-9]*$");
+ }
+ }
+ }
+ }
+}
diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/CheckCapacityNameAvailabilityResult.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/CheckCapacityNameAvailabilityResult.cs
new file mode 100644
index 0000000000000..ffc163466a673
--- /dev/null
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/CheckCapacityNameAvailabilityResult.cs
@@ -0,0 +1,71 @@
+//
+// 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.PowerBIDedicated.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The checking result of capacity name availability.
+ ///
+ public partial class CheckCapacityNameAvailabilityResult
+ {
+ ///
+ /// Initializes a new instance of the
+ /// CheckCapacityNameAvailabilityResult class.
+ ///
+ public CheckCapacityNameAvailabilityResult()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the
+ /// CheckCapacityNameAvailabilityResult class.
+ ///
+ /// Indicator of availability of the
+ /// capacity name.
+ /// The reason of unavailability.
+ /// The detailed message of the request
+ /// unavailability.
+ public CheckCapacityNameAvailabilityResult(bool? nameAvailable = default(bool?), string reason = default(string), string message = default(string))
+ {
+ NameAvailable = nameAvailable;
+ Reason = reason;
+ Message = message;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets indicator of availability of the capacity name.
+ ///
+ [JsonProperty(PropertyName = "nameAvailable")]
+ public bool? NameAvailable { get; set; }
+
+ ///
+ /// Gets or sets the reason of unavailability.
+ ///
+ [JsonProperty(PropertyName = "reason")]
+ public string Reason { get; set; }
+
+ ///
+ /// Gets or sets the detailed message of the request unavailability.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ }
+}
diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/DedicatedCapacity.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/DedicatedCapacity.cs
index 0fec40850ab1a..18522ecf6a58c 100644
--- a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/DedicatedCapacity.cs
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/DedicatedCapacity.cs
@@ -54,7 +54,7 @@ public DedicatedCapacity()
/// 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating',
/// 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling'
/// The current deployment state of
- /// PowerBI Dedicatedresource. The provisioningState is to indicate
+ /// PowerBI Dedicated resource. The provisioningState is to indicate
/// states for resource provisioning. Possible values include:
/// 'Deleting', 'Succeeded', 'Failed', 'Paused', 'Suspended',
/// 'Provisioning', 'Updating', 'Suspending', 'Pausing', 'Resuming',
@@ -90,11 +90,11 @@ public DedicatedCapacity()
public string State { get; private set; }
///
- /// Gets the current deployment state of PowerBI Dedicatedresource. The
- /// provisioningState is to indicate states for resource provisioning.
- /// Possible values include: 'Deleting', 'Succeeded', 'Failed',
- /// 'Paused', 'Suspended', 'Provisioning', 'Updating', 'Suspending',
- /// 'Pausing', 'Resuming', 'Preparing', 'Scaling'
+ /// Gets the current deployment state of PowerBI Dedicated resource.
+ /// The provisioningState is to indicate states for resource
+ /// provisioning. Possible values include: 'Deleting', 'Succeeded',
+ /// 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating',
+ /// 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling'
///
[JsonProperty(PropertyName = "properties.provisioningState")]
public string ProvisioningState { get; private set; }
diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/ErrorResponse.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/ErrorResponse.cs
index cdecd42c60a42..8fc46e29940bf 100644
--- a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/ErrorResponse.cs
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/ErrorResponse.cs
@@ -29,13 +29,10 @@ public ErrorResponse()
///
/// Initializes a new instance of the ErrorResponse class.
///
- /// Error code
- /// Error message indicating why the operation
- /// failed.
- public ErrorResponse(string code = default(string), string message = default(string))
+ /// The error object
+ public ErrorResponse(ErrorResponseError error = default(ErrorResponseError))
{
- Code = code;
- Message = message;
+ Error = error;
CustomInit();
}
@@ -45,16 +42,10 @@ public ErrorResponse()
partial void CustomInit();
///
- /// Gets or sets error code
+ /// Gets or sets the error object
///
- [JsonProperty(PropertyName = "code")]
- public string Code { get; set; }
-
- ///
- /// Gets or sets error message indicating why the operation failed.
- ///
- [JsonProperty(PropertyName = "message")]
- public string Message { get; set; }
+ [JsonProperty(PropertyName = "error")]
+ public ErrorResponseError Error { get; set; }
}
}
diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/ErrorResponseError.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/ErrorResponseError.cs
new file mode 100644
index 0000000000000..d80c7b4e1dc9c
--- /dev/null
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/Models/ErrorResponseError.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.PowerBIDedicated.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ ///
+ /// The error object
+ ///
+ public partial class ErrorResponseError
+ {
+ ///
+ /// Initializes a new instance of the ErrorResponseError class.
+ ///
+ public ErrorResponseError()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorResponseError class.
+ ///
+ /// Error code
+ /// Error message indicating why the operation
+ /// failed.
+ public ErrorResponseError(string code = default(string), string message = default(string))
+ {
+ Code = code;
+ Message = message;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets error code
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; set; }
+
+ ///
+ /// Gets or sets error message indicating why the operation failed.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ }
+}
diff --git a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/PowerBIDedicatedManagementClient.cs b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/PowerBIDedicatedManagementClient.cs
index db15520849d09..17b1a7f0c261a 100644
--- a/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/PowerBIDedicatedManagementClient.cs
+++ b/sdk/powerbidedicated/Microsoft.Azure.Management.PowerBIDedicated/src/Generated/PowerBIDedicatedManagementClient.cs
@@ -87,6 +87,19 @@ public partial class PowerBIDedicatedManagementClient : ServiceClient
public virtual IOperations Operations { get; private set; }
+ ///
+ /// Initializes a new instance of the PowerBIDedicatedManagementClient class.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling PowerBIDedicatedManagementClient.Dispose(). False: will not dispose provided httpClient
+ protected PowerBIDedicatedManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
+ {
+ Initialize();
+ }
+
///
/// Initializes a new instance of the PowerBIDedicatedManagementClient class.
///
@@ -182,6 +195,33 @@ public PowerBIDedicatedManagementClient(ServiceClientCredentials credentials, pa
}
}
+ ///
+ /// Initializes a new instance of the PowerBIDedicatedManagementClient class.
+ ///
+ ///
+ /// Required. Credentials needed for the client to connect to Azure.
+ ///
+ ///
+ /// HttpClient to be used
+ ///
+ ///
+ /// True: will dispose the provided httpClient on calling PowerBIDedicatedManagementClient.Dispose(). False: will not dispose provided httpClient
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public PowerBIDedicatedManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
///
/// Initializes a new instance of the PowerBIDedicatedManagementClient class.
///