diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperations.cs
index 8fdcc3d31894..2a1dabf2fd79 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperations.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperations.cs
@@ -51,7 +51,7 @@ internal AddonsOperations(AvsClient client)
public AvsClient Client { get; private set; }
///
- /// List addons in a private cloud
+ /// List Addon resources by PrivateCloud
///
///
/// The name of the resource group. The name is case insensitive.
@@ -65,7 +65,7 @@ internal AddonsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -82,15 +82,15 @@ internal AddonsOperations(AvsClient client)
///
public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -112,15 +112,11 @@ internal AddonsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (Client.ApiVersion == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (Client.ApiVersion != null)
- {
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -138,7 +134,7 @@ internal AddonsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
List _queryParameters = new List();
@@ -206,14 +202,13 @@ internal AddonsOperations(AvsClient 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;
}
}
@@ -223,10 +218,6 @@ internal AddonsOperations(AvsClient 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);
@@ -272,7 +263,7 @@ internal AddonsOperations(AvsClient client)
}
///
- /// Get an addon by name in a private cloud
+ /// Get a Addon
///
///
/// The name of the resource group. The name is case insensitive.
@@ -281,7 +272,7 @@ internal AddonsOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
/// Headers that will be added to request.
@@ -289,7 +280,7 @@ internal AddonsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -306,15 +297,15 @@ internal AddonsOperations(AvsClient client)
///
public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -336,19 +327,22 @@ internal AddonsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (addonName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "addonName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (addonName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "addonName");
}
- if (Client.ApiVersion != null)
+ if (addonName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(addonName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "addonName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -367,7 +361,7 @@ internal AddonsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{addonName}", System.Uri.EscapeDataString(addonName));
@@ -436,14 +430,13 @@ internal AddonsOperations(AvsClient 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;
}
}
@@ -453,10 +446,6 @@ internal AddonsOperations(AvsClient 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);
@@ -502,19 +491,19 @@ internal AddonsOperations(AvsClient client)
}
///
- /// Create or update a addon in a private cloud
+ /// Create a Addon
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
- /// A addon in the private cloud
+ /// Resource create parameters.
///
///
/// The headers that will be added to request.
@@ -522,15 +511,15 @@ internal AddonsOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Addon addon, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Addon addon, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, addon, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, addon, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Delete a addon in a private cloud
+ /// Delete a Addon
///
///
/// The name of the resource group. The name is case insensitive.
@@ -539,7 +528,7 @@ internal AddonsOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
/// The headers that will be added to request.
@@ -547,27 +536,27 @@ internal AddonsOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Create or update a addon in a private cloud
+ /// Create a Addon
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
- /// A addon in the private cloud
+ /// Resource create parameters.
///
///
/// Headers that will be added to request.
@@ -575,7 +564,7 @@ internal AddonsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -590,17 +579,17 @@ internal AddonsOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Addon addon, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Addon addon, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -622,25 +611,28 @@ internal AddonsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (addonName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "addonName");
- }
- if (addon == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "addon");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (addonName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "addonName");
}
- if (Client.ApiVersion != null)
+ if (addonName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(addonName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "addonName", "^[-\\w\\._]+$");
}
}
+ if (addon == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "addon");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -658,7 +650,7 @@ internal AddonsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{addonName}", System.Uri.EscapeDataString(addonName));
@@ -733,14 +725,13 @@ internal AddonsOperations(AvsClient 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;
}
}
@@ -750,10 +741,6 @@ internal AddonsOperations(AvsClient 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);
@@ -766,7 +753,7 @@ internal AddonsOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -809,6 +796,19 @@ internal AddonsOperations(AvsClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -817,7 +817,7 @@ internal AddonsOperations(AvsClient client)
}
///
- /// Delete a addon in a private cloud
+ /// Delete a Addon
///
///
/// The name of the resource group. The name is case insensitive.
@@ -826,7 +826,7 @@ internal AddonsOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
/// Headers that will be added to request.
@@ -834,7 +834,7 @@ internal AddonsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -846,17 +846,17 @@ internal AddonsOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string addonName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -878,19 +878,22 @@ internal AddonsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (addonName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "addonName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (addonName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "addonName");
}
- if (Client.ApiVersion != null)
+ if (addonName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(addonName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "addonName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -909,7 +912,7 @@ internal AddonsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{addonName}", System.Uri.EscapeDataString(addonName));
@@ -978,14 +981,13 @@ internal AddonsOperations(AvsClient 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;
}
}
@@ -995,10 +997,6 @@ internal AddonsOperations(AvsClient 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);
@@ -1011,13 +1009,26 @@ internal AddonsOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationHeaderResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -1026,7 +1037,7 @@ internal AddonsOperations(AvsClient client)
}
///
- /// List addons in a private cloud
+ /// List Addon resources by PrivateCloud
///
///
/// The NextLink from the previous successful call to List operation.
@@ -1037,7 +1048,7 @@ internal AddonsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1133,14 +1144,13 @@ internal AddonsOperations(AvsClient 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;
}
}
@@ -1150,10 +1160,6 @@ internal AddonsOperations(AvsClient 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/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperationsExtensions.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperationsExtensions.cs
index 52be9d23a4c4..cb9a28563d89 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperationsExtensions.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AddonsOperationsExtensions.cs
@@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Avs
public static partial class AddonsOperationsExtensions
{
///
- /// List addons in a private cloud
+ /// List Addon resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -39,7 +39,7 @@ public static IPage List(this IAddonsOperations operations, string resour
}
///
- /// List addons in a private cloud
+ /// List Addon resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -62,7 +62,7 @@ public static IPage List(this IAddonsOperations operations, string resour
}
///
- /// Get an addon by name in a private cloud
+ /// Get a Addon
///
///
/// The operations group for this extension method.
@@ -74,7 +74,7 @@ public static IPage List(this IAddonsOperations operations, string resour
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
public static Addon Get(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName)
{
@@ -82,7 +82,7 @@ public static Addon Get(this IAddonsOperations operations, string resourceGroupN
}
///
- /// Get an addon by name in a private cloud
+ /// Get a Addon
///
///
/// The operations group for this extension method.
@@ -94,7 +94,7 @@ public static Addon Get(this IAddonsOperations operations, string resourceGroupN
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
/// The cancellation token.
@@ -108,7 +108,7 @@ public static Addon Get(this IAddonsOperations operations, string resourceGroupN
}
///
- /// Create or update a addon in a private cloud
+ /// Create a Addon
///
///
/// The operations group for this extension method.
@@ -117,13 +117,13 @@ public static Addon Get(this IAddonsOperations operations, string resourceGroupN
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
- /// A addon in the private cloud
+ /// Resource create parameters.
///
public static Addon CreateOrUpdate(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName, Addon addon)
{
@@ -131,7 +131,7 @@ public static Addon CreateOrUpdate(this IAddonsOperations operations, string res
}
///
- /// Create or update a addon in a private cloud
+ /// Create a Addon
///
///
/// The operations group for this extension method.
@@ -140,13 +140,13 @@ public static Addon CreateOrUpdate(this IAddonsOperations operations, string res
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
- /// A addon in the private cloud
+ /// Resource create parameters.
///
///
/// The cancellation token.
@@ -160,7 +160,7 @@ public static Addon CreateOrUpdate(this IAddonsOperations operations, string res
}
///
- /// Delete a addon in a private cloud
+ /// Delete a Addon
///
///
/// The operations group for this extension method.
@@ -172,15 +172,15 @@ public static Addon CreateOrUpdate(this IAddonsOperations operations, string res
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
- public static void Delete(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName)
+ public static AddonsDeleteHeaders Delete(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName)
{
- operations.DeleteAsync(resourceGroupName, privateCloudName, addonName).GetAwaiter().GetResult();
+ return operations.DeleteAsync(resourceGroupName, privateCloudName, addonName).GetAwaiter().GetResult();
}
///
- /// Delete a addon in a private cloud
+ /// Delete a Addon
///
///
/// The operations group for this extension method.
@@ -192,18 +192,21 @@ public static void Delete(this IAddonsOperations operations, string resourceGrou
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
}
///
- /// Create or update a addon in a private cloud
+ /// Create a Addon
///
///
/// The operations group for this extension method.
@@ -212,13 +215,13 @@ public static void Delete(this IAddonsOperations operations, string resourceGrou
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
- /// A addon in the private cloud
+ /// Resource create parameters.
///
public static Addon BeginCreateOrUpdate(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName, Addon addon)
{
@@ -226,7 +229,7 @@ public static Addon BeginCreateOrUpdate(this IAddonsOperations operations, strin
}
///
- /// Create or update a addon in a private cloud
+ /// Create a Addon
///
///
/// The operations group for this extension method.
@@ -235,13 +238,13 @@ public static Addon BeginCreateOrUpdate(this IAddonsOperations operations, strin
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
- /// A addon in the private cloud
+ /// Resource create parameters.
///
///
/// The cancellation token.
@@ -255,7 +258,7 @@ public static Addon BeginCreateOrUpdate(this IAddonsOperations operations, strin
}
///
- /// Delete a addon in a private cloud
+ /// Delete a Addon
///
///
/// The operations group for this extension method.
@@ -267,15 +270,15 @@ public static Addon BeginCreateOrUpdate(this IAddonsOperations operations, strin
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
- public static void BeginDelete(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName)
+ public static AddonsDeleteHeaders BeginDelete(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName)
{
- operations.BeginDeleteAsync(resourceGroupName, privateCloudName, addonName).GetAwaiter().GetResult();
+ return operations.BeginDeleteAsync(resourceGroupName, privateCloudName, addonName).GetAwaiter().GetResult();
}
///
- /// Delete a addon in a private cloud
+ /// Delete a Addon
///
///
/// The operations group for this extension method.
@@ -287,18 +290,21 @@ public static void BeginDelete(this IAddonsOperations operations, string resourc
/// Name of the private cloud
///
///
- /// Name of the addon for the private cloud
+ /// Name of the addon.
///
///
/// The cancellation token.
///
- public static async Task BeginDeleteAsync(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginDeleteAsync(this IAddonsOperations operations, string resourceGroupName, string privateCloudName, string addonName, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, addonName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
}
///
- /// List addons in a private cloud
+ /// List Addon resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -312,7 +318,7 @@ public static IPage ListNext(this IAddonsOperations operations, string ne
}
///
- /// List addons in a private cloud
+ /// List Addon resources by PrivateCloud
///
///
/// The operations group for this extension method.
diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs
index 54c167fb0ee5..b3afcba16ba5 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperations.cs
@@ -51,7 +51,7 @@ internal AuthorizationsOperations(AvsClient client)
public AvsClient Client { get; private set; }
///
- /// List ExpressRoute Circuit Authorizations in a private cloud
+ /// List ExpressRouteAuthorization resources by PrivateCloud
///
///
/// The name of the resource group. The name is case insensitive.
@@ -65,7 +65,7 @@ internal AuthorizationsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -82,15 +82,15 @@ internal AuthorizationsOperations(AvsClient client)
///
public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -112,15 +112,11 @@ internal AuthorizationsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (Client.ApiVersion == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (Client.ApiVersion != null)
- {
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -138,7 +134,7 @@ internal AuthorizationsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
List _queryParameters = new List();
@@ -206,14 +202,13 @@ internal AuthorizationsOperations(AvsClient 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;
}
}
@@ -223,10 +218,6 @@ internal AuthorizationsOperations(AvsClient 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);
@@ -272,7 +263,7 @@ internal AuthorizationsOperations(AvsClient client)
}
///
- /// Get an ExpressRoute Circuit Authorization by name in a private cloud
+ /// Get a ExpressRouteAuthorization
///
///
/// The name of the resource group. The name is case insensitive.
@@ -281,7 +272,7 @@ internal AuthorizationsOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
/// Headers that will be added to request.
@@ -289,7 +280,7 @@ internal AuthorizationsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -306,15 +297,15 @@ internal AuthorizationsOperations(AvsClient client)
///
public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -336,19 +327,22 @@ internal AuthorizationsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (authorizationName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "authorizationName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (authorizationName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationName");
}
- if (Client.ApiVersion != null)
+ if (authorizationName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(authorizationName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "authorizationName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -367,7 +361,7 @@ internal AuthorizationsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{authorizationName}", System.Uri.EscapeDataString(authorizationName));
@@ -436,14 +430,13 @@ internal AuthorizationsOperations(AvsClient 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;
}
}
@@ -453,10 +446,6 @@ internal AuthorizationsOperations(AvsClient 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);
@@ -502,19 +491,19 @@ internal AuthorizationsOperations(AvsClient client)
}
///
- /// Create or update an ExpressRoute Circuit Authorization in a private cloud
+ /// Create a ExpressRouteAuthorization
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
- /// An ExpressRoute Circuit Authorization
+ /// Resource create parameters.
///
///
/// The headers that will be added to request.
@@ -522,15 +511,15 @@ internal AuthorizationsOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorization authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorization authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, authorization, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, authorization, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Delete an ExpressRoute Circuit Authorization in a private cloud
+ /// Delete a ExpressRouteAuthorization
///
///
/// The name of the resource group. The name is case insensitive.
@@ -539,7 +528,7 @@ internal AuthorizationsOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
/// The headers that will be added to request.
@@ -547,27 +536,27 @@ internal AuthorizationsOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Create or update an ExpressRoute Circuit Authorization in a private cloud
+ /// Create a ExpressRouteAuthorization
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
- /// An ExpressRoute Circuit Authorization
+ /// Resource create parameters.
///
///
/// Headers that will be added to request.
@@ -575,7 +564,7 @@ internal AuthorizationsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -590,17 +579,17 @@ internal AuthorizationsOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorization authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorization authorization, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -622,25 +611,28 @@ internal AuthorizationsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (authorizationName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "authorizationName");
- }
- if (authorization == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "authorization");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (authorizationName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationName");
}
- if (Client.ApiVersion != null)
+ if (authorizationName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(authorizationName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "authorizationName", "^[-\\w\\._]+$");
}
}
+ if (authorization == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorization");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -658,7 +650,7 @@ internal AuthorizationsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{authorizationName}", System.Uri.EscapeDataString(authorizationName));
@@ -733,14 +725,13 @@ internal AuthorizationsOperations(AvsClient 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;
}
}
@@ -750,10 +741,6 @@ internal AuthorizationsOperations(AvsClient 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);
@@ -766,7 +753,7 @@ internal AuthorizationsOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -809,6 +796,19 @@ internal AuthorizationsOperations(AvsClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -817,7 +817,7 @@ internal AuthorizationsOperations(AvsClient client)
}
///
- /// Delete an ExpressRoute Circuit Authorization in a private cloud
+ /// Delete a ExpressRouteAuthorization
///
///
/// The name of the resource group. The name is case insensitive.
@@ -826,7 +826,7 @@ internal AuthorizationsOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
/// Headers that will be added to request.
@@ -834,7 +834,7 @@ internal AuthorizationsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -846,17 +846,17 @@ internal AuthorizationsOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string authorizationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -878,19 +878,22 @@ internal AuthorizationsOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (authorizationName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "authorizationName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (authorizationName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "authorizationName");
}
- if (Client.ApiVersion != null)
+ if (authorizationName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(authorizationName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "authorizationName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -909,7 +912,7 @@ internal AuthorizationsOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{authorizationName}", System.Uri.EscapeDataString(authorizationName));
@@ -978,14 +981,13 @@ internal AuthorizationsOperations(AvsClient 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;
}
}
@@ -995,10 +997,6 @@ internal AuthorizationsOperations(AvsClient 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);
@@ -1011,13 +1009,26 @@ internal AuthorizationsOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationHeaderResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -1026,7 +1037,7 @@ internal AuthorizationsOperations(AvsClient client)
}
///
- /// List ExpressRoute Circuit Authorizations in a private cloud
+ /// List ExpressRouteAuthorization resources by PrivateCloud
///
///
/// The NextLink from the previous successful call to List operation.
@@ -1037,7 +1048,7 @@ internal AuthorizationsOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1133,14 +1144,13 @@ internal AuthorizationsOperations(AvsClient 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;
}
}
@@ -1150,10 +1160,6 @@ internal AuthorizationsOperations(AvsClient 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/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs
index 72d69e7c3ce8..bc78a76c33db 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AuthorizationsOperationsExtensions.cs
@@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Avs
public static partial class AuthorizationsOperationsExtensions
{
///
- /// List ExpressRoute Circuit Authorizations in a private cloud
+ /// List ExpressRouteAuthorization resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -39,7 +39,7 @@ public static IPage List(this IAuthorizationsOperatio
}
///
- /// List ExpressRoute Circuit Authorizations in a private cloud
+ /// List ExpressRouteAuthorization resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -62,7 +62,7 @@ public static IPage List(this IAuthorizationsOperatio
}
///
- /// Get an ExpressRoute Circuit Authorization by name in a private cloud
+ /// Get a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -74,7 +74,7 @@ public static IPage List(this IAuthorizationsOperatio
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
public static ExpressRouteAuthorization Get(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName)
{
@@ -82,7 +82,7 @@ public static ExpressRouteAuthorization Get(this IAuthorizationsOperations opera
}
///
- /// Get an ExpressRoute Circuit Authorization by name in a private cloud
+ /// Get a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -94,7 +94,7 @@ public static ExpressRouteAuthorization Get(this IAuthorizationsOperations opera
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
/// The cancellation token.
@@ -108,7 +108,7 @@ public static ExpressRouteAuthorization Get(this IAuthorizationsOperations opera
}
///
- /// Create or update an ExpressRoute Circuit Authorization in a private cloud
+ /// Create a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -117,13 +117,13 @@ public static ExpressRouteAuthorization Get(this IAuthorizationsOperations opera
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
- /// An ExpressRoute Circuit Authorization
+ /// Resource create parameters.
///
public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorization authorization)
{
@@ -131,7 +131,7 @@ public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOpera
}
///
- /// Create or update an ExpressRoute Circuit Authorization in a private cloud
+ /// Create a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -140,13 +140,13 @@ public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOpera
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
- /// An ExpressRoute Circuit Authorization
+ /// Resource create parameters.
///
///
/// The cancellation token.
@@ -160,7 +160,7 @@ public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOpera
}
///
- /// Delete an ExpressRoute Circuit Authorization in a private cloud
+ /// Delete a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -172,15 +172,15 @@ public static ExpressRouteAuthorization CreateOrUpdate(this IAuthorizationsOpera
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
- public static void Delete(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName)
+ public static AuthorizationsDeleteHeaders Delete(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName)
{
- operations.DeleteAsync(resourceGroupName, privateCloudName, authorizationName).GetAwaiter().GetResult();
+ return operations.DeleteAsync(resourceGroupName, privateCloudName, authorizationName).GetAwaiter().GetResult();
}
///
- /// Delete an ExpressRoute Circuit Authorization in a private cloud
+ /// Delete a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -192,18 +192,21 @@ public static void Delete(this IAuthorizationsOperations operations, string reso
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
}
///
- /// Create or update an ExpressRoute Circuit Authorization in a private cloud
+ /// Create a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -212,13 +215,13 @@ public static void Delete(this IAuthorizationsOperations operations, string reso
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
- /// An ExpressRoute Circuit Authorization
+ /// Resource create parameters.
///
public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, ExpressRouteAuthorization authorization)
{
@@ -226,7 +229,7 @@ public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizations
}
///
- /// Create or update an ExpressRoute Circuit Authorization in a private cloud
+ /// Create a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -235,13 +238,13 @@ public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizations
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
- /// An ExpressRoute Circuit Authorization
+ /// Resource create parameters.
///
///
/// The cancellation token.
@@ -255,7 +258,7 @@ public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizations
}
///
- /// Delete an ExpressRoute Circuit Authorization in a private cloud
+ /// Delete a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -267,15 +270,15 @@ public static ExpressRouteAuthorization BeginCreateOrUpdate(this IAuthorizations
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
- public static void BeginDelete(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName)
+ public static AuthorizationsDeleteHeaders BeginDelete(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName)
{
- operations.BeginDeleteAsync(resourceGroupName, privateCloudName, authorizationName).GetAwaiter().GetResult();
+ return operations.BeginDeleteAsync(resourceGroupName, privateCloudName, authorizationName).GetAwaiter().GetResult();
}
///
- /// Delete an ExpressRoute Circuit Authorization in a private cloud
+ /// Delete a ExpressRouteAuthorization
///
///
/// The operations group for this extension method.
@@ -287,18 +290,21 @@ public static void BeginDelete(this IAuthorizationsOperations operations, string
/// Name of the private cloud
///
///
- /// Name of the ExpressRoute Circuit Authorization in the private cloud
+ /// Name of the ExpressRoute Circuit Authorization
///
///
/// The cancellation token.
///
- public static async Task BeginDeleteAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginDeleteAsync(this IAuthorizationsOperations operations, string resourceGroupName, string privateCloudName, string authorizationName, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, authorizationName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
}
///
- /// List ExpressRoute Circuit Authorizations in a private cloud
+ /// List ExpressRouteAuthorization resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -312,7 +318,7 @@ public static IPage ListNext(this IAuthorizationsOper
}
///
- /// List ExpressRoute Circuit Authorizations in a private cloud
+ /// List ExpressRouteAuthorization resources by PrivateCloud
///
///
/// The operations group for this extension method.
diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs
index 7a769ff600af..3bb04f12c3e8 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/AvsClient.cs
@@ -47,14 +47,14 @@ public partial class AvsClient : ServiceClient, IAvsClient, IAzureCli
public ServiceClientCredentials Credentials { get; private set; }
///
- /// The API version to use for this operation.
+ /// The ID of the target subscription. The value must be an UUID.
///
- public string ApiVersion { get; private set; }
+ public System.Guid SubscriptionId { get; set; }
///
- /// The ID of the target subscription.
+ /// The API version to use for this operation.
///
- public string SubscriptionId { get; set; }
+ public string ApiVersion { get; private set; }
///
/// The preferred language for the response.
@@ -90,54 +90,59 @@ public partial class AvsClient : ServiceClient, IAvsClient, IAzureCli
public virtual IPrivateCloudsOperations PrivateClouds { get; private set; }
///
- /// Gets the IClustersOperations.
+ /// Gets the IAddonsOperations.
///
- public virtual IClustersOperations Clusters { get; private set; }
+ public virtual IAddonsOperations Addons { get; private set; }
///
- /// Gets the IDatastoresOperations.
+ /// Gets the IAuthorizationsOperations.
///
- public virtual IDatastoresOperations Datastores { get; private set; }
+ public virtual IAuthorizationsOperations Authorizations { get; private set; }
///
- /// Gets the IHcxEnterpriseSitesOperations.
+ /// Gets the ICloudLinksOperations.
///
- public virtual IHcxEnterpriseSitesOperations HcxEnterpriseSites { get; private set; }
+ public virtual ICloudLinksOperations CloudLinks { get; private set; }
///
- /// Gets the IAuthorizationsOperations.
+ /// Gets the IClustersOperations.
///
- public virtual IAuthorizationsOperations Authorizations { get; private set; }
+ public virtual IClustersOperations Clusters { get; private set; }
///
- /// Gets the IGlobalReachConnectionsOperations.
+ /// Gets the IDatastoresOperations.
///
- public virtual IGlobalReachConnectionsOperations GlobalReachConnections { get; private set; }
+ public virtual IDatastoresOperations Datastores { get; private set; }
///
- /// Gets the IWorkloadNetworksOperations.
+ /// Gets the IPlacementPoliciesOperations.
///
- public virtual IWorkloadNetworksOperations WorkloadNetworks { get; private set; }
+ public virtual IPlacementPoliciesOperations PlacementPolicies { get; private set; }
///
- /// Gets the ICloudLinksOperations.
+ /// Gets the IVirtualMachinesOperations.
///
- public virtual ICloudLinksOperations CloudLinks { get; private set; }
+ public virtual IVirtualMachinesOperations VirtualMachines { get; private set; }
///
- /// Gets the IAddonsOperations.
+ /// Gets the IGlobalReachConnectionsOperations.
///
- public virtual IAddonsOperations Addons { get; private set; }
+ public virtual IGlobalReachConnectionsOperations GlobalReachConnections { get; private set; }
///
- /// Gets the IVirtualMachinesOperations.
+ /// Gets the IHcxEnterpriseSitesOperations.
///
- public virtual IVirtualMachinesOperations VirtualMachines { get; private set; }
+ public virtual IHcxEnterpriseSitesOperations HcxEnterpriseSites { get; private set; }
///
- /// Gets the IPlacementPoliciesOperations.
+ /// Gets the IIscsiPathsOperations.
///
- public virtual IPlacementPoliciesOperations PlacementPolicies { get; private set; }
+ public virtual IIscsiPathsOperations IscsiPaths { get; private set; }
+
+ ///
+ /// Gets the IScriptExecutionsOperations.
+ ///
+ public virtual IScriptExecutionsOperations ScriptExecutions { get; private set; }
///
/// Gets the IScriptPackagesOperations.
@@ -150,9 +155,9 @@ public partial class AvsClient : ServiceClient, IAvsClient, IAzureCli
public virtual IScriptCmdletsOperations ScriptCmdlets { get; private set; }
///
- /// Gets the IScriptExecutionsOperations.
+ /// Gets the IWorkloadNetworksOperations.
///
- public virtual IScriptExecutionsOperations ScriptExecutions { get; private set; }
+ public virtual IWorkloadNetworksOperations WorkloadNetworks { get; private set; }
///
/// Initializes a new instance of the AvsClient class.
@@ -398,21 +403,22 @@ private void Initialize()
Operations = new Operations(this);
Locations = new LocationsOperations(this);
PrivateClouds = new PrivateCloudsOperations(this);
- Clusters = new ClustersOperations(this);
- Datastores = new DatastoresOperations(this);
- HcxEnterpriseSites = new HcxEnterpriseSitesOperations(this);
+ Addons = new AddonsOperations(this);
Authorizations = new AuthorizationsOperations(this);
- GlobalReachConnections = new GlobalReachConnectionsOperations(this);
- WorkloadNetworks = new WorkloadNetworksOperations(this);
CloudLinks = new CloudLinksOperations(this);
- Addons = new AddonsOperations(this);
- VirtualMachines = new VirtualMachinesOperations(this);
+ Clusters = new ClustersOperations(this);
+ Datastores = new DatastoresOperations(this);
PlacementPolicies = new PlacementPoliciesOperations(this);
+ VirtualMachines = new VirtualMachinesOperations(this);
+ GlobalReachConnections = new GlobalReachConnectionsOperations(this);
+ HcxEnterpriseSites = new HcxEnterpriseSitesOperations(this);
+ IscsiPaths = new IscsiPathsOperations(this);
+ ScriptExecutions = new ScriptExecutionsOperations(this);
ScriptPackages = new ScriptPackagesOperations(this);
ScriptCmdlets = new ScriptCmdletsOperations(this);
- ScriptExecutions = new ScriptExecutionsOperations(this);
+ WorkloadNetworks = new WorkloadNetworksOperations(this);
BaseUri = new System.Uri("https://management.azure.com");
- ApiVersion = "2021-12-01";
+ ApiVersion = "2023-09-01";
AcceptLanguage = "en-US";
LongRunningOperationRetryTimeout = 30;
GenerateClientRequestId = true;
@@ -444,12 +450,12 @@ private void Initialize()
};
SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("addonType"));
DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("addonType"));
- SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("dhcpType"));
- DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("dhcpType"));
SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type"));
DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type"));
SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("type"));
DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("type"));
+ SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("dhcpType"));
+ DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("dhcpType"));
CustomInitialize();
DeserializationSettings.Converters.Add(new TransformationJsonConverter());
DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperations.cs
index 441d86610183..d4aa6fa82749 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperations.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperations.cs
@@ -51,7 +51,7 @@ internal CloudLinksOperations(AvsClient client)
public AvsClient Client { get; private set; }
///
- /// List cloud link in a private cloud
+ /// List CloudLink resources by PrivateCloud
///
///
/// The name of the resource group. The name is case insensitive.
@@ -65,7 +65,7 @@ internal CloudLinksOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -82,15 +82,15 @@ internal CloudLinksOperations(AvsClient client)
///
public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -112,15 +112,11 @@ internal CloudLinksOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (Client.ApiVersion == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (Client.ApiVersion != null)
- {
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -138,7 +134,7 @@ internal CloudLinksOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
List _queryParameters = new List();
@@ -206,14 +202,13 @@ internal CloudLinksOperations(AvsClient 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;
}
}
@@ -223,10 +218,6 @@ internal CloudLinksOperations(AvsClient 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);
@@ -272,7 +263,7 @@ internal CloudLinksOperations(AvsClient client)
}
///
- /// Get an cloud link by name in a private cloud
+ /// Get a CloudLink
///
///
/// The name of the resource group. The name is case insensitive.
@@ -281,7 +272,7 @@ internal CloudLinksOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
/// Headers that will be added to request.
@@ -289,7 +280,7 @@ internal CloudLinksOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -306,15 +297,15 @@ internal CloudLinksOperations(AvsClient client)
///
public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -336,19 +327,22 @@ internal CloudLinksOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (cloudLinkName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "cloudLinkName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (cloudLinkName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "cloudLinkName");
}
- if (Client.ApiVersion != null)
+ if (cloudLinkName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(cloudLinkName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "cloudLinkName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -367,7 +361,7 @@ internal CloudLinksOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{cloudLinkName}", System.Uri.EscapeDataString(cloudLinkName));
@@ -436,14 +430,13 @@ internal CloudLinksOperations(AvsClient 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;
}
}
@@ -453,10 +446,6 @@ internal CloudLinksOperations(AvsClient 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);
@@ -502,19 +491,19 @@ internal CloudLinksOperations(AvsClient client)
}
///
- /// Create or update a cloud link in a private cloud
+ /// Create a CloudLink
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
- /// A cloud link in the private cloud
+ /// Resource create parameters.
///
///
/// The headers that will be added to request.
@@ -522,15 +511,15 @@ internal CloudLinksOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLink cloudLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLink cloudLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, cloudLink, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, cloudLink, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Delete a cloud link in a private cloud
+ /// Delete a CloudLink
///
///
/// The name of the resource group. The name is case insensitive.
@@ -539,7 +528,7 @@ internal CloudLinksOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
/// The headers that will be added to request.
@@ -547,27 +536,27 @@ internal CloudLinksOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Create or update a cloud link in a private cloud
+ /// Create a CloudLink
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
- /// A cloud link in the private cloud
+ /// Resource create parameters.
///
///
/// Headers that will be added to request.
@@ -575,7 +564,7 @@ internal CloudLinksOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -590,17 +579,17 @@ internal CloudLinksOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLink cloudLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLink cloudLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -622,25 +611,28 @@ internal CloudLinksOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (cloudLinkName == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "cloudLinkName");
- }
- if (cloudLink == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "cloudLink");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (cloudLinkName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "cloudLinkName");
}
- if (Client.ApiVersion != null)
+ if (cloudLinkName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(cloudLinkName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "cloudLinkName", "^[-\\w\\._]+$");
}
}
+ if (cloudLink == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "cloudLink");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -658,7 +650,7 @@ internal CloudLinksOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{cloudLinkName}", System.Uri.EscapeDataString(cloudLinkName));
@@ -733,14 +725,13 @@ internal CloudLinksOperations(AvsClient 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;
}
}
@@ -750,10 +741,6 @@ internal CloudLinksOperations(AvsClient 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);
@@ -766,7 +753,7 @@ internal CloudLinksOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -809,6 +796,19 @@ internal CloudLinksOperations(AvsClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -817,7 +817,7 @@ internal CloudLinksOperations(AvsClient client)
}
///
- /// Delete a cloud link in a private cloud
+ /// Delete a CloudLink
///
///
/// The name of the resource group. The name is case insensitive.
@@ -826,7 +826,7 @@ internal CloudLinksOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
/// Headers that will be added to request.
@@ -834,7 +834,7 @@ internal CloudLinksOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -846,17 +846,17 @@ internal CloudLinksOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string cloudLinkName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -878,19 +878,22 @@ internal CloudLinksOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (cloudLinkName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "cloudLinkName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (cloudLinkName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "cloudLinkName");
}
- if (Client.ApiVersion != null)
+ if (cloudLinkName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(cloudLinkName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "cloudLinkName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -909,7 +912,7 @@ internal CloudLinksOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{cloudLinkName}", System.Uri.EscapeDataString(cloudLinkName));
@@ -978,14 +981,13 @@ internal CloudLinksOperations(AvsClient 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;
}
}
@@ -995,10 +997,6 @@ internal CloudLinksOperations(AvsClient 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);
@@ -1011,13 +1009,26 @@ internal CloudLinksOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationHeaderResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -1026,7 +1037,7 @@ internal CloudLinksOperations(AvsClient client)
}
///
- /// List cloud link in a private cloud
+ /// List CloudLink resources by PrivateCloud
///
///
/// The NextLink from the previous successful call to List operation.
@@ -1037,7 +1048,7 @@ internal CloudLinksOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1133,14 +1144,13 @@ internal CloudLinksOperations(AvsClient 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;
}
}
@@ -1150,10 +1160,6 @@ internal CloudLinksOperations(AvsClient 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/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperationsExtensions.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperationsExtensions.cs
index 6289d908c12a..f37e1e8a87f9 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperationsExtensions.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/CloudLinksOperationsExtensions.cs
@@ -22,7 +22,7 @@ namespace Microsoft.Azure.Management.Avs
public static partial class CloudLinksOperationsExtensions
{
///
- /// List cloud link in a private cloud
+ /// List CloudLink resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -39,7 +39,7 @@ public static IPage List(this ICloudLinksOperations operations, strin
}
///
- /// List cloud link in a private cloud
+ /// List CloudLink resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -62,7 +62,7 @@ public static IPage List(this ICloudLinksOperations operations, strin
}
///
- /// Get an cloud link by name in a private cloud
+ /// Get a CloudLink
///
///
/// The operations group for this extension method.
@@ -74,7 +74,7 @@ public static IPage List(this ICloudLinksOperations operations, strin
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
public static CloudLink Get(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName)
{
@@ -82,7 +82,7 @@ public static CloudLink Get(this ICloudLinksOperations operations, string resour
}
///
- /// Get an cloud link by name in a private cloud
+ /// Get a CloudLink
///
///
/// The operations group for this extension method.
@@ -94,7 +94,7 @@ public static CloudLink Get(this ICloudLinksOperations operations, string resour
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
/// The cancellation token.
@@ -108,7 +108,7 @@ public static CloudLink Get(this ICloudLinksOperations operations, string resour
}
///
- /// Create or update a cloud link in a private cloud
+ /// Create a CloudLink
///
///
/// The operations group for this extension method.
@@ -117,13 +117,13 @@ public static CloudLink Get(this ICloudLinksOperations operations, string resour
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
- /// A cloud link in the private cloud
+ /// Resource create parameters.
///
public static CloudLink CreateOrUpdate(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLink cloudLink)
{
@@ -131,7 +131,7 @@ public static CloudLink CreateOrUpdate(this ICloudLinksOperations operations, st
}
///
- /// Create or update a cloud link in a private cloud
+ /// Create a CloudLink
///
///
/// The operations group for this extension method.
@@ -140,13 +140,13 @@ public static CloudLink CreateOrUpdate(this ICloudLinksOperations operations, st
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
- /// A cloud link in the private cloud
+ /// Resource create parameters.
///
///
/// The cancellation token.
@@ -160,7 +160,7 @@ public static CloudLink CreateOrUpdate(this ICloudLinksOperations operations, st
}
///
- /// Delete a cloud link in a private cloud
+ /// Delete a CloudLink
///
///
/// The operations group for this extension method.
@@ -172,15 +172,15 @@ public static CloudLink CreateOrUpdate(this ICloudLinksOperations operations, st
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
- public static void Delete(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName)
+ public static CloudLinksDeleteHeaders Delete(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName)
{
- operations.DeleteAsync(resourceGroupName, privateCloudName, cloudLinkName).GetAwaiter().GetResult();
+ return operations.DeleteAsync(resourceGroupName, privateCloudName, cloudLinkName).GetAwaiter().GetResult();
}
///
- /// Delete a cloud link in a private cloud
+ /// Delete a CloudLink
///
///
/// The operations group for this extension method.
@@ -192,18 +192,21 @@ public static void Delete(this ICloudLinksOperations operations, string resource
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
/// The cancellation token.
///
- public static async Task DeleteAsync(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task DeleteAsync(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
}
///
- /// Create or update a cloud link in a private cloud
+ /// Create a CloudLink
///
///
/// The operations group for this extension method.
@@ -212,13 +215,13 @@ public static void Delete(this ICloudLinksOperations operations, string resource
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
- /// A cloud link in the private cloud
+ /// Resource create parameters.
///
public static CloudLink BeginCreateOrUpdate(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName, CloudLink cloudLink)
{
@@ -226,7 +229,7 @@ public static CloudLink BeginCreateOrUpdate(this ICloudLinksOperations operation
}
///
- /// Create or update a cloud link in a private cloud
+ /// Create a CloudLink
///
///
/// The operations group for this extension method.
@@ -235,13 +238,13 @@ public static CloudLink BeginCreateOrUpdate(this ICloudLinksOperations operation
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
- /// A cloud link in the private cloud
+ /// Resource create parameters.
///
///
/// The cancellation token.
@@ -255,7 +258,7 @@ public static CloudLink BeginCreateOrUpdate(this ICloudLinksOperations operation
}
///
- /// Delete a cloud link in a private cloud
+ /// Delete a CloudLink
///
///
/// The operations group for this extension method.
@@ -267,15 +270,15 @@ public static CloudLink BeginCreateOrUpdate(this ICloudLinksOperations operation
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
- public static void BeginDelete(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName)
+ public static CloudLinksDeleteHeaders BeginDelete(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName)
{
- operations.BeginDeleteAsync(resourceGroupName, privateCloudName, cloudLinkName).GetAwaiter().GetResult();
+ return operations.BeginDeleteAsync(resourceGroupName, privateCloudName, cloudLinkName).GetAwaiter().GetResult();
}
///
- /// Delete a cloud link in a private cloud
+ /// Delete a CloudLink
///
///
/// The operations group for this extension method.
@@ -287,18 +290,21 @@ public static void BeginDelete(this ICloudLinksOperations operations, string res
/// Name of the private cloud
///
///
- /// Name of the cloud link resource
+ /// Name of the cloud link.
///
///
/// The cancellation token.
///
- public static async Task BeginDeleteAsync(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default(CancellationToken))
+ public static async Task BeginDeleteAsync(this ICloudLinksOperations operations, string resourceGroupName, string privateCloudName, string cloudLinkName, CancellationToken cancellationToken = default(CancellationToken))
{
- (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, cloudLinkName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Headers;
+ }
}
///
- /// List cloud link in a private cloud
+ /// List CloudLink resources by PrivateCloud
///
///
/// The operations group for this extension method.
@@ -312,7 +318,7 @@ public static IPage ListNext(this ICloudLinksOperations operations, s
}
///
- /// List cloud link in a private cloud
+ /// List CloudLink resources by PrivateCloud
///
///
/// The operations group for this extension method.
diff --git a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/ClustersOperations.cs b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/ClustersOperations.cs
index 7914c7f66e4c..182146130d16 100644
--- a/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/ClustersOperations.cs
+++ b/sdk/avs/Microsoft.Azure.Management.Avs/src/Generated/ClustersOperations.cs
@@ -51,7 +51,7 @@ internal ClustersOperations(AvsClient client)
public AvsClient Client { get; private set; }
///
- /// List clusters in a private cloud
+ /// List Cluster resources by PrivateCloud
///
///
/// The name of the resource group. The name is case insensitive.
@@ -65,7 +65,7 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -82,15 +82,15 @@ internal ClustersOperations(AvsClient client)
///
public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -112,15 +112,11 @@ internal ClustersOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (Client.ApiVersion == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
- }
- if (Client.ApiVersion != null)
- {
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -138,7 +134,7 @@ internal ClustersOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
List _queryParameters = new List();
@@ -206,14 +202,13 @@ internal ClustersOperations(AvsClient 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;
}
}
@@ -223,10 +218,6 @@ internal ClustersOperations(AvsClient 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);
@@ -272,7 +263,7 @@ internal ClustersOperations(AvsClient client)
}
///
- /// Get a cluster by name in a private cloud
+ /// Get a Cluster
///
///
/// The name of the resource group. The name is case insensitive.
@@ -281,7 +272,7 @@ internal ClustersOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cluster in the private cloud
+ /// Name of the cluster
///
///
/// Headers that will be added to request.
@@ -289,7 +280,7 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -306,15 +297,15 @@ internal ClustersOperations(AvsClient client)
///
public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -336,19 +327,22 @@ internal ClustersOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (clusterName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (clusterName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
}
- if (Client.ApiVersion != null)
+ if (clusterName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(clusterName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "clusterName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -367,7 +361,7 @@ internal ClustersOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
@@ -436,14 +430,13 @@ internal ClustersOperations(AvsClient 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;
}
}
@@ -453,10 +446,6 @@ internal ClustersOperations(AvsClient 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);
@@ -502,19 +491,19 @@ internal ClustersOperations(AvsClient client)
}
///
- /// Create or update a cluster in a private cloud
+ /// Create a Cluster
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cluster in the private cloud
+ /// Name of the cluster
///
///
- /// A cluster in the private cloud
+ /// Resource create parameters.
///
///
/// The headers that will be added to request.
@@ -522,15 +511,15 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Cluster cluster, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Cluster cluster, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, clusterName, cluster, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, clusterName, cluster, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Update a cluster in a private cloud
+ /// Update a Cluster
///
///
/// The name of the resource group. The name is case insensitive.
@@ -539,10 +528,10 @@ internal ClustersOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cluster in the private cloud
+ /// Name of the cluster
///
///
- /// The cluster properties to be updated
+ /// The cluster properties to be updated.
///
///
/// The headers that will be added to request.
@@ -550,15 +539,15 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, clusterName, clusterUpdate, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, privateCloudName, clusterName, clusterUpdate, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Delete a cluster in a private cloud
+ /// Delete a Cluster
///
///
/// The name of the resource group. The name is case insensitive.
@@ -567,7 +556,7 @@ internal ClustersOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cluster in the private cloud
+ /// Name of the cluster
///
///
/// The headers that will be added to request.
@@ -575,27 +564,24 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, clusterName, customHeaders, cancellationToken).ConfigureAwait(false);
+ AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, privateCloudName, clusterName, customHeaders, cancellationToken).ConfigureAwait(false);
return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
- /// Create or update a cluster in a private cloud
+ /// List hosts by zone in a cluster
///
///
/// The name of the resource group. The name is case insensitive.
///
///
- /// The name of the private cloud.
+ /// Name of the private cloud
///
///
- /// Name of the cluster in the private cloud
- ///
- ///
- /// A cluster in the private cloud
+ /// Name of the cluster
///
///
/// Headers that will be added to request.
@@ -603,7 +589,7 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -618,17 +604,17 @@ internal ClustersOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Cluster cluster, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> ListZonesWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -650,18 +636,207 @@ internal ClustersOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
+ if (privateCloudName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
+ }
if (clusterName == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
}
- if (cluster == null)
+ if (clusterName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "cluster");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(clusterName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "clusterName", "^[-\\w\\._]+$");
+ }
}
- if (cluster != null)
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
{
- cluster.Validate();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("privateCloudName", privateCloudName);
+ tracingParameters.Add("clusterName", clusterName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListZones", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
+ _url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
+ 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;
+ // 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;
+ }
+
+ ///
+ /// Create a Cluster
+ ///
+ ///
+ /// The name of the resource group. The name is case insensitive.
+ ///
+ ///
+ /// Name of the private cloud
+ ///
+ ///
+ /// Name of the cluster
+ ///
+ ///
+ /// Resource create parameters.
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Cluster cluster, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
if (Client.ApiVersion == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
@@ -673,6 +848,51 @@ internal ClustersOperations(AvsClient client)
throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (resourceGroupName != null)
+ {
+ if (resourceGroupName.Length > 90)
+ {
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
+ }
+ if (resourceGroupName.Length < 1)
+ {
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
+ }
+ }
+ if (privateCloudName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
+ }
+ if (privateCloudName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
+ }
+ if (clusterName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
+ }
+ if (clusterName != null)
+ {
+ if (!System.Text.RegularExpressions.Regex.IsMatch(clusterName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "clusterName", "^[-\\w\\._]+$");
+ }
+ }
+ if (cluster == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "cluster");
+ }
+ if (cluster != null)
+ {
+ cluster.Validate();
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -690,7 +910,7 @@ internal ClustersOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
@@ -765,14 +985,13 @@ internal ClustersOperations(AvsClient 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;
}
}
@@ -782,10 +1001,6 @@ internal ClustersOperations(AvsClient 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);
@@ -798,7 +1013,7 @@ internal ClustersOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -841,6 +1056,19 @@ internal ClustersOperations(AvsClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -849,7 +1077,7 @@ internal ClustersOperations(AvsClient client)
}
///
- /// Update a cluster in a private cloud
+ /// Update a Cluster
///
///
/// The name of the resource group. The name is case insensitive.
@@ -858,10 +1086,10 @@ internal ClustersOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cluster in the private cloud
+ /// Name of the cluster
///
///
- /// The cluster properties to be updated
+ /// The cluster properties to be updated.
///
///
/// Headers that will be added to request.
@@ -869,7 +1097,7 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -884,17 +1112,17 @@ internal ClustersOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, ClusterUpdate clusterUpdate, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -916,25 +1144,28 @@ internal ClustersOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (clusterName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
- }
- if (clusterUpdate == null)
- {
- throw new ValidationException(ValidationRules.CannotBeNull, "clusterUpdate");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (clusterName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
}
- if (Client.ApiVersion != null)
+ if (clusterName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(clusterName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "clusterName", "^[-\\w\\._]+$");
}
}
+ if (clusterUpdate == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "clusterUpdate");
+ }
// Tracing
bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
@@ -952,7 +1183,7 @@ internal ClustersOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
@@ -1027,14 +1258,13 @@ internal ClustersOperations(AvsClient 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;
}
}
@@ -1044,10 +1274,6 @@ internal ClustersOperations(AvsClient 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);
@@ -1060,7 +1286,7 @@ internal ClustersOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1103,6 +1329,19 @@ internal ClustersOperations(AvsClient client)
throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
+ try
+ {
+ _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings));
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex);
+ }
if (_shouldTrace)
{
ServiceClientTracing.Exit(_invocationId, _result);
@@ -1111,7 +1350,7 @@ internal ClustersOperations(AvsClient client)
}
///
- /// Delete a cluster in a private cloud
+ /// Delete a Cluster
///
///
/// The name of the resource group. The name is case insensitive.
@@ -1120,7 +1359,7 @@ internal ClustersOperations(AvsClient client)
/// Name of the private cloud
///
///
- /// Name of the cluster in the private cloud
+ /// Name of the cluster
///
///
/// Headers that will be added to request.
@@ -1128,7 +1367,7 @@ internal ClustersOperations(AvsClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
///
@@ -1140,17 +1379,17 @@ internal ClustersOperations(AvsClient client)
///
/// A response object containing the response body and response headers.
///
- public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string privateCloudName, string clusterName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (Client.SubscriptionId == null)
+ if (Client.ApiVersion == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (Client.SubscriptionId != null)
+ if (Client.ApiVersion != null)
{
- if (Client.SubscriptionId.Length < 1)
+ if (Client.ApiVersion.Length < 1)
{
- throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1);
+ throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
}
}
if (resourceGroupName == null)
@@ -1172,19 +1411,22 @@ internal ClustersOperations(AvsClient client)
{
throw new ValidationException(ValidationRules.CannotBeNull, "privateCloudName");
}
- if (clusterName == null)
+ if (privateCloudName != null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
+ if (!System.Text.RegularExpressions.Regex.IsMatch(privateCloudName, "^[-\\w\\._]+$"))
+ {
+ throw new ValidationException(ValidationRules.Pattern, "privateCloudName", "^[-\\w\\._]+$");
+ }
}
- if (Client.ApiVersion == null)
+ if (clusterName == null)
{
- throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "clusterName");
}
- if (Client.ApiVersion != null)
+ if (clusterName != null)
{
- if (Client.ApiVersion.Length < 1)
+ if (!System.Text.RegularExpressions.Regex.IsMatch(clusterName, "^[-\\w\\._]+$"))
{
- throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1);
+ throw new ValidationException(ValidationRules.Pattern, "clusterName", "^[-\\w\\._]+$");
}
}
// Tracing
@@ -1203,7 +1445,7 @@ internal ClustersOperations(AvsClient client)
// Construct URL
var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.SubscriptionId, Client.SerializationSettings).Trim('"')));
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{privateCloudName}", System.Uri.EscapeDataString(privateCloudName));
_url = _url.Replace("{clusterName}", System.Uri.EscapeDataString(clusterName));
@@ -1272,14 +1514,13 @@ internal ClustersOperations(AvsClient 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;
}
}
@@ -1289,10 +1530,6 @@ internal ClustersOperations(AvsClient 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);
@@ -1305,13 +1542,26 @@ internal ClustersOperations(AvsClient client)
throw ex;
}
// Create Result
- var _result = new AzureOperationResponse();
+ var _result = new AzureOperationHeaderResponse