diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperations.cs
index eb28ce7ec39d..853f52d5a881 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperations.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperations.cs
@@ -1,22 +1,31 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
- using System.Linq;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// DeploymentOperations operations.
///
- internal partial class DeploymentOperations : Microsoft.Rest.IServiceOperations, IDeploymentOperations
+ internal partial class DeploymentOperations : IServiceOperations, IDeploymentOperations
{
///
/// Initializes a new instance of the DeploymentOperations class.
@@ -29,11 +38,11 @@ internal partial class DeploymentOperations : Microsoft.Rest.IServiceOperations<
///
internal DeploymentOperations(ResourceManagementClient client)
{
- if (client == null)
+ if (client == null)
{
throw new System.ArgumentNullException("client");
}
- this.Client = client;
+ Client = client;
}
///
@@ -59,117 +68,122 @@ internal DeploymentOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string operationId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
if (operationId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "operationId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "operationId");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("operationId", operationId);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
_url = _url.Replace("{operationId}", System.Uri.EscapeDataString(operationId));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -185,51 +199,51 @@ internal DeploymentOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -239,7 +253,7 @@ internal DeploymentOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -252,21 +266,21 @@ internal DeploymentOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -289,116 +303,121 @@ internal DeploymentOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string deploymentName, int? top = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(string resourceGroupName, string deploymentName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("top", top);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
if (top != null)
{
- _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(top, this.Client.SerializationSettings).Trim('"'))));
+ _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"'))));
}
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -414,51 +433,51 @@ internal DeploymentOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -468,7 +487,7 @@ internal DeploymentOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -481,21 +500,21 @@ internal DeploymentOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -512,61 +531,66 @@ internal DeploymentOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink");
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -582,51 +606,51 @@ internal DeploymentOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -636,7 +660,7 @@ internal DeploymentOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -649,21 +673,21 @@ internal DeploymentOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperationsExtensions.cs
index cbbaacbe9a7d..0e89031416e8 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperationsExtensions.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentOperationsExtensions.cs
@@ -1,16 +1,20 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
using System.Threading.Tasks;
- using Microsoft.Rest.Azure;
- using Models;
///
/// Extension methods for DeploymentOperations.
@@ -34,7 +38,7 @@ public static partial class DeploymentOperationsExtensions
///
public static DeploymentOperation Get(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, string operationId)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentOperations)s).GetAsync(resourceGroupName, deploymentName, operationId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, deploymentName, operationId).GetAwaiter().GetResult();
}
///
@@ -55,7 +59,7 @@ public static DeploymentOperation Get(this IDeploymentOperations operations, str
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task GetAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task GetAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, string operationId, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, deploymentName, operationId, null, cancellationToken).ConfigureAwait(false))
{
@@ -78,9 +82,9 @@ public static DeploymentOperation Get(this IDeploymentOperations operations, str
///
/// The number of results to return.
///
- public static Microsoft.Rest.Azure.IPage List(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, int? top = default(int?))
+ public static IPage List(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, int? top = default(int?))
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentOperations)s).ListAsync(resourceGroupName, deploymentName, top), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListAsync(resourceGroupName, deploymentName, top).GetAwaiter().GetResult();
}
///
@@ -101,7 +105,7 @@ public static DeploymentOperation Get(this IDeploymentOperations operations, str
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListAsync(this IDeploymentOperations operations, string resourceGroupName, string deploymentName, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, deploymentName, top, null, cancellationToken).ConfigureAwait(false))
{
@@ -118,9 +122,9 @@ public static DeploymentOperation Get(this IDeploymentOperations operations, str
///
/// The NextLink from the previous successful call to List operation.
///
- public static Microsoft.Rest.Azure.IPage ListNext(this IDeploymentOperations operations, string nextPageLink)
+ public static IPage ListNext(this IDeploymentOperations operations, string nextPageLink)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentOperations)s).ListNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
}
///
@@ -135,7 +139,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this IDep
///
/// The cancellation token.
///
- public static async Task> ListNextAsync(this IDeploymentOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListNextAsync(this IDeploymentOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
{
diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperations.cs
index 3dca763a7bf9..4b5a58826eb9 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperations.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperations.cs
@@ -1,22 +1,32 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
- using System.Linq;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// DeploymentsOperations operations.
///
- internal partial class DeploymentsOperations : Microsoft.Rest.IServiceOperations, IDeploymentsOperations
+ internal partial class DeploymentsOperations : IServiceOperations, IDeploymentsOperations
{
///
/// Initializes a new instance of the DeploymentsOperations class.
@@ -29,11 +39,11 @@ internal partial class DeploymentsOperations : Microsoft.Rest.IServiceOperations
///
internal DeploymentsOperations(ResourceManagementClient client)
{
- if (client == null)
+ if (client == null)
{
throw new System.ArgumentNullException("client");
}
- this.Client = client;
+ Client = client;
}
///
@@ -45,17 +55,16 @@ internal DeploymentsOperations(ResourceManagementClient client)
/// Deletes a deployment from the deployment history.
///
///
- /// A template deployment that is currently running cannot be deleted.
- /// Deleting a template deployment removes the associated deployment
- /// operations. Deleting a template deployment does not affect the state of
- /// the resource group. This is an asynchronous operation that returns a
- /// status of 202 until the template deployment is successfully deleted. The
- /// Location response header contains the URI that is used to obtain the
- /// status of the process. While the process is running, a call to the URI in
- /// the Location header returns a status of 202. When the process finishes,
- /// the URI in the Location header returns a status of 204 on success. If the
- /// asynchronous request failed, the URI in the Location header returns an
- /// error-level status code.
+ /// A template deployment that is currently running cannot be deleted. Deleting
+ /// a template deployment removes the associated deployment operations.
+ /// Deleting a template deployment does not affect the state of the resource
+ /// group. This is an asynchronous operation that returns a status of 202 until
+ /// the template deployment is successfully deleted. The Location response
+ /// header contains the URI that is used to obtain the status of the process.
+ /// While the process is running, a call to the URI in the Location header
+ /// returns a status of 202. When the process finishes, the URI in the Location
+ /// header returns a status of 204 on success. If the asynchronous request
+ /// failed, the URI in the Location header returns an error-level status code.
///
///
/// The name of the resource group with the deployment to delete. The name is
@@ -70,12 +79,11 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send request
- Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(
- resourceGroupName, deploymentName, customHeaders, cancellationToken);
- return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken);
+ AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
@@ -94,108 +102,113 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CheckExistence", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "CheckExistence", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("HEAD");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("HEAD");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -211,51 +224,51 @@ internal DeploymentsOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 204 && (int)_statusCode != 404)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -265,17 +278,17 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
- _result.Body = (_statusCode == System.Net.HttpStatusCode.NoContent);
+ _result.Body = _statusCode == System.Net.HttpStatusCode.NoContent;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
{
_result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -284,12 +297,12 @@ internal DeploymentsOperations(ResourceManagementClient client)
/// Deploys resources to a resource group.
///
///
- /// You can provide the template and parameters directly in the request or
- /// link to JSON files.
+ /// You can provide the template and parameters directly in the request or link
+ /// to JSON files.
///
///
- /// The name of the resource group to deploy the resources to. The name is
- /// case insensitive. The resource group must already exist.
+ /// The name of the resource group to deploy the resources to. The name is case
+ /// insensitive. The resource group must already exist.
///
///
/// The name of the deployment.
@@ -303,14 +316,11 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
// Send Request
- Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(
- resourceGroupName, deploymentName, parameters, customHeaders, cancellationToken);
- return await this.Client.GetPutOrPatchOperationResultAsync(_response,
- customHeaders,
- cancellationToken);
+ AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, parameters, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
}
///
@@ -328,111 +338,116 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -448,51 +463,51 @@ internal DeploymentsOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -502,7 +517,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -515,21 +530,21 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -539,8 +554,8 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
///
/// You can cancel a deployment only if the provisioningState is Accepted or
- /// Running. After the deployment is canceled, the provisioningState is set
- /// to Canceled. Canceling a template deployment stops the currently running
+ /// Running. After the deployment is canceled, the provisioningState is set to
+ /// Canceled. Canceling a template deployment stops the currently running
/// template deployment and leaves the resource group partially deployed.
///
///
@@ -555,108 +570,113 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task CancelWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task CancelWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Cancel", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -672,43 +692,51 @@ internal DeploymentsOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 204)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -718,7 +746,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -727,7 +755,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -752,120 +780,125 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> ValidateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> ValidateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
if (parameters == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters");
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
if (parameters != null)
{
parameters.Validate();
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Validate", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -882,56 +915,56 @@ internal DeploymentsOperations(ResourceManagementClient client)
string _requestContent = null;
if(parameters != null)
{
- _requestContent = SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings);
- _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200 && (int)_statusCode != 400)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -941,7 +974,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -954,16 +987,16 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
// Deserialize Response
@@ -972,21 +1005,21 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -1006,111 +1039,116 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> ExportTemplateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> ExportTemplateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ExportTemplate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ExportTemplate", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1126,51 +1164,51 @@ internal DeploymentsOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1180,7 +1218,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1193,21 +1231,21 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -1228,99 +1266,104 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("odataQuery", odataQuery);
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
if (odataQuery != null)
{
var _odataFilter = odataQuery.ToString();
- if (!string.IsNullOrEmpty(_odataFilter))
+ if (!string.IsNullOrEmpty(_odataFilter))
{
_queryParameters.Add(_odataFilter);
}
}
- if (this.Client.ApiVersion != null)
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1336,51 +1379,51 @@ internal DeploymentsOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1390,7 +1433,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1403,21 +1446,21 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -1426,17 +1469,16 @@ internal DeploymentsOperations(ResourceManagementClient client)
/// Deletes a deployment from the deployment history.
///
///
- /// A template deployment that is currently running cannot be deleted.
- /// Deleting a template deployment removes the associated deployment
- /// operations. Deleting a template deployment does not affect the state of
- /// the resource group. This is an asynchronous operation that returns a
- /// status of 202 until the template deployment is successfully deleted. The
- /// Location response header contains the URI that is used to obtain the
- /// status of the process. While the process is running, a call to the URI in
- /// the Location header returns a status of 202. When the process finishes,
- /// the URI in the Location header returns a status of 204 on success. If the
- /// asynchronous request failed, the URI in the Location header returns an
- /// error-level status code.
+ /// A template deployment that is currently running cannot be deleted. Deleting
+ /// a template deployment removes the associated deployment operations.
+ /// Deleting a template deployment does not affect the state of the resource
+ /// group. This is an asynchronous operation that returns a status of 202 until
+ /// the template deployment is successfully deleted. The Location response
+ /// header contains the URI that is used to obtain the status of the process.
+ /// While the process is running, a call to the URI in the Location header
+ /// returns a status of 202. When the process finishes, the URI in the Location
+ /// header returns a status of 204 on success. If the asynchronous request
+ /// failed, the URI in the Location header returns an error-level status code.
///
///
/// The name of the resource group with the deployment to delete. The name is
@@ -1451,108 +1493,113 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1568,43 +1615,51 @@ internal DeploymentsOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 202 && (int)_statusCode != 204)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
- if (_httpResponse.Content != null) {
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex = new CloudException(_errorBody.Message);
+ ex.Body = _errorBody;
+ }
}
- else {
- _responseContent = string.Empty;
+ catch (JsonException)
+ {
+ // Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1614,7 +1669,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1623,7 +1678,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -1632,12 +1687,12 @@ internal DeploymentsOperations(ResourceManagementClient client)
/// Deploys resources to a resource group.
///
///
- /// You can provide the template and parameters directly in the request or
- /// link to JSON files.
+ /// You can provide the template and parameters directly in the request or link
+ /// to JSON files.
///
///
- /// The name of the resource group to deploy the resources to. The name is
- /// case insensitive. The resource group must already exist.
+ /// The name of the resource group to deploy the resources to. The name is case
+ /// insensitive. The resource group must already exist.
///
///
/// The name of the deployment.
@@ -1651,120 +1706,125 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceGroupName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
}
if (resourceGroupName != null)
{
if (resourceGroupName.Length > 90)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90);
+ throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90);
}
if (resourceGroupName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$");
}
}
if (deploymentName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "deploymentName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "deploymentName");
}
if (deploymentName != null)
{
if (deploymentName.Length > 64)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "deploymentName", 64);
+ throw new ValidationException(ValidationRules.MaxLength, "deploymentName", 64);
}
if (deploymentName.Length < 1)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "deploymentName", 1);
+ throw new ValidationException(ValidationRules.MinLength, "deploymentName", 1);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(deploymentName, "^[-\\w\\._\\(\\)]+$"))
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
+ throw new ValidationException(ValidationRules.Pattern, "deploymentName", "^[-\\w\\._\\(\\)]+$");
}
}
if (parameters == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters");
+ throw new ValidationException(ValidationRules.CannotBeNull, "parameters");
}
if (parameters != null)
{
parameters.Validate();
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceGroupName", resourceGroupName);
tracingParameters.Add("deploymentName", deploymentName);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}").ToString();
_url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
_url = _url.Replace("{deploymentName}", System.Uri.EscapeDataString(deploymentName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("PUT");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1781,56 +1841,56 @@ internal DeploymentsOperations(ResourceManagementClient client)
string _requestContent = null;
if(parameters != null)
{
- _requestContent = SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings);
- _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _requestContent = SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200 && (int)_statusCode != 201)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1840,7 +1900,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1853,16 +1913,16 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
// Deserialize Response
@@ -1871,21 +1931,21 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -1902,61 +1962,66 @@ internal DeploymentsOperations(ResourceManagementClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink");
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroupNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1972,51 +2037,51 @@ internal DeploymentsOperations(ResourceManagementClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -2026,7 +2091,7 @@ internal DeploymentsOperations(ResourceManagementClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -2039,21 +2104,21 @@ internal DeploymentsOperations(ResourceManagementClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperationsExtensions.cs
index 8329646fad5e..1e7a0c3254ac 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperationsExtensions.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/DeploymentsOperationsExtensions.cs
@@ -1,16 +1,21 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Azure.OData;
+ using Models;
+ using System.Threading;
using System.Threading.Tasks;
- using Microsoft.Rest.Azure;
- using Models;
///
/// Extension methods for DeploymentsOperations.
@@ -21,17 +26,16 @@ public static partial class DeploymentsOperationsExtensions
/// Deletes a deployment from the deployment history.
///
///
- /// A template deployment that is currently running cannot be deleted.
- /// Deleting a template deployment removes the associated deployment
- /// operations. Deleting a template deployment does not affect the state of
- /// the resource group. This is an asynchronous operation that returns a
- /// status of 202 until the template deployment is successfully deleted. The
- /// Location response header contains the URI that is used to obtain the
- /// status of the process. While the process is running, a call to the URI in
- /// the Location header returns a status of 202. When the process finishes,
- /// the URI in the Location header returns a status of 204 on success. If the
- /// asynchronous request failed, the URI in the Location header returns an
- /// error-level status code.
+ /// A template deployment that is currently running cannot be deleted. Deleting
+ /// a template deployment removes the associated deployment operations.
+ /// Deleting a template deployment does not affect the state of the resource
+ /// group. This is an asynchronous operation that returns a status of 202 until
+ /// the template deployment is successfully deleted. The Location response
+ /// header contains the URI that is used to obtain the status of the process.
+ /// While the process is running, a call to the URI in the Location header
+ /// returns a status of 202. When the process finishes, the URI in the Location
+ /// header returns a status of 204 on success. If the asynchronous request
+ /// failed, the URI in the Location header returns an error-level status code.
///
///
/// The operations group for this extension method.
@@ -45,24 +49,23 @@ public static partial class DeploymentsOperationsExtensions
///
public static void Delete(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName)
{
- System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).DeleteAsync(resourceGroupName, deploymentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.DeleteAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult();
}
///
/// Deletes a deployment from the deployment history.
///
///
- /// A template deployment that is currently running cannot be deleted.
- /// Deleting a template deployment removes the associated deployment
- /// operations. Deleting a template deployment does not affect the state of
- /// the resource group. This is an asynchronous operation that returns a
- /// status of 202 until the template deployment is successfully deleted. The
- /// Location response header contains the URI that is used to obtain the
- /// status of the process. While the process is running, a call to the URI in
- /// the Location header returns a status of 202. When the process finishes,
- /// the URI in the Location header returns a status of 204 on success. If the
- /// asynchronous request failed, the URI in the Location header returns an
- /// error-level status code.
+ /// A template deployment that is currently running cannot be deleted. Deleting
+ /// a template deployment removes the associated deployment operations.
+ /// Deleting a template deployment does not affect the state of the resource
+ /// group. This is an asynchronous operation that returns a status of 202 until
+ /// the template deployment is successfully deleted. The Location response
+ /// header contains the URI that is used to obtain the status of the process.
+ /// While the process is running, a call to the URI in the Location header
+ /// returns a status of 202. When the process finishes, the URI in the Location
+ /// header returns a status of 204 on success. If the asynchronous request
+ /// failed, the URI in the Location header returns an error-level status code.
///
///
/// The operations group for this extension method.
@@ -77,9 +80,9 @@ public static void Delete(this IDeploymentsOperations operations, string resourc
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task DeleteAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task DeleteAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.DeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -97,7 +100,7 @@ public static void Delete(this IDeploymentsOperations operations, string resourc
///
public static bool CheckExistence(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).CheckExistenceAsync(resourceGroupName, deploymentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.CheckExistenceAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult();
}
///
@@ -116,7 +119,7 @@ public static bool CheckExistence(this IDeploymentsOperations operations, string
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task CheckExistenceAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task CheckExistenceAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CheckExistenceWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false))
{
@@ -128,15 +131,15 @@ public static bool CheckExistence(this IDeploymentsOperations operations, string
/// Deploys resources to a resource group.
///
///
- /// You can provide the template and parameters directly in the request or
- /// link to JSON files.
+ /// You can provide the template and parameters directly in the request or link
+ /// to JSON files.
///
///
/// The operations group for this extension method.
///
///
- /// The name of the resource group to deploy the resources to. The name is
- /// case insensitive. The resource group must already exist.
+ /// The name of the resource group to deploy the resources to. The name is case
+ /// insensitive. The resource group must already exist.
///
///
/// The name of the deployment.
@@ -146,22 +149,22 @@ public static bool CheckExistence(this IDeploymentsOperations operations, string
///
public static DeploymentExtended CreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).CreateOrUpdateAsync(resourceGroupName, deploymentName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.CreateOrUpdateAsync(resourceGroupName, deploymentName, parameters).GetAwaiter().GetResult();
}
///
/// Deploys resources to a resource group.
///
///
- /// You can provide the template and parameters directly in the request or
- /// link to JSON files.
+ /// You can provide the template and parameters directly in the request or link
+ /// to JSON files.
///
///
/// The operations group for this extension method.
///
///
- /// The name of the resource group to deploy the resources to. The name is
- /// case insensitive. The resource group must already exist.
+ /// The name of the resource group to deploy the resources to. The name is case
+ /// insensitive. The resource group must already exist.
///
///
/// The name of the deployment.
@@ -172,7 +175,7 @@ public static DeploymentExtended CreateOrUpdate(this IDeploymentsOperations oper
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task CreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, parameters, null, cancellationToken).ConfigureAwait(false))
{
@@ -194,7 +197,7 @@ public static DeploymentExtended CreateOrUpdate(this IDeploymentsOperations oper
///
public static DeploymentExtended Get(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).GetAsync(resourceGroupName, deploymentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.GetAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult();
}
///
@@ -212,7 +215,7 @@ public static DeploymentExtended Get(this IDeploymentsOperations operations, str
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task GetAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task GetAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false))
{
@@ -225,8 +228,8 @@ public static DeploymentExtended Get(this IDeploymentsOperations operations, str
///
///
/// You can cancel a deployment only if the provisioningState is Accepted or
- /// Running. After the deployment is canceled, the provisioningState is set
- /// to Canceled. Canceling a template deployment stops the currently running
+ /// Running. After the deployment is canceled, the provisioningState is set to
+ /// Canceled. Canceling a template deployment stops the currently running
/// template deployment and leaves the resource group partially deployed.
///
///
@@ -240,7 +243,7 @@ public static DeploymentExtended Get(this IDeploymentsOperations operations, str
///
public static void Cancel(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName)
{
- System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).CancelAsync(resourceGroupName, deploymentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.CancelAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult();
}
///
@@ -248,8 +251,8 @@ public static void Cancel(this IDeploymentsOperations operations, string resourc
///
///
/// You can cancel a deployment only if the provisioningState is Accepted or
- /// Running. After the deployment is canceled, the provisioningState is set
- /// to Canceled. Canceling a template deployment stops the currently running
+ /// Running. After the deployment is canceled, the provisioningState is set to
+ /// Canceled. Canceling a template deployment stops the currently running
/// template deployment and leaves the resource group partially deployed.
///
///
@@ -264,9 +267,9 @@ public static void Cancel(this IDeploymentsOperations operations, string resourc
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task CancelAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task CancelAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.CancelWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.CancelWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
@@ -288,7 +291,7 @@ public static void Cancel(this IDeploymentsOperations operations, string resourc
///
public static DeploymentValidateResult Validate(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).ValidateAsync(resourceGroupName, deploymentName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ValidateAsync(resourceGroupName, deploymentName, parameters).GetAwaiter().GetResult();
}
///
@@ -311,7 +314,7 @@ public static DeploymentValidateResult Validate(this IDeploymentsOperations oper
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task ValidateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task ValidateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ValidateWithHttpMessagesAsync(resourceGroupName, deploymentName, parameters, null, cancellationToken).ConfigureAwait(false))
{
@@ -333,7 +336,7 @@ public static DeploymentValidateResult Validate(this IDeploymentsOperations oper
///
public static DeploymentExportResult ExportTemplate(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).ExportTemplateAsync(resourceGroupName, deploymentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ExportTemplateAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult();
}
///
@@ -351,7 +354,7 @@ public static DeploymentExportResult ExportTemplate(this IDeploymentsOperations
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task ExportTemplateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task ExportTemplateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ExportTemplateWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false))
{
@@ -372,9 +375,9 @@ public static DeploymentExportResult ExportTemplate(this IDeploymentsOperations
///
/// OData parameters to apply to the operation.
///
- public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IDeploymentsOperations operations, string resourceGroupName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery))
+ public static IPage ListByResourceGroup(this IDeploymentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery))
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).ListByResourceGroupAsync(resourceGroupName, odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult();
}
///
@@ -393,7 +396,7 @@ public static DeploymentExportResult ExportTemplate(this IDeploymentsOperations
///
/// The cancellation token.
///
- public static async Task> ListByResourceGroupAsync(this IDeploymentsOperations operations, string resourceGroupName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListByResourceGroupAsync(this IDeploymentsOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false))
{
@@ -405,17 +408,16 @@ public static DeploymentExportResult ExportTemplate(this IDeploymentsOperations
/// Deletes a deployment from the deployment history.
///
///
- /// A template deployment that is currently running cannot be deleted.
- /// Deleting a template deployment removes the associated deployment
- /// operations. Deleting a template deployment does not affect the state of
- /// the resource group. This is an asynchronous operation that returns a
- /// status of 202 until the template deployment is successfully deleted. The
- /// Location response header contains the URI that is used to obtain the
- /// status of the process. While the process is running, a call to the URI in
- /// the Location header returns a status of 202. When the process finishes,
- /// the URI in the Location header returns a status of 204 on success. If the
- /// asynchronous request failed, the URI in the Location header returns an
- /// error-level status code.
+ /// A template deployment that is currently running cannot be deleted. Deleting
+ /// a template deployment removes the associated deployment operations.
+ /// Deleting a template deployment does not affect the state of the resource
+ /// group. This is an asynchronous operation that returns a status of 202 until
+ /// the template deployment is successfully deleted. The Location response
+ /// header contains the URI that is used to obtain the status of the process.
+ /// While the process is running, a call to the URI in the Location header
+ /// returns a status of 202. When the process finishes, the URI in the Location
+ /// header returns a status of 204 on success. If the asynchronous request
+ /// failed, the URI in the Location header returns an error-level status code.
///
///
/// The operations group for this extension method.
@@ -429,24 +431,23 @@ public static DeploymentExportResult ExportTemplate(this IDeploymentsOperations
///
public static void BeginDelete(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName)
{
- System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).BeginDeleteAsync(resourceGroupName, deploymentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ operations.BeginDeleteAsync(resourceGroupName, deploymentName).GetAwaiter().GetResult();
}
///
/// Deletes a deployment from the deployment history.
///
///
- /// A template deployment that is currently running cannot be deleted.
- /// Deleting a template deployment removes the associated deployment
- /// operations. Deleting a template deployment does not affect the state of
- /// the resource group. This is an asynchronous operation that returns a
- /// status of 202 until the template deployment is successfully deleted. The
- /// Location response header contains the URI that is used to obtain the
- /// status of the process. While the process is running, a call to the URI in
- /// the Location header returns a status of 202. When the process finishes,
- /// the URI in the Location header returns a status of 204 on success. If the
- /// asynchronous request failed, the URI in the Location header returns an
- /// error-level status code.
+ /// A template deployment that is currently running cannot be deleted. Deleting
+ /// a template deployment removes the associated deployment operations.
+ /// Deleting a template deployment does not affect the state of the resource
+ /// group. This is an asynchronous operation that returns a status of 202 until
+ /// the template deployment is successfully deleted. The Location response
+ /// header contains the URI that is used to obtain the status of the process.
+ /// While the process is running, a call to the URI in the Location header
+ /// returns a status of 202. When the process finishes, the URI in the Location
+ /// header returns a status of 204 on success. If the asynchronous request
+ /// failed, the URI in the Location header returns an error-level status code.
///
///
/// The operations group for this extension method.
@@ -461,24 +462,24 @@ public static void BeginDelete(this IDeploymentsOperations operations, string re
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task BeginDeleteAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task BeginDeleteAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, CancellationToken cancellationToken = default(CancellationToken))
{
- await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false);
+ (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, deploymentName, null, cancellationToken).ConfigureAwait(false)).Dispose();
}
///
/// Deploys resources to a resource group.
///
///
- /// You can provide the template and parameters directly in the request or
- /// link to JSON files.
+ /// You can provide the template and parameters directly in the request or link
+ /// to JSON files.
///
///
/// The operations group for this extension method.
///
///
- /// The name of the resource group to deploy the resources to. The name is
- /// case insensitive. The resource group must already exist.
+ /// The name of the resource group to deploy the resources to. The name is case
+ /// insensitive. The resource group must already exist.
///
///
/// The name of the deployment.
@@ -488,22 +489,22 @@ public static void BeginDelete(this IDeploymentsOperations operations, string re
///
public static DeploymentExtended BeginCreateOrUpdate(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, deploymentName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.BeginCreateOrUpdateAsync(resourceGroupName, deploymentName, parameters).GetAwaiter().GetResult();
}
///
/// Deploys resources to a resource group.
///
///
- /// You can provide the template and parameters directly in the request or
- /// link to JSON files.
+ /// You can provide the template and parameters directly in the request or link
+ /// to JSON files.
///
///
/// The operations group for this extension method.
///
///
- /// The name of the resource group to deploy the resources to. The name is
- /// case insensitive. The resource group must already exist.
+ /// The name of the resource group to deploy the resources to. The name is case
+ /// insensitive. The resource group must already exist.
///
///
/// The name of the deployment.
@@ -514,7 +515,7 @@ public static DeploymentExtended BeginCreateOrUpdate(this IDeploymentsOperations
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task BeginCreateOrUpdateAsync(this IDeploymentsOperations operations, string resourceGroupName, string deploymentName, Deployment parameters, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, deploymentName, parameters, null, cancellationToken).ConfigureAwait(false))
{
@@ -531,9 +532,9 @@ public static DeploymentExtended BeginCreateOrUpdate(this IDeploymentsOperations
///
/// The NextLink from the previous successful call to List operation.
///
- public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IDeploymentsOperations operations, string nextPageLink)
+ public static IPage ListByResourceGroupNext(this IDeploymentsOperations operations, string nextPageLink)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDeploymentsOperations)s).ListByResourceGroupNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult();
}
///
@@ -548,7 +549,7 @@ public static Microsoft.Rest.Azure.IPage ListByResourceGroup
///
/// The cancellation token.
///
- public static async Task> ListByResourceGroupNextAsync(this IDeploymentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListByResourceGroupNextAsync(this IDeploymentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
{
diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/FeatureClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/FeatureClient.cs
index 5d4f27926c60..5bf7f33cc55f 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/FeatureClient.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/FeatureClient.cs
@@ -1,17 +1,25 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
- using System.Linq;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
+ using Microsoft.Rest.Serialization;
using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
///
/// Azure Feature Exposure Control (AFEC) provides a mechanism for the
@@ -21,7 +29,7 @@ namespace Microsoft.Azure.Management.ResourceManager
/// Users need to explicitly register for AFEC features to get access to
/// such functionality.
///
- public partial class FeatureClient : Microsoft.Rest.ServiceClient, IFeatureClient, IAzureClient
+ public partial class FeatureClient : ServiceClient, IFeatureClient, IAzureClient
{
///
/// The base URI of the service.
@@ -31,17 +39,17 @@ public partial class FeatureClient : Microsoft.Rest.ServiceClient
///
/// Gets or sets json serialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; }
+ public JsonSerializerSettings SerializationSettings { get; private set; }
///
/// Gets or sets json deserialization settings.
///
- public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; }
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
///
/// Credentials needed for the client to connect to Azure.
///
- public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; }
+ public ServiceClientCredentials Credentials { get; private set; }
///
/// The ID of the target subscription.
@@ -81,9 +89,9 @@ public partial class FeatureClient : Microsoft.Rest.ServiceClient
///
/// Optional. The delegating handlers to add to the http client pipeline.
///
- protected FeatureClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers)
+ protected FeatureClient(params DelegatingHandler[] handlers) : base(handlers)
{
- this.Initialize();
+ Initialize();
}
///
@@ -95,9 +103,9 @@ protected FeatureClient(params System.Net.Http.DelegatingHandler[] handlers) : b
///
/// Optional. The delegating handlers to add to the http client pipeline.
///
- protected FeatureClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ protected FeatureClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
{
- this.Initialize();
+ Initialize();
}
///
@@ -112,13 +120,13 @@ protected FeatureClient(System.Net.Http.HttpClientHandler rootHandler, params Sy
///
/// Thrown when a required parameter is null
///
- protected FeatureClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
+ protected FeatureClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
- this.BaseUri = baseUri;
+ BaseUri = baseUri;
}
///
@@ -136,13 +144,13 @@ protected FeatureClient(System.Uri baseUri, params System.Net.Http.DelegatingHan
///
/// Thrown when a required parameter is null
///
- protected FeatureClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ protected FeatureClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
- this.BaseUri = baseUri;
+ BaseUri = baseUri;
}
///
@@ -157,16 +165,16 @@ protected FeatureClient(System.Uri baseUri, System.Net.Http.HttpClientHandler ro
///
/// Thrown when a required parameter is null
///
- public FeatureClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
+ public FeatureClient(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
{
if (credentials == null)
{
throw new System.ArgumentNullException("credentials");
}
- this.Credentials = credentials;
- if (this.Credentials != null)
+ Credentials = credentials;
+ if (Credentials != null)
{
- this.Credentials.InitializeServiceClient(this);
+ Credentials.InitializeServiceClient(this);
}
}
@@ -185,16 +193,16 @@ public FeatureClient(Microsoft.Rest.ServiceClientCredentials credentials, params
///
/// Thrown when a required parameter is null
///
- public FeatureClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ public FeatureClient(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (credentials == null)
{
throw new System.ArgumentNullException("credentials");
}
- this.Credentials = credentials;
- if (this.Credentials != null)
+ Credentials = credentials;
+ if (Credentials != null)
{
- this.Credentials.InitializeServiceClient(this);
+ Credentials.InitializeServiceClient(this);
}
}
@@ -213,7 +221,7 @@ public FeatureClient(Microsoft.Rest.ServiceClientCredentials credentials, System
///
/// Thrown when a required parameter is null
///
- public FeatureClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
+ public FeatureClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
{
if (baseUri == null)
{
@@ -223,11 +231,11 @@ public FeatureClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials
{
throw new System.ArgumentNullException("credentials");
}
- this.BaseUri = baseUri;
- this.Credentials = credentials;
- if (this.Credentials != null)
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
{
- this.Credentials.InitializeServiceClient(this);
+ Credentials.InitializeServiceClient(this);
}
}
@@ -249,7 +257,7 @@ public FeatureClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials
///
/// Thrown when a required parameter is null
///
- public FeatureClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ public FeatureClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (baseUri == null)
{
@@ -259,11 +267,11 @@ public FeatureClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials
{
throw new System.ArgumentNullException("credentials");
}
- this.BaseUri = baseUri;
- this.Credentials = credentials;
- if (this.Credentials != null)
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
{
- this.Credentials.InitializeServiceClient(this);
+ Credentials.InitializeServiceClient(this);
}
}
@@ -276,39 +284,39 @@ public FeatureClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials
///
private void Initialize()
{
- this.Features = new FeaturesOperations(this);
- this.BaseUri = new System.Uri("https://management.azure.com");
- this.ApiVersion = "2015-12-01";
- this.AcceptLanguage = "en-US";
- this.LongRunningOperationRetryTimeout = 30;
- this.GenerateClientRequestId = true;
- SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ Features = new FeaturesOperations(this);
+ BaseUri = new System.Uri("https://management.azure.com");
+ ApiVersion = "2015-12-01";
+ AcceptLanguage = "en-US";
+ LongRunningOperationRetryTimeout = 30;
+ GenerateClientRequestId = true;
+ SerializationSettings = new JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
- ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
{
- new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
+ new Iso8601TimeSpanConverter()
}
};
- DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
+ DeserializationSettings = new JsonSerializerSettings
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
- ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
- Converters = new System.Collections.Generic.List
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
{
- new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
+ new Iso8601TimeSpanConverter()
}
};
CustomInitialize();
- DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter());
- }
+ DeserializationSettings.Converters.Add(new CloudErrorJsonConverter());
+ }
}
}
diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperations.cs
index 047b22e28d78..4795103cac6c 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperations.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperations.cs
@@ -1,22 +1,31 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
- using System.Linq;
using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// FeaturesOperations operations.
///
- internal partial class FeaturesOperations : Microsoft.Rest.IServiceOperations, IFeaturesOperations
+ internal partial class FeaturesOperations : IServiceOperations, IFeaturesOperations
{
///
/// Initializes a new instance of the FeaturesOperations class.
@@ -29,11 +38,11 @@ internal partial class FeaturesOperations : Microsoft.Rest.IServiceOperations
internal FeaturesOperations(FeatureClient client)
{
- if (client == null)
+ if (client == null)
{
throw new System.ArgumentNullException("client");
}
- this.Client = client;
+ Client = client;
}
///
@@ -51,69 +60,74 @@ internal FeaturesOperations(FeatureClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListAllWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListAll", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Features/features").ToString();
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -129,51 +143,51 @@ internal FeaturesOperations(FeatureClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -183,7 +197,7 @@ internal FeaturesOperations(FeatureClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -196,21 +210,21 @@ internal FeaturesOperations(FeatureClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -228,75 +242,80 @@ internal FeaturesOperations(FeatureClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceProviderNamespace, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListWithHttpMessagesAsync(string resourceProviderNamespace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceProviderNamespace == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features").ToString();
_url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -312,51 +331,51 @@ internal FeaturesOperations(FeatureClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -366,7 +385,7 @@ internal FeaturesOperations(FeatureClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -379,21 +398,21 @@ internal FeaturesOperations(FeatureClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -413,81 +432,86 @@ internal FeaturesOperations(FeatureClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceProviderNamespace == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace");
}
if (featureName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "featureName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "featureName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace);
tracingParameters.Add("featureName", featureName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}").ToString();
_url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace));
_url = _url.Replace("{featureName}", System.Uri.EscapeDataString(featureName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -503,51 +527,51 @@ internal FeaturesOperations(FeatureClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -557,7 +581,7 @@ internal FeaturesOperations(FeatureClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -570,21 +594,21 @@ internal FeaturesOperations(FeatureClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -604,81 +628,86 @@ internal FeaturesOperations(FeatureClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task> RegisterWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task> RegisterWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (resourceProviderNamespace == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace");
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace");
}
if (featureName == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "featureName");
+ throw new ValidationException(ValidationRules.CannotBeNull, "featureName");
}
- if (this.Client.ApiVersion == null)
+ if (Client.ApiVersion == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
}
- if (this.Client.SubscriptionId == null)
+ if (Client.SubscriptionId == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace);
tracingParameters.Add("featureName", featureName);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Register", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "Register", tracingParameters);
}
// Construct URL
- var _baseUrl = this.Client.BaseUri.AbsoluteUri;
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/register").ToString();
_url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace));
_url = _url.Replace("{featureName}", System.Uri.EscapeDataString(featureName));
- _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId));
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
- if (this.Client.ApiVersion != null)
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
{
- _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion)));
+ _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
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("POST");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -694,51 +723,51 @@ internal FeaturesOperations(FeatureClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -748,7 +777,7 @@ internal FeaturesOperations(FeatureClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse();
+ var _result = new AzureOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -761,21 +790,21 @@ internal FeaturesOperations(FeatureClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -793,61 +822,66 @@ internal FeaturesOperations(FeatureClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink");
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListAllNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -863,51 +897,51 @@ internal FeaturesOperations(FeatureClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -917,7 +951,7 @@ internal FeaturesOperations(FeatureClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -930,21 +964,21 @@ internal FeaturesOperations(FeatureClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
@@ -962,61 +996,66 @@ internal FeaturesOperations(FeatureClient client)
///
/// The cancellation token.
///
- ///
+ ///
/// Thrown when the operation returned an invalid status code
///
- ///
+ ///
/// Thrown when unable to deserialize the response
///
- ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
/// Thrown when a required parameter is null
///
///
/// A response object containing the response body and response headers.
///
- public async System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
{
if (nextPageLink == null)
{
- throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink");
+ throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink");
}
// Tracing
- bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
- _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
- System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary();
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
tracingParameters.Add("nextPageLink", nextPageLink);
tracingParameters.Add("cancellationToken", cancellationToken);
- Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
+ ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters);
}
// Construct URL
string _url = "{nextLink}";
_url = _url.Replace("{nextLink}", nextPageLink);
- System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List();
+ List _queryParameters = new List();
if (_queryParameters.Count > 0)
{
_url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
- System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage();
- System.Net.Http.HttpResponseMessage _httpResponse = null;
- _httpRequest.Method = new System.Net.Http.HttpMethod("GET");
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
- if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value)
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
{
_httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
}
- if (this.Client.AcceptLanguage != null)
+ if (Client.AcceptLanguage != null)
{
if (_httpRequest.Headers.Contains("accept-language"))
{
_httpRequest.Headers.Remove("accept-language");
}
- _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.AcceptLanguage);
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
}
+
+
if (customHeaders != null)
{
foreach(var _header in customHeaders)
@@ -1032,51 +1071,51 @@ internal FeaturesOperations(FeatureClient client)
// Serialize Request
string _requestContent = null;
// Set Credentials
- if (this.Client.Credentials != null)
+ if (Client.Credentials != null)
{
cancellationToken.ThrowIfCancellationRequested();
- await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
}
// Send Request
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
- _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
- System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
- var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
try
{
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
- CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings);
+ CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
if (_errorBody != null)
{
- ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message);
+ ex = new CloudException(_errorBody.Message);
ex.Body = _errorBody;
}
}
- catch (Newtonsoft.Json.JsonException)
+ catch (JsonException)
{
// Ignore the exception
}
- ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
- ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ 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)
{
- Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
+ ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
@@ -1086,7 +1125,7 @@ internal FeaturesOperations(FeatureClient client)
throw ex;
}
// Create Result
- var _result = new Microsoft.Rest.Azure.AzureOperationResponse>();
+ var _result = new AzureOperationResponse>();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_httpResponse.Headers.Contains("x-ms-request-id"))
@@ -1099,21 +1138,21 @@ internal FeaturesOperations(FeatureClient client)
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
try
{
- _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings);
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
}
- catch (Newtonsoft.Json.JsonException ex)
+ catch (JsonException ex)
{
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
- throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
}
}
if (_shouldTrace)
{
- Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
+ ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperationsExtensions.cs
index 2bcf2d4d1a54..43b391fbf98d 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperationsExtensions.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/FeaturesOperationsExtensions.cs
@@ -1,16 +1,20 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
using System.Threading.Tasks;
- using Microsoft.Rest.Azure;
- using Models;
///
/// Extension methods for FeaturesOperations.
@@ -24,9 +28,9 @@ public static partial class FeaturesOperationsExtensions
///
/// The operations group for this extension method.
///
- public static Microsoft.Rest.Azure.IPage ListAll(this IFeaturesOperations operations)
+ public static IPage ListAll(this IFeaturesOperations operations)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IFeaturesOperations)s).ListAllAsync(), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListAllAsync().GetAwaiter().GetResult();
}
///
@@ -39,7 +43,7 @@ public static Microsoft.Rest.Azure.IPage ListAll(this IFeaturesOp
///
/// The cancellation token.
///
- public static async Task> ListAllAsync(this IFeaturesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListAllAsync(this IFeaturesOperations operations, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListAllWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
{
@@ -57,9 +61,9 @@ public static Microsoft.Rest.Azure.IPage ListAll(this IFeaturesOp
///
/// The namespace of the resource provider for getting features.
///
- public static Microsoft.Rest.Azure.IPage List(this IFeaturesOperations operations, string resourceProviderNamespace)
+ public static IPage List(this IFeaturesOperations operations, string resourceProviderNamespace)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IFeaturesOperations)s).ListAsync(resourceProviderNamespace), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListAsync(resourceProviderNamespace).GetAwaiter().GetResult();
}
///
@@ -75,7 +79,7 @@ public static Microsoft.Rest.Azure.IPage List(this IFeaturesOpera
///
/// The cancellation token.
///
- public static async Task> ListAsync(this IFeaturesOperations operations, string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListAsync(this IFeaturesOperations operations, string resourceProviderNamespace, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListWithHttpMessagesAsync(resourceProviderNamespace, null, cancellationToken).ConfigureAwait(false))
{
@@ -97,7 +101,7 @@ public static Microsoft.Rest.Azure.IPage List(this IFeaturesOpera
///
public static FeatureResult Get(this IFeaturesOperations operations, string resourceProviderNamespace, string featureName)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IFeaturesOperations)s).GetAsync(resourceProviderNamespace, featureName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.GetAsync(resourceProviderNamespace, featureName).GetAwaiter().GetResult();
}
///
@@ -115,7 +119,7 @@ public static FeatureResult Get(this IFeaturesOperations operations, string reso
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task GetAsync(this IFeaturesOperations operations, string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task GetAsync(this IFeaturesOperations operations, string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetWithHttpMessagesAsync(resourceProviderNamespace, featureName, null, cancellationToken).ConfigureAwait(false))
{
@@ -137,7 +141,7 @@ public static FeatureResult Get(this IFeaturesOperations operations, string reso
///
public static FeatureResult Register(this IFeaturesOperations operations, string resourceProviderNamespace, string featureName)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IFeaturesOperations)s).RegisterAsync(resourceProviderNamespace, featureName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.RegisterAsync(resourceProviderNamespace, featureName).GetAwaiter().GetResult();
}
///
@@ -155,7 +159,7 @@ public static FeatureResult Register(this IFeaturesOperations operations, string
///
/// The cancellation token.
///
- public static async System.Threading.Tasks.Task RegisterAsync(this IFeaturesOperations operations, string resourceProviderNamespace, string featureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task RegisterAsync(this IFeaturesOperations operations, string resourceProviderNamespace, string featureName, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.RegisterWithHttpMessagesAsync(resourceProviderNamespace, featureName, null, cancellationToken).ConfigureAwait(false))
{
@@ -173,9 +177,9 @@ public static FeatureResult Register(this IFeaturesOperations operations, string
///
/// The NextLink from the previous successful call to List operation.
///
- public static Microsoft.Rest.Azure.IPage ListAllNext(this IFeaturesOperations operations, string nextPageLink)
+ public static IPage ListAllNext(this IFeaturesOperations operations, string nextPageLink)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IFeaturesOperations)s).ListAllNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListAllNextAsync(nextPageLink).GetAwaiter().GetResult();
}
///
@@ -191,7 +195,7 @@ public static Microsoft.Rest.Azure.IPage ListAllNext(this IFeatur
///
/// The cancellation token.
///
- public static async Task> ListAllNextAsync(this IFeaturesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListAllNextAsync(this IFeaturesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListAllNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
{
@@ -209,9 +213,9 @@ public static Microsoft.Rest.Azure.IPage ListAllNext(this IFeatur
///
/// The NextLink from the previous successful call to List operation.
///
- public static Microsoft.Rest.Azure.IPage ListNext(this IFeaturesOperations operations, string nextPageLink)
+ public static IPage ListNext(this IFeaturesOperations operations, string nextPageLink)
{
- return System.Threading.Tasks.Task.Factory.StartNew(s => ((IFeaturesOperations)s).ListNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
+ return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult();
}
///
@@ -227,7 +231,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this IFeaturesO
///
/// The cancellation token.
///
- public static async Task> ListNextAsync(this IFeaturesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
+ public static async Task> ListNextAsync(this IFeaturesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false))
{
diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentOperations.cs
index 9f8fdbb0fe59..9560385c831a 100644
--- a/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentOperations.cs
+++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentOperations.cs
@@ -1,15 +1,22 @@
+//
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
-//
-// Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
+//
namespace Microsoft.Azure.Management.ResourceManager
{
+ using Microsoft.Rest;
using Microsoft.Rest.Azure;
using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
///
/// DeploymentOperations operations.
@@ -43,7 +50,7 @@ public partial interface IDeploymentOperations
///
/// Thrown when a required parameter is null
///
- System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string operationId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken));
+ Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, string operationId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
///
/// Gets all deployments operations for a deployment.
///
@@ -71,7 +78,7 @@ public partial interface IDeploymentOperations
///
/// Thrown when a required parameter is null
///
- System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string deploymentName, int? top = default(int?), System.Collections.Generic.Dictionary