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> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceGroupName, string deploymentName, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all deployments operations for a deployment. /// @@ -93,6 +100,6 @@ public partial interface IDeploymentOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentsOperations.cs index d4e1d839e0ab..a9bd4f220c3c 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IDeploymentsOperations.cs @@ -1,15 +1,23 @@ +// // 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// DeploymentsOperations operations. @@ -23,15 +31,15 @@ public partial interface IDeploymentsOperations /// 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. + /// 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 @@ -52,7 +60,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Checks whether the deployment exists. /// @@ -75,17 +83,17 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -108,7 +116,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - 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)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a deployment. /// @@ -133,7 +141,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Cancels a currently running template deployment. /// @@ -162,7 +170,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task CancelWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task CancelWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Validates whether the specified template is syntactically correct /// and will be accepted by Azure Resource Manager.. @@ -192,7 +200,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - 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)); + Task> ValidateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Exports the template used for specified deployment. /// @@ -217,7 +225,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> ExportTemplateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> ExportTemplateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all the deployments for a resource group. /// @@ -243,7 +251,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - 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)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a deployment from the deployment history. /// @@ -251,15 +259,15 @@ public partial interface IDeploymentsOperations /// 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. + /// 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 @@ -280,17 +288,17 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// 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. @@ -313,7 +321,7 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - 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)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string deploymentName, Deployment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all the deployments for a resource group. /// @@ -335,6 +343,6 @@ public partial interface IDeploymentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IFeatureClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IFeatureClient.cs index abaef32e9586..43679eada48a 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IFeatureClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IFeatureClient.cs @@ -1,16 +1,19 @@ +// // 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 Newtonsoft.Json; /// /// Azure Feature Exposure Control (AFEC) provides a mechanism for the @@ -22,7 +25,7 @@ namespace Microsoft.Azure.Management.ResourceManager /// public partial interface IFeatureClient : System.IDisposable { - /// + /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } @@ -30,17 +33,17 @@ public partial interface IFeatureClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - Microsoft.Rest.ServiceClientCredentials Credentials { get; } + ServiceClientCredentials Credentials { get; } /// /// The ID of the target subscription. @@ -64,8 +67,8 @@ public partial interface IFeatureClient : System.IDisposable int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is - /// generated and included in each request. Default is true. + /// When set to true a unique x-ms-client-request-id value is generated + /// and included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IFeaturesOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IFeaturesOperations.cs index 4dc28fea39dc..d368a855b61b 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IFeaturesOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IFeaturesOperations.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; /// /// FeaturesOperations operations. @@ -35,7 +42,7 @@ public partial interface IFeaturesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAllWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListAllWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the preview features in a provider namespace that are /// available through AFEC for the subscription. @@ -58,7 +65,7 @@ public partial interface IFeaturesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceProviderNamespace, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListWithHttpMessagesAsync(string resourceProviderNamespace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the preview feature with the specified name. /// @@ -83,7 +90,7 @@ public partial interface IFeaturesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Registers the preview feature for the subscription. /// @@ -108,7 +115,7 @@ public partial interface IFeaturesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> RegisterWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> RegisterWithHttpMessagesAsync(string resourceProviderNamespace, string featureName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the preview features that are available through AFEC for /// the subscription. @@ -131,7 +138,7 @@ public partial interface IFeaturesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListAllNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the preview features in a provider namespace that are /// available through AFEC for the subscription. @@ -154,6 +161,6 @@ public partial interface IFeaturesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLinkClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLinkClient.cs index 175901adc164..7aec61fef744 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLinkClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLinkClient.cs @@ -1,16 +1,19 @@ +// // 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 Newtonsoft.Json; /// /// Azure resources can be linked together to form logical relationships. @@ -22,7 +25,7 @@ namespace Microsoft.Azure.Management.ResourceManager /// public partial interface IManagementLinkClient : System.IDisposable { - /// + /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } @@ -30,17 +33,17 @@ public partial interface IManagementLinkClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - Microsoft.Rest.ServiceClientCredentials Credentials { get; } + ServiceClientCredentials Credentials { get; } /// /// The ID of the target subscription. @@ -64,8 +67,8 @@ public partial interface IManagementLinkClient : System.IDisposable int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is - /// generated and included in each request. Default is true. + /// When set to true a unique x-ms-client-request-id value is generated + /// and included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLockClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLockClient.cs index c388ff6b1ca3..96a9ea30b27a 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLockClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLockClient.cs @@ -1,16 +1,19 @@ +// // 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 Newtonsoft.Json; /// /// Azure resources can be locked to prevent other users in your @@ -18,7 +21,7 @@ namespace Microsoft.Azure.Management.ResourceManager /// public partial interface IManagementLockClient : System.IDisposable { - /// + /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } @@ -26,17 +29,17 @@ public partial interface IManagementLockClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - Microsoft.Rest.ServiceClientCredentials Credentials { get; } + ServiceClientCredentials Credentials { get; } /// /// The ID of the target subscription. @@ -60,8 +63,8 @@ public partial interface IManagementLockClient : System.IDisposable int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is - /// generated and included in each request. Default is true. + /// When set to true a unique x-ms-client-request-id value is generated + /// and included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLocksOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLocksOperations.cs index 2aaf7fe287df..bd881c646078 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLocksOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IManagementLocksOperations.cs @@ -1,15 +1,23 @@ +// // 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// ManagementLocksOperations operations. @@ -24,15 +32,14 @@ public partial interface IManagementLocksOperations /// inherit the same lock. To create management locks, you must have /// access to Microsoft.Authorization/* or /// Microsoft.Authorization/locks/* actions. Of the built-in roles, - /// only Owner and User Access Administrator are granted those - /// actions. + /// only Owner and User Access Administrator are granted those actions. /// /// /// The name of the resource group to lock. /// /// - /// The lock name. The lock name can be a maximum of 260 characters. - /// It cannot contain <, > %, &, :, \, ?, /, or any control + /// The lock name. The lock name can be a maximum of 260 characters. It + /// cannot contain <, > %, &, :, \, ?, /, or any control /// characters. /// /// @@ -53,7 +60,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, ManagementLockObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a management lock at the resource group level. /// @@ -81,7 +88,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a management lock at the resource group level. /// @@ -106,7 +113,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update a management lock by scope. /// @@ -139,7 +146,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string lockName, ManagementLockObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete a management lock by scope. /// @@ -161,7 +168,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteByScopeWithHttpMessagesAsync(string scope, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteByScopeWithHttpMessagesAsync(string scope, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get a management lock by scope. /// @@ -186,7 +193,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetByScopeWithHttpMessagesAsync(string scope, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetByScopeWithHttpMessagesAsync(string scope, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a management lock at the resource level or any /// level below the resource. @@ -196,8 +203,7 @@ public partial interface IManagementLocksOperations /// inherit the same lock. To create management locks, you must have /// access to Microsoft.Authorization/* or /// Microsoft.Authorization/locks/* actions. Of the built-in roles, - /// only Owner and User Access Administrator are granted those - /// actions. + /// only Owner and User Access Administrator are granted those actions. /// /// /// The name of the resource group containing the resource to lock. @@ -215,9 +221,9 @@ public partial interface IManagementLocksOperations /// The name of the resource to lock. /// /// - /// The name of lock. The lock name can be a maximum of 260 - /// characters. It cannot contain <, > %, &, :, \, ?, /, or - /// any control characters. + /// The name of lock. The lock name can be a maximum of 260 characters. + /// It cannot contain <, > %, &, :, \, ?, /, or any control + /// characters. /// /// /// Parameters for creating or updating a management lock. @@ -237,7 +243,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the management lock of a resource or any level below the /// resource. @@ -280,7 +286,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get the management lock of a resource or any level below resource. /// @@ -318,7 +324,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a management lock at the subscription level. /// @@ -327,13 +333,12 @@ public partial interface IManagementLocksOperations /// inherit the same lock. To create management locks, you must have /// access to Microsoft.Authorization/* or /// Microsoft.Authorization/locks/* actions. Of the built-in roles, - /// only Owner and User Access Administrator are granted those - /// actions. + /// only Owner and User Access Administrator are granted those actions. /// /// - /// The name of lock. The lock name can be a maximum of 260 - /// characters. It cannot contain <, > %, &, :, \, ?, /, or - /// any control characters. + /// The name of lock. The lock name can be a maximum of 260 characters. + /// It cannot contain <, > %, &, :, \, ?, /, or any control + /// characters. /// /// /// The management lock parameters. @@ -353,7 +358,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateAtSubscriptionLevelWithHttpMessagesAsync(string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateAtSubscriptionLevelWithHttpMessagesAsync(string lockName, ManagementLockObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes the management lock at the subscription level. /// @@ -378,7 +383,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteAtSubscriptionLevelWithHttpMessagesAsync(string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteAtSubscriptionLevelWithHttpMessagesAsync(string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a management lock at the subscription level. /// @@ -400,7 +405,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetAtSubscriptionLevelWithHttpMessagesAsync(string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetAtSubscriptionLevelWithHttpMessagesAsync(string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the management locks for a resource group. /// @@ -425,7 +430,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtResourceGroupLevelWithHttpMessagesAsync(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)); + Task>> ListAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the management locks for a resource or any level below /// resource. @@ -464,7 +469,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, 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)); + Task>> ListAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the management locks for a subscription. /// @@ -486,7 +491,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtSubscriptionLevelWithHttpMessagesAsync(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)); + Task>> ListAtSubscriptionLevelWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the management locks for a resource group. /// @@ -508,7 +513,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtResourceGroupLevelNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListAtResourceGroupLevelNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the management locks for a resource or any level below /// resource. @@ -531,7 +536,7 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtResourceLevelNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListAtResourceLevelNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the management locks for a subscription. /// @@ -553,6 +558,6 @@ public partial interface IManagementLocksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtSubscriptionLevelNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListAtSubscriptionLevelNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyAssignmentsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyAssignmentsOperations.cs index e6a9c039e1f2..008701848a71 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyAssignmentsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyAssignmentsOperations.cs @@ -1,15 +1,23 @@ +// // 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// PolicyAssignmentsOperations operations. @@ -31,7 +39,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -40,14 +48,14 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> DeleteWithHttpMessagesAsync(string scope, string policyAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> DeleteWithHttpMessagesAsync(string scope, string policyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a policy assignment. /// /// /// Policy assignments are inherited by child resources. For example, - /// when you apply a policy to a resource group that policy is - /// assigned to all resources in the group. + /// when you apply a policy to a resource group that policy is assigned + /// to all resources in the group. /// /// /// The scope of the policy assignment. @@ -64,7 +72,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -73,7 +81,7 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string scope, string policyAssignmentName, PolicyAssignment parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateWithHttpMessagesAsync(string scope, string policyAssignmentName, PolicyAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a policy assignment. /// @@ -89,7 +97,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -98,7 +106,7 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string scope, string policyAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string scope, string policyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets policy assignments for the resource group. /// @@ -114,7 +122,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -123,13 +131,13 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets policy assignments for a resource. /// /// - /// The name of the resource group containing the resource. The name - /// is case insensitive. + /// The name of the resource group containing the resource. The name is + /// case insensitive. /// /// /// The namespace of the resource provider. @@ -152,16 +160,17 @@ public partial interface IPolicyAssignmentsOperations /// /// 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 /// - System.Threading.Tasks.Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, 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)); + [System.Obsolete()] + Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the policy assignments for a subscription. /// @@ -174,7 +183,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -183,7 +192,7 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(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)); + Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a policy assignment by ID. /// @@ -205,7 +214,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -214,15 +223,15 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> DeleteByIdWithHttpMessagesAsync(string policyAssignmentId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> DeleteByIdWithHttpMessagesAsync(string policyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a policy assignment by ID. /// /// /// Policy assignments are inherited by child resources. For example, - /// when you apply a policy to a resource group that policy is - /// assigned to all resources in the group. When providing a scope - /// for the assigment, use '/subscriptions/{subscription-id}/' for + /// when you apply a policy to a resource group that policy is assigned + /// to all resources in the group. When providing a scope for the + /// assigment, use '/subscriptions/{subscription-id}/' for /// subscriptions, /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' /// for resource groups, and @@ -242,7 +251,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -251,7 +260,7 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateByIdWithHttpMessagesAsync(string policyAssignmentId, PolicyAssignment parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateByIdWithHttpMessagesAsync(string policyAssignmentId, PolicyAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a policy assignment by ID. /// @@ -273,7 +282,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -282,7 +291,7 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string policyAssignmentId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetByIdWithHttpMessagesAsync(string policyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets policy assignments for the resource group. /// @@ -295,7 +304,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -304,7 +313,7 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets policy assignments for a resource. /// @@ -317,16 +326,17 @@ public partial interface IPolicyAssignmentsOperations /// /// 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 /// - System.Threading.Tasks.Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + [System.Obsolete()] + Task>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the policy assignments for a subscription. /// @@ -339,7 +349,7 @@ public partial interface IPolicyAssignmentsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -348,6 +358,6 @@ public partial interface IPolicyAssignmentsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyClient.cs index e36bb85aa29a..c51eb09575b7 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyClient.cs @@ -1,16 +1,19 @@ +// // 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 Newtonsoft.Json; /// /// To manage and control access to your resources, you can define @@ -18,7 +21,7 @@ namespace Microsoft.Azure.Management.ResourceManager /// public partial interface IPolicyClient : System.IDisposable { - /// + /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } @@ -26,28 +29,23 @@ public partial interface IPolicyClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - Microsoft.Rest.ServiceClientCredentials Credentials { get; } + ServiceClientCredentials Credentials { get; } /// /// The ID of the target subscription. /// string SubscriptionId { get; set; } - /// - /// The API version to use for the operation. - /// - string ApiVersion { get; } - /// /// Gets or sets the preferred language for the response. /// @@ -60,8 +58,8 @@ public partial interface IPolicyClient : System.IDisposable int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is - /// generated and included in each request. Default is true. + /// When set to true a unique x-ms-client-request-id value is generated + /// and included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } @@ -71,6 +69,11 @@ public partial interface IPolicyClient : System.IDisposable /// IPolicyAssignmentsOperations PolicyAssignments { get; } + /// + /// Gets the IPolicySetDefinitionsOperations. + /// + IPolicySetDefinitionsOperations PolicySetDefinitions { get; } + /// /// Gets the IPolicyDefinitionsOperations. /// diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyDefinitionsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyDefinitionsOperations.cs index 4eb949ada667..a30dca27760a 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyDefinitionsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicyDefinitionsOperations.cs @@ -1,15 +1,23 @@ +// // 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// PolicyDefinitionsOperations operations. @@ -40,7 +48,7 @@ public partial interface IPolicyDefinitionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string policyDefinitionName, PolicyDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string policyDefinitionName, PolicyDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a policy definition. /// @@ -59,7 +67,7 @@ public partial interface IPolicyDefinitionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string policyDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string policyDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the policy definition. /// @@ -81,7 +89,7 @@ public partial interface IPolicyDefinitionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string policyDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string policyDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the policy definitions for a subscription. /// @@ -103,7 +111,7 @@ public partial interface IPolicyDefinitionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(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)); + Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the policy definitions for a subscription. /// @@ -125,6 +133,6 @@ public partial interface IPolicyDefinitionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicySetDefinitionsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicySetDefinitionsOperations.cs new file mode 100644 index 000000000000..b86a6fdaadb8 --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IPolicySetDefinitionsOperations.cs @@ -0,0 +1,134 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PolicySetDefinitionsOperations operations. + /// + public partial interface IPolicySetDefinitionsOperations + { + /// + /// Creates or updates a policy set definition. + /// + /// + /// The name of the policy set definition to create. + /// + /// + /// The policy set definition properties. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string policySetDefinitionName, PolicySetDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a policy set definition. + /// + /// + /// The name of the policy set definition to delete. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task DeleteWithHttpMessagesAsync(string policySetDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets the policy set definition. + /// + /// + /// The name of the policy set definition to get. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string policySetDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IProvidersOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IProvidersOperations.cs index 30485bbc220c..f6e2c667380b 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IProvidersOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IProvidersOperations.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; /// /// ProvidersOperations operations. @@ -37,7 +44,7 @@ public partial interface IProvidersOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> UnregisterWithHttpMessagesAsync(string resourceProviderNamespace, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> UnregisterWithHttpMessagesAsync(string resourceProviderNamespace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Registers a subscription with a resource provider. /// @@ -59,7 +66,7 @@ public partial interface IProvidersOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> RegisterWithHttpMessagesAsync(string resourceProviderNamespace, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> RegisterWithHttpMessagesAsync(string resourceProviderNamespace, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all resource providers for a subscription. /// @@ -88,7 +95,7 @@ public partial interface IProvidersOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(int? top = default(int?), string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListWithHttpMessagesAsync(int? top = default(int?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the specified resource provider. /// @@ -114,7 +121,7 @@ public partial interface IProvidersOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all resource providers for a subscription. /// @@ -136,6 +143,6 @@ public partial interface IProvidersOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceGroupsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceGroupsOperations.cs index 57875868be8a..766a5749272b 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceGroupsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceGroupsOperations.cs @@ -1,15 +1,23 @@ +// // 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// ResourceGroupsOperations operations. @@ -35,7 +43,7 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a resource group. /// @@ -60,7 +68,7 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroup parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroup parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a resource group. /// @@ -85,7 +93,7 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a resource group. /// @@ -108,15 +116,15 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Updates a resource group. /// /// /// Resource groups can be updated through a simple PATCH operation to - /// a group address. The format of the request is the same as that - /// for creating a resource group. If a field is unspecified, the - /// current value is retained. + /// a group address. The format of the request is the same as that for + /// creating a resource group. If a field is unspecified, the current + /// value is retained. /// /// /// The name of the resource group to update. The name is case @@ -140,7 +148,7 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroupPatchable parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroupPatchable parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Captures the specified resource group as a template. /// @@ -165,7 +173,7 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> ExportTemplateWithHttpMessagesAsync(string resourceGroupName, ExportTemplateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> ExportTemplateWithHttpMessagesAsync(string resourceGroupName, ExportTemplateRequest parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the resource groups for a subscription. /// @@ -187,7 +195,7 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(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)); + Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a resource group. /// @@ -212,7 +220,7 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the resource groups for a subscription. /// @@ -234,6 +242,6 @@ public partial interface IResourceGroupsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceLinksOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceLinksOperations.cs index 456befc9d5c9..17f290230a3e 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceLinksOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceLinksOperations.cs @@ -1,15 +1,23 @@ +// // 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// ResourceLinksOperations operations. @@ -37,7 +45,7 @@ public partial interface IResourceLinksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string linkId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates a resource link between the specified resources. /// @@ -65,7 +73,7 @@ public partial interface IResourceLinksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string linkId, ResourceLink parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string linkId, ResourceLink parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a resource link with the specified ID. /// @@ -88,7 +96,7 @@ public partial interface IResourceLinksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string linkId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the linked resources for the subscription. /// @@ -110,15 +118,15 @@ public partial interface IResourceLinksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtSubscriptionWithHttpMessagesAsync(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)); + Task>> ListAtSubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of resource links at and below the specified source /// scope. /// /// - /// The fully qualified ID of the scope for getting the resource - /// links. For example, to list resource links at and under a - /// resource group, set the scope to + /// The fully qualified ID of the scope for getting the resource links. + /// For example, to list resource links at and under a resource group, + /// set the scope to /// /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myGroup. /// /// @@ -139,7 +147,7 @@ public partial interface IResourceLinksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtSourceScopeWithHttpMessagesAsync(string scope, 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)); + Task>> ListAtSourceScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all the linked resources for the subscription. /// @@ -161,7 +169,7 @@ public partial interface IResourceLinksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtSubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListAtSubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of resource links at and below the specified source /// scope. @@ -184,6 +192,6 @@ public partial interface IResourceLinksOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListAtSourceScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListAtSourceScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceManagementClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceManagementClient.cs index 0c68d19feb16..0beb1178311f 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceManagementClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourceManagementClient.cs @@ -1,23 +1,26 @@ +// // 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 Newtonsoft.Json; /// /// Provides operations for working with resources and resource groups. /// public partial interface IResourceManagementClient : System.IDisposable { - /// + /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } @@ -25,17 +28,17 @@ public partial interface IResourceManagementClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - Microsoft.Rest.ServiceClientCredentials Credentials { get; } + ServiceClientCredentials Credentials { get; } /// /// The ID of the target subscription. @@ -59,8 +62,8 @@ public partial interface IResourceManagementClient : System.IDisposable int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is - /// generated and included in each request. Default is true. + /// When set to true a unique x-ms-client-request-id value is generated + /// and included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourcesOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourcesOperations.cs index 01c7594616ff..281cec698e7f 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/IResourcesOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/IResourcesOperations.cs @@ -1,15 +1,23 @@ +// // 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.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// ResourcesOperations operations. @@ -40,19 +48,19 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - 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)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Moves resources from one resource group to another resource group. /// /// /// The resources to move must be in the same source resource group. - /// The target resource group may be in a different subscription. - /// When moving resources, both the source group and the target group - /// are locked for the duration of the operation. Write and delete + /// The target resource group may be in a different subscription. When + /// moving resources, both the source group and the target group are + /// locked for the duration of the operation. Write and delete /// operations are blocked on the groups until the move completes. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to move. /// /// /// Parameters for moving resources. @@ -69,7 +77,41 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task MoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task MoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates whether resources can be moved from one resource group to + /// another resource group. + /// + /// + /// This operation checks whether the specified resources can be moved + /// to the target. The resources to move must be in the same source + /// resource group. The target resource group may be in a different + /// subscription. If validation succeeds, it returns HTTP response code + /// 204 (no content). If validation fails, it returns HTTP response + /// code 409 (Conflict) with an error message. Retrieve the URL in the + /// Location header value to check the result of the long-running + /// operation. + /// + /// + /// The name of the resource group containing the resources to validate + /// for move. + /// + /// + /// Parameters for moving resources. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task ValidateMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all the resources in a subscription. /// @@ -91,7 +133,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(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)); + Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Checks whether a resource exists. /// @@ -126,7 +168,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a resource. /// @@ -161,7 +203,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a resource. /// @@ -202,7 +244,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a resource. /// @@ -240,13 +282,13 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Checks by ID whether a resource exists. /// /// - /// The fully qualified ID of the resource, including the resource - /// name and resource type. Use the format, + /// The fully qualified ID of the resource, including the resource name + /// and resource type. Use the format, /// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} /// /// @@ -264,13 +306,13 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CheckExistenceByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CheckExistenceByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a resource by ID. /// /// - /// The fully qualified ID of the resource, including the resource - /// name and resource type. Use the format, + /// The fully qualified ID of the resource, including the resource name + /// and resource type. Use the format, /// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} /// /// @@ -288,13 +330,13 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create a resource by ID. /// /// - /// The fully qualified ID of the resource, including the resource - /// name and resource type. Use the format, + /// The fully qualified ID of the resource, including the resource name + /// and resource type. Use the format, /// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} /// /// @@ -318,13 +360,13 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a resource by ID. /// /// - /// The fully qualified ID of the resource, including the resource - /// name and resource type. Use the format, + /// The fully qualified ID of the resource, including the resource name + /// and resource type. Use the format, /// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} /// /// @@ -345,19 +387,53 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Moves resources from one resource group to another resource group. /// /// /// The resources to move must be in the same source resource group. - /// The target resource group may be in a different subscription. - /// When moving resources, both the source group and the target group - /// are locked for the duration of the operation. Write and delete + /// The target resource group may be in a different subscription. When + /// moving resources, both the source group and the target group are + /// locked for the duration of the operation. Write and delete /// operations are blocked on the groups until the move completes. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to move. + /// + /// + /// Parameters for moving resources. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Validates whether resources can be moved from one resource group to + /// another resource group. + /// + /// + /// This operation checks whether the specified resources can be moved + /// to the target. The resources to move must be in the same source + /// resource group. The target resource group may be in a different + /// subscription. If validation succeeds, it returns HTTP response code + /// 204 (no content). If validation fails, it returns HTTP response + /// code 409 (Conflict) with an error message. Retrieve the URL in the + /// Location header value to check the result of the long-running + /// operation. + /// + /// + /// The name of the resource group containing the resources to validate + /// for move. /// /// /// Parameters for moving resources. @@ -374,7 +450,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task BeginMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task BeginValidateMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a resource. /// @@ -409,7 +485,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a resource. /// @@ -450,13 +526,13 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a resource by ID. /// /// - /// The fully qualified ID of the resource, including the resource - /// name and resource type. Use the format, + /// The fully qualified ID of the resource, including the resource name + /// and resource type. Use the format, /// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} /// /// @@ -474,13 +550,13 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task BeginDeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task BeginDeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create a resource by ID. /// /// - /// The fully qualified ID of the resource, including the resource - /// name and resource type. Use the format, + /// The fully qualified ID of the resource, including the resource name + /// and resource type. Use the format, /// /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name} /// /// @@ -504,7 +580,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> BeginCreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> BeginCreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all the resources for a resource group. /// @@ -526,7 +602,7 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all the resources in a subscription. /// @@ -548,6 +624,6 @@ public partial interface IResourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionClient.cs index 95e63ddad2ca..8fb268c22c37 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionClient.cs @@ -1,16 +1,19 @@ +// // 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 Newtonsoft.Json; /// /// All resource groups and resources exist within subscriptions. These @@ -20,7 +23,7 @@ namespace Microsoft.Azure.Management.ResourceManager /// public partial interface ISubscriptionClient : System.IDisposable { - /// + /// /// The base URI of the service. /// System.Uri BaseUri { get; set; } @@ -28,17 +31,17 @@ public partial interface ISubscriptionClient : System.IDisposable /// /// Gets or sets json serialization settings. /// - Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + JsonSerializerSettings SerializationSettings { get; } /// /// Gets or sets json deserialization settings. /// - Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + JsonSerializerSettings DeserializationSettings { get; } /// /// Credentials needed for the client to connect to Azure. /// - Microsoft.Rest.ServiceClientCredentials Credentials { get; } + ServiceClientCredentials Credentials { get; } /// /// The API version to use for the operation. @@ -57,8 +60,8 @@ public partial interface ISubscriptionClient : System.IDisposable int? LongRunningOperationRetryTimeout { get; set; } /// - /// When set to true a unique x-ms-client-request-id value is - /// generated and included in each request. Default is true. + /// When set to true a unique x-ms-client-request-id value is generated + /// and included in each request. Default is true. /// bool? GenerateClientRequestId { get; set; } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionsOperations.cs index 02a6f73dc2de..af47db013ad0 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ISubscriptionsOperations.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; /// /// SubscriptionsOperations operations. @@ -42,7 +49,7 @@ public partial interface ISubscriptionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets details about a specified subscription. /// @@ -64,7 +71,7 @@ public partial interface ISubscriptionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string subscriptionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all subscriptions for a tenant. /// @@ -83,7 +90,7 @@ public partial interface ISubscriptionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets all subscriptions for a tenant. /// @@ -105,6 +112,6 @@ public partial interface ISubscriptionsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ITagsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ITagsOperations.cs index 7f9e37da65ab..67da9d1f704f 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ITagsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ITagsOperations.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; /// /// TagsOperations operations. @@ -37,7 +44,7 @@ public partial interface ITagsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteValueWithHttpMessagesAsync(string tagName, string tagValue, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteValueWithHttpMessagesAsync(string tagName, string tagValue, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a tag value. The name of the tag must already exist. /// @@ -62,15 +69,15 @@ public partial interface ITagsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateValueWithHttpMessagesAsync(string tagName, string tagValue, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateValueWithHttpMessagesAsync(string tagName, string tagValue, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates a tag in the subscription. /// /// /// The tag name can have a maximum of 512 characters and is case - /// insensitive. Tag names created by Azure have prefixes of - /// microsoft, azure, or windows. You cannot create tags with one of - /// these prefixes. + /// insensitive. Tag names created by Azure have prefixes of microsoft, + /// azure, or windows. You cannot create tags with one of these + /// prefixes. /// /// /// The name of the tag to create. @@ -90,7 +97,7 @@ public partial interface ITagsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string tagName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string tagName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a tag from the subscription. /// @@ -113,7 +120,7 @@ public partial interface ITagsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string tagName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string tagName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the names and values of all resource tags that are defined in /// a subscription. @@ -133,7 +140,7 @@ public partial interface ITagsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the names and values of all resource tags that are defined in /// a subscription. @@ -156,6 +163,6 @@ public partial interface ITagsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ITenantsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ITenantsOperations.cs index 3a4f58603d19..dd947f7281f7 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ITenantsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ITenantsOperations.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; /// /// TenantsOperations operations. @@ -34,7 +41,7 @@ public partial interface ITenantsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the tenants for your account. /// @@ -56,6 +63,6 @@ public partial interface ITenantsOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLinkClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLinkClient.cs index 10e655224afc..eb366cf7264e 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLinkClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLinkClient.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 resources can be linked together to form logical relationships. @@ -21,7 +29,7 @@ namespace Microsoft.Azure.Management.ResourceManager /// If any of the linked resources are deleted or moved, the link owner /// must clean up the remaining link. /// - public partial class ManagementLinkClient : Microsoft.Rest.ServiceClient, IManagementLinkClient, IAzureClient + public partial class ManagementLinkClient : ServiceClient, IManagementLinkClient, IAzureClient { /// /// The base URI of the service. @@ -31,17 +39,17 @@ public partial class ManagementLinkClient : 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 ManagementLinkClient : Microsoft.Rest.ServiceClient /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ManagementLinkClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + protected ManagementLinkClient(params DelegatingHandler[] handlers) : base(handlers) { - this.Initialize(); + Initialize(); } /// @@ -95,9 +103,9 @@ protected ManagementLinkClient(params System.Net.Http.DelegatingHandler[] handle /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ManagementLinkClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected ManagementLinkClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { - this.Initialize(); + Initialize(); } /// @@ -112,13 +120,13 @@ protected ManagementLinkClient(System.Net.Http.HttpClientHandler rootHandler, pa /// /// Thrown when a required parameter is null /// - protected ManagementLinkClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + protected ManagementLinkClient(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 ManagementLinkClient(System.Uri baseUri, params System.Net.Http.Delega /// /// Thrown when a required parameter is null /// - protected ManagementLinkClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected ManagementLinkClient(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 ManagementLinkClient(System.Uri baseUri, System.Net.Http.HttpClientHan /// /// Thrown when a required parameter is null /// - public ManagementLinkClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public ManagementLinkClient(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 ManagementLinkClient(Microsoft.Rest.ServiceClientCredentials credentials, /// /// Thrown when a required parameter is null /// - public ManagementLinkClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ManagementLinkClient(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 ManagementLinkClient(Microsoft.Rest.ServiceClientCredentials credentials, /// /// Thrown when a required parameter is null /// - public ManagementLinkClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public ManagementLinkClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -223,11 +231,11 @@ public ManagementLinkClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred { 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 ManagementLinkClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred /// /// Thrown when a required parameter is null /// - public ManagementLinkClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ManagementLinkClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -259,11 +267,11 @@ public ManagementLinkClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred { 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 ManagementLinkClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred /// private void Initialize() { - this.ResourceLinks = new ResourceLinksOperations(this); - this.BaseUri = new System.Uri("https://management.azure.com"); - this.ApiVersion = "2016-09-01"; - this.AcceptLanguage = "en-US"; - this.LongRunningOperationRetryTimeout = 30; - this.GenerateClientRequestId = true; - SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + ResourceLinks = new ResourceLinksOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2016-09-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/ManagementLockClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLockClient.cs index f8bdf40f312e..644426efbaf0 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLockClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLockClient.cs @@ -1,23 +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 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 resources can be locked to prevent other users in your /// organization from deleting or modifying resources. /// - public partial class ManagementLockClient : Microsoft.Rest.ServiceClient, IManagementLockClient, IAzureClient + public partial class ManagementLockClient : ServiceClient, IManagementLockClient, IAzureClient { /// /// The base URI of the service. @@ -27,17 +35,17 @@ public partial class ManagementLockClient : 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. @@ -77,9 +85,9 @@ public partial class ManagementLockClient : Microsoft.Rest.ServiceClient /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ManagementLockClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + protected ManagementLockClient(params DelegatingHandler[] handlers) : base(handlers) { - this.Initialize(); + Initialize(); } /// @@ -91,9 +99,9 @@ protected ManagementLockClient(params System.Net.Http.DelegatingHandler[] handle /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ManagementLockClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected ManagementLockClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { - this.Initialize(); + Initialize(); } /// @@ -108,13 +116,13 @@ protected ManagementLockClient(System.Net.Http.HttpClientHandler rootHandler, pa /// /// Thrown when a required parameter is null /// - protected ManagementLockClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + protected ManagementLockClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -132,13 +140,13 @@ protected ManagementLockClient(System.Uri baseUri, params System.Net.Http.Delega /// /// Thrown when a required parameter is null /// - protected ManagementLockClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected ManagementLockClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -153,16 +161,16 @@ protected ManagementLockClient(System.Uri baseUri, System.Net.Http.HttpClientHan /// /// Thrown when a required parameter is null /// - public ManagementLockClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public ManagementLockClient(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); } } @@ -181,16 +189,16 @@ public ManagementLockClient(Microsoft.Rest.ServiceClientCredentials credentials, /// /// Thrown when a required parameter is null /// - public ManagementLockClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ManagementLockClient(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); } } @@ -209,7 +217,7 @@ public ManagementLockClient(Microsoft.Rest.ServiceClientCredentials credentials, /// /// Thrown when a required parameter is null /// - public ManagementLockClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public ManagementLockClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -219,11 +227,11 @@ public ManagementLockClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred { 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); } } @@ -245,7 +253,7 @@ public ManagementLockClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred /// /// Thrown when a required parameter is null /// - public ManagementLockClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ManagementLockClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -255,11 +263,11 @@ public ManagementLockClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred { 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); } } @@ -272,41 +280,41 @@ public ManagementLockClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCred /// private void Initialize() { - this.ManagementLocks = new ManagementLocksOperations(this); - this.BaseUri = new System.Uri("https://management.azure.com"); - this.ApiVersion = "2016-09-01"; - this.AcceptLanguage = "en-US"; - this.LongRunningOperationRetryTimeout = 30; - this.GenerateClientRequestId = true; - SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + ManagementLocks = new ManagementLocksOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2016-09-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() } }; - SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); - DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + 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.Serialization.TransformationJsonConverter()); - DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); - } + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLocksOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLocksOperations.cs index 43b70d0a2e5b..246473f970bc 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLocksOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLocksOperations.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; /// /// ManagementLocksOperations operations. /// - internal partial class ManagementLocksOperations : Microsoft.Rest.IServiceOperations, IManagementLocksOperations + internal partial class ManagementLocksOperations : IServiceOperations, IManagementLocksOperations { /// /// Initializes a new instance of the ManagementLocksOperations class. @@ -29,11 +39,11 @@ internal partial class ManagementLocksOperations : Microsoft.Rest.IServiceOperat /// internal ManagementLocksOperations(ManagementLockClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -67,105 +77,110 @@ internal ManagementLocksOperations(ManagementLockClient 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> CreateOrUpdateAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, ManagementLockObject 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 (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } 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("lockName", lockName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAtResourceGroupLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAtResourceGroupLevel", 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.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -182,56 +197,56 @@ internal ManagementLocksOperations(ManagementLockClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 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) @@ -241,7 +256,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -254,16 +269,16 @@ internal ManagementLocksOperations(ManagementLockClient 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 @@ -272,21 +287,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -312,93 +327,98 @@ internal ManagementLocksOperations(ManagementLockClient 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 DeleteAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, 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 (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteAtResourceGroupLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAtResourceGroupLevel", 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.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -414,43 +434,51 @@ internal ManagementLocksOperations(ManagementLockClient 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 && (int)_statusCode != 200) { - 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) @@ -460,7 +488,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -469,7 +497,7 @@ internal ManagementLocksOperations(ManagementLockClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -489,96 +517,101 @@ internal ManagementLocksOperations(ManagementLockClient 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> GetAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetAtResourceGroupLevelWithHttpMessagesAsync(string resourceGroupName, string lockName, 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 (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAtResourceGroupLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetAtResourceGroupLevel", 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.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -594,51 +627,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -648,7 +681,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -661,21 +694,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -703,85 +736,90 @@ internal ManagementLocksOperations(ManagementLockClient 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> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateByScopeWithHttpMessagesAsync(string scope, string lockName, ManagementLockObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } 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"); } // 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("scope", scope); tracingParameters.Add("lockName", lockName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateByScope", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateByScope", 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -798,56 +836,56 @@ internal ManagementLocksOperations(ManagementLockClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 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) @@ -857,7 +895,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -870,16 +908,16 @@ internal ManagementLocksOperations(ManagementLockClient 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 @@ -888,21 +926,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -922,73 +960,78 @@ internal ManagementLocksOperations(ManagementLockClient 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 DeleteByScopeWithHttpMessagesAsync(string scope, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteByScopeWithHttpMessagesAsync(string scope, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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"); } // 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("scope", scope); tracingParameters.Add("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteByScope", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteByScope", 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -1004,43 +1047,51 @@ internal ManagementLocksOperations(ManagementLockClient 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 && (int)_statusCode != 200) { - 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) @@ -1050,7 +1101,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -1059,7 +1110,7 @@ internal ManagementLocksOperations(ManagementLockClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -1079,76 +1130,81 @@ internal ManagementLocksOperations(ManagementLockClient 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> GetByScopeWithHttpMessagesAsync(string scope, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetByScopeWithHttpMessagesAsync(string scope, string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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"); } // 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("scope", scope); tracingParameters.Add("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByScope", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetByScope", 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{scope}", System.Uri.EscapeDataString(scope)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -1164,51 +1220,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -1218,7 +1274,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -1231,21 +1287,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -1289,82 +1345,85 @@ internal ManagementLocksOperations(ManagementLockClient 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> CreateOrUpdateAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } 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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); @@ -1373,10 +1432,10 @@ internal ManagementLocksOperations(ManagementLockClient client) tracingParameters.Add("lockName", lockName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAtResourceLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAtResourceLevel", 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); @@ -1384,34 +1443,36 @@ internal ManagementLocksOperations(ManagementLockClient client) _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -1428,56 +1489,56 @@ internal ManagementLocksOperations(ManagementLockClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 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) @@ -1487,7 +1548,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -1500,16 +1561,16 @@ internal ManagementLocksOperations(ManagementLockClient 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 @@ -1518,21 +1579,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -1571,71 +1632,74 @@ internal ManagementLocksOperations(ManagementLockClient 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 DeleteAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); @@ -1643,10 +1707,10 @@ internal ManagementLocksOperations(ManagementLockClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteAtResourceLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAtResourceLevel", 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); @@ -1654,34 +1718,36 @@ internal ManagementLocksOperations(ManagementLockClient client) _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -1697,43 +1763,51 @@ internal ManagementLocksOperations(ManagementLockClient 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 && (int)_statusCode != 200) { - 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) @@ -1743,7 +1817,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -1752,7 +1826,7 @@ internal ManagementLocksOperations(ManagementLockClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -1784,74 +1858,77 @@ internal ManagementLocksOperations(ManagementLockClient 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> GetAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); @@ -1859,10 +1936,10 @@ internal ManagementLocksOperations(ManagementLockClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAtResourceLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetAtResourceLevel", 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); @@ -1870,34 +1947,36 @@ internal ManagementLocksOperations(ManagementLockClient client) _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -1913,51 +1992,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -1967,7 +2046,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -1980,21 +2059,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -2022,84 +2101,89 @@ internal ManagementLocksOperations(ManagementLockClient 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> CreateOrUpdateAtSubscriptionLevelWithHttpMessagesAsync(string lockName, ManagementLockObject parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateAtSubscriptionLevelWithHttpMessagesAsync(string lockName, ManagementLockObject parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } 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("lockName", lockName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAtSubscriptionLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateAtSubscriptionLevel", 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.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -2116,56 +2200,56 @@ internal ManagementLocksOperations(ManagementLockClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 201 && (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) @@ -2175,7 +2259,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -2188,16 +2272,16 @@ internal ManagementLocksOperations(ManagementLockClient 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 @@ -2206,21 +2290,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -2243,72 +2327,77 @@ internal ManagementLocksOperations(ManagementLockClient 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 DeleteAtSubscriptionLevelWithHttpMessagesAsync(string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteAtSubscriptionLevelWithHttpMessagesAsync(string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteAtSubscriptionLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteAtSubscriptionLevel", 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.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -2324,43 +2413,51 @@ internal ManagementLocksOperations(ManagementLockClient 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 && (int)_statusCode != 200) { - 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) @@ -2370,7 +2467,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -2379,7 +2476,7 @@ internal ManagementLocksOperations(ManagementLockClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -2396,75 +2493,80 @@ internal ManagementLocksOperations(ManagementLockClient 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> GetAtSubscriptionLevelWithHttpMessagesAsync(string lockName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetAtSubscriptionLevelWithHttpMessagesAsync(string lockName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (lockName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "lockName"); + throw new ValidationException(ValidationRules.CannotBeNull, "lockName"); } - 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("lockName", lockName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAtSubscriptionLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetAtSubscriptionLevel", 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.Authorization/locks/{lockName}").ToString(); _url = _url.Replace("{lockName}", System.Uri.EscapeDataString(lockName)); - _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) @@ -2480,51 +2582,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -2534,7 +2636,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -2547,21 +2649,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -2581,99 +2683,104 @@ internal ManagementLocksOperations(ManagementLockClient 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>> ListAtResourceGroupLevelWithHttpMessagesAsync(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>> ListAtResourceGroupLevelWithHttpMessagesAsync(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, "ListAtResourceGroupLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceGroupLevel", 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.Authorization/locks").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) @@ -2689,51 +2796,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -2743,7 +2850,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -2756,21 +2863,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -2803,70 +2910,73 @@ internal ManagementLocksOperations(ManagementLockClient 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>> ListAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, 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>> ListAtResourceLevelWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } - 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("resourceProviderNamespace", resourceProviderNamespace); @@ -2874,52 +2984,54 @@ internal ManagementLocksOperations(ManagementLockClient client) tracingParameters.Add("resourceType", resourceType); tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceLevel", 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); _url = _url.Replace("{parentResourcePath}", parentResourcePath); _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _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) @@ -2935,51 +3047,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -2989,7 +3101,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -3002,21 +3114,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -3033,78 +3145,83 @@ internal ManagementLocksOperations(ManagementLockClient 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>> ListAtSubscriptionLevelWithHttpMessagesAsync(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>> ListAtSubscriptionLevelWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), 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("odataQuery", odataQuery); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscriptionLevel", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscriptionLevel", 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.Authorization/locks").ToString(); - _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) @@ -3120,51 +3237,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -3174,7 +3291,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -3187,21 +3304,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -3218,61 +3335,66 @@ internal ManagementLocksOperations(ManagementLockClient 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>> ListAtResourceGroupLevelNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListAtResourceGroupLevelNextWithHttpMessagesAsync(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, "ListAtResourceGroupLevelNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceGroupLevelNext", 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) @@ -3288,51 +3410,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -3342,7 +3464,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -3355,21 +3477,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -3386,61 +3508,66 @@ internal ManagementLocksOperations(ManagementLockClient 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>> ListAtResourceLevelNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListAtResourceLevelNextWithHttpMessagesAsync(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, "ListAtResourceLevelNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtResourceLevelNext", 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) @@ -3456,51 +3583,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -3510,7 +3637,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -3523,21 +3650,21 @@ internal ManagementLocksOperations(ManagementLockClient 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; } @@ -3554,61 +3681,66 @@ internal ManagementLocksOperations(ManagementLockClient 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>> ListAtSubscriptionLevelNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListAtSubscriptionLevelNextWithHttpMessagesAsync(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, "ListAtSubscriptionLevelNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscriptionLevelNext", 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) @@ -3624,51 +3756,51 @@ internal ManagementLocksOperations(ManagementLockClient 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) @@ -3678,7 +3810,7 @@ internal ManagementLocksOperations(ManagementLockClient 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")) @@ -3691,21 +3823,21 @@ internal ManagementLocksOperations(ManagementLockClient 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/ManagementLocksOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLocksOperationsExtensions.cs index 9a73c7c2251f..83f3b2d62c49 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLocksOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ManagementLocksOperationsExtensions.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 ManagementLocksOperations. @@ -42,7 +47,7 @@ public static partial class ManagementLocksOperationsExtensions /// public static ManagementLockObject CreateOrUpdateAtResourceGroupLevel(this IManagementLocksOperations operations, string resourceGroupName, string lockName, ManagementLockObject parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAtResourceGroupLevelAsync(resourceGroupName, lockName, parameters).GetAwaiter().GetResult(); } /// @@ -71,7 +76,7 @@ public static ManagementLockObject CreateOrUpdateAtResourceGroupLevel(this IMana /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateAtResourceGroupLevelWithHttpMessagesAsync(resourceGroupName, lockName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -99,7 +104,7 @@ public static ManagementLockObject CreateOrUpdateAtResourceGroupLevel(this IMana /// public static void DeleteAtResourceGroupLevel(this IManagementLocksOperations operations, string resourceGroupName, string lockName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).DeleteAtResourceGroupLevelAsync(resourceGroupName, lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAtResourceGroupLevelAsync(resourceGroupName, lockName).GetAwaiter().GetResult(); } /// @@ -123,9 +128,9 @@ public static void DeleteAtResourceGroupLevel(this IManagementLocksOperations op /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteAtResourceGroupLevelWithHttpMessagesAsync(resourceGroupName, lockName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteAtResourceGroupLevelWithHttpMessagesAsync(resourceGroupName, lockName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -142,7 +147,7 @@ public static void DeleteAtResourceGroupLevel(this IManagementLocksOperations op /// public static ManagementLockObject GetAtResourceGroupLevel(this IManagementLocksOperations operations, string resourceGroupName, string lockName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).GetAtResourceGroupLevelAsync(resourceGroupName, lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAtResourceGroupLevelAsync(resourceGroupName, lockName).GetAwaiter().GetResult(); } /// @@ -160,7 +165,7 @@ public static ManagementLockObject GetAtResourceGroupLevel(this IManagementLocks /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAtResourceGroupLevelWithHttpMessagesAsync(resourceGroupName, lockName, null, cancellationToken).ConfigureAwait(false)) { @@ -190,7 +195,7 @@ public static ManagementLockObject GetAtResourceGroupLevel(this IManagementLocks /// public static ManagementLockObject CreateOrUpdateByScope(this IManagementLocksOperations operations, string scope, string lockName, ManagementLockObject parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).CreateOrUpdateByScopeAsync(scope, lockName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateByScopeAsync(scope, lockName, parameters).GetAwaiter().GetResult(); } /// @@ -216,7 +221,7 @@ public static ManagementLockObject CreateOrUpdateByScope(this IManagementLocksOp /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateByScopeAsync(this IManagementLocksOperations operations, string scope, string lockName, ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateByScopeAsync(this IManagementLocksOperations operations, string scope, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateByScopeWithHttpMessagesAsync(scope, lockName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -238,7 +243,7 @@ public static ManagementLockObject CreateOrUpdateByScope(this IManagementLocksOp /// public static void DeleteByScope(this IManagementLocksOperations operations, string scope, string lockName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).DeleteByScopeAsync(scope, lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteByScopeAsync(scope, lockName).GetAwaiter().GetResult(); } /// @@ -256,9 +261,9 @@ public static void DeleteByScope(this IManagementLocksOperations operations, str /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteByScopeAsync(this IManagementLocksOperations operations, string scope, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteByScopeAsync(this IManagementLocksOperations operations, string scope, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteByScopeWithHttpMessagesAsync(scope, lockName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteByScopeWithHttpMessagesAsync(scope, lockName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -275,7 +280,7 @@ public static void DeleteByScope(this IManagementLocksOperations operations, str /// public static ManagementLockObject GetByScope(this IManagementLocksOperations operations, string scope, string lockName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).GetByScopeAsync(scope, lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetByScopeAsync(scope, lockName).GetAwaiter().GetResult(); } /// @@ -293,7 +298,7 @@ public static ManagementLockObject GetByScope(this IManagementLocksOperations op /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetByScopeAsync(this IManagementLocksOperations operations, string scope, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetByScopeAsync(this IManagementLocksOperations operations, string scope, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetByScopeWithHttpMessagesAsync(scope, lockName, null, cancellationToken).ConfigureAwait(false)) { @@ -339,7 +344,7 @@ public static ManagementLockObject GetByScope(this IManagementLocksOperations op /// public static ManagementLockObject CreateOrUpdateAtResourceLevel(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).CreateOrUpdateAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters).GetAwaiter().GetResult(); } /// @@ -381,7 +386,7 @@ public static ManagementLockObject CreateOrUpdateAtResourceLevel(this IManagemen /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -422,7 +427,7 @@ public static ManagementLockObject CreateOrUpdateAtResourceLevel(this IManagemen /// public static void DeleteAtResourceLevel(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).DeleteAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).GetAwaiter().GetResult(); } /// @@ -459,9 +464,9 @@ public static void DeleteAtResourceLevel(this IManagementLocksOperations operati /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -490,7 +495,7 @@ public static void DeleteAtResourceLevel(this IManagementLocksOperations operati /// public static ManagementLockObject GetAtResourceLevel(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).GetAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName).GetAwaiter().GetResult(); } /// @@ -520,7 +525,7 @@ public static ManagementLockObject GetAtResourceLevel(this IManagementLocksOpera /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, lockName, null, cancellationToken).ConfigureAwait(false)) { @@ -550,7 +555,7 @@ public static ManagementLockObject GetAtResourceLevel(this IManagementLocksOpera /// public static ManagementLockObject CreateOrUpdateAtSubscriptionLevel(this IManagementLocksOperations operations, string lockName, ManagementLockObject parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAtSubscriptionLevelAsync(lockName, parameters).GetAwaiter().GetResult(); } /// @@ -576,7 +581,7 @@ public static ManagementLockObject CreateOrUpdateAtSubscriptionLevel(this IManag /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, ManagementLockObject parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, ManagementLockObject parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateAtSubscriptionLevelWithHttpMessagesAsync(lockName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -601,7 +606,7 @@ public static ManagementLockObject CreateOrUpdateAtSubscriptionLevel(this IManag /// public static void DeleteAtSubscriptionLevel(this IManagementLocksOperations operations, string lockName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).DeleteAtSubscriptionLevelAsync(lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAtSubscriptionLevelAsync(lockName).GetAwaiter().GetResult(); } /// @@ -622,9 +627,9 @@ public static void DeleteAtSubscriptionLevel(this IManagementLocksOperations ope /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteAtSubscriptionLevelWithHttpMessagesAsync(lockName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteAtSubscriptionLevelWithHttpMessagesAsync(lockName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -638,7 +643,7 @@ public static void DeleteAtSubscriptionLevel(this IManagementLocksOperations ope /// public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksOperations operations, string lockName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).GetAtSubscriptionLevelAsync(lockName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAtSubscriptionLevelAsync(lockName).GetAwaiter().GetResult(); } /// @@ -653,7 +658,7 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAtSubscriptionLevelAsync(this IManagementLocksOperations operations, string lockName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAtSubscriptionLevelWithHttpMessagesAsync(lockName, null, cancellationToken).ConfigureAwait(false)) { @@ -673,9 +678,9 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage ListAtResourceGroupLevel(this IManagementLocksOperations operations, string resourceGroupName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage ListAtResourceGroupLevel(this IManagementLocksOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtResourceGroupLevelAsync(resourceGroupName, odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtResourceGroupLevelAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); } /// @@ -693,7 +698,7 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// The cancellation token. /// - public static async Task> ListAtResourceGroupLevelAsync(this IManagementLocksOperations 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> ListAtResourceGroupLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtResourceGroupLevelWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -726,9 +731,9 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage ListAtResourceLevel(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage ListAtResourceLevel(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtResourceLevelAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery).GetAwaiter().GetResult(); } /// @@ -759,7 +764,7 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// The cancellation token. /// - public static async Task> ListAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtResourceLevelAsync(this IManagementLocksOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtResourceLevelWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -776,9 +781,9 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage ListAtSubscriptionLevel(this IManagementLocksOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage ListAtSubscriptionLevel(this IManagementLocksOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtSubscriptionLevelAsync(odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtSubscriptionLevelAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -793,7 +798,7 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// The cancellation token. /// - public static async Task> ListAtSubscriptionLevelAsync(this IManagementLocksOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtSubscriptionLevelAsync(this IManagementLocksOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSubscriptionLevelWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -810,9 +815,9 @@ public static ManagementLockObject GetAtSubscriptionLevel(this IManagementLocksO /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListAtResourceGroupLevelNext(this IManagementLocksOperations operations, string nextPageLink) + public static IPage ListAtResourceGroupLevelNext(this IManagementLocksOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtResourceGroupLevelNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtResourceGroupLevelNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -827,7 +832,7 @@ public static Microsoft.Rest.Azure.IPage ListAtResourceGro /// /// The cancellation token. /// - public static async Task> ListAtResourceGroupLevelNextAsync(this IManagementLocksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtResourceGroupLevelNextAsync(this IManagementLocksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtResourceGroupLevelNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -844,9 +849,9 @@ public static Microsoft.Rest.Azure.IPage ListAtResourceGro /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListAtResourceLevelNext(this IManagementLocksOperations operations, string nextPageLink) + public static IPage ListAtResourceLevelNext(this IManagementLocksOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtResourceLevelNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtResourceLevelNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -861,7 +866,7 @@ public static Microsoft.Rest.Azure.IPage ListAtResourceLev /// /// The cancellation token. /// - public static async Task> ListAtResourceLevelNextAsync(this IManagementLocksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtResourceLevelNextAsync(this IManagementLocksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtResourceLevelNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -878,9 +883,9 @@ public static Microsoft.Rest.Azure.IPage ListAtResourceLev /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListAtSubscriptionLevelNext(this IManagementLocksOperations operations, string nextPageLink) + public static IPage ListAtSubscriptionLevelNext(this IManagementLocksOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IManagementLocksOperations)s).ListAtSubscriptionLevelNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtSubscriptionLevelNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -895,7 +900,7 @@ public static Microsoft.Rest.Azure.IPage ListAtSubscriptio /// /// The cancellation token. /// - public static async Task> ListAtSubscriptionLevelNextAsync(this IManagementLocksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtSubscriptionLevelNextAsync(this IManagementLocksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSubscriptionLevelNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasPathType.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasPathType.cs index b44d15674b00..a20d21d4504f 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasPathType.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasPathType.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,30 +23,39 @@ public partial class AliasPathType /// /// Initializes a new instance of the AliasPathType class. /// - public AliasPathType() { } + public AliasPathType() + { + CustomInit(); + } /// /// Initializes a new instance of the AliasPathType class. /// /// The path of an alias. /// The API versions. - public AliasPathType(string path = default(string), System.Collections.Generic.IList apiVersions = default(System.Collections.Generic.IList)) + public AliasPathType(string path = default(string), IList apiVersions = default(IList)) { Path = path; ApiVersions = apiVersions; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the path of an alias. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "path")] + [JsonProperty(PropertyName = "path")] public string Path { get; set; } /// /// Gets or sets the API versions. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "apiVersions")] - public System.Collections.Generic.IList ApiVersions { get; set; } + [JsonProperty(PropertyName = "apiVersions")] + public IList ApiVersions { get; set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasType.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasType.cs index 47a77ee7cd3d..d75490718220 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasType.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/AliasType.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,30 +23,39 @@ public partial class AliasType /// /// Initializes a new instance of the AliasType class. /// - public AliasType() { } + public AliasType() + { + CustomInit(); + } /// /// Initializes a new instance of the AliasType class. /// /// The alias name. /// The paths for an alias. - public AliasType(string name = default(string), System.Collections.Generic.IList paths = default(System.Collections.Generic.IList)) + public AliasType(string name = default(string), IList paths = default(IList)) { Name = name; Paths = paths; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the alias name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets the paths for an alias. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "paths")] - public System.Collections.Generic.IList Paths { get; set; } + [JsonProperty(PropertyName = "paths")] + public IList Paths { get; set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/BasicDependency.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/BasicDependency.cs index 0e0abf8dbd43..86d63ecd1367 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/BasicDependency.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/BasicDependency.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class BasicDependency /// /// Initializes a new instance of the BasicDependency class. /// - public BasicDependency() { } + public BasicDependency() + { + CustomInit(); + } /// /// Initializes a new instance of the BasicDependency class. @@ -31,24 +37,30 @@ public BasicDependency() { } Id = id; ResourceType = resourceType; ResourceName = resourceName; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the ID of the dependency. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the dependency resource type. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + [JsonProperty(PropertyName = "resourceType")] public string ResourceType { get; set; } /// /// Gets or sets the dependency resource name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceName")] + [JsonProperty(PropertyName = "resourceName")] public string ResourceName { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DebugSetting.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DebugSetting.cs index 5d86191b0566..2c9d6a06ded4 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DebugSetting.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DebugSetting.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; public partial class DebugSetting @@ -15,7 +18,10 @@ public partial class DebugSetting /// /// Initializes a new instance of the DebugSetting class. /// - public DebugSetting() { } + public DebugSetting() + { + CustomInit(); + } /// /// Initializes a new instance of the DebugSetting class. @@ -23,27 +29,33 @@ public DebugSetting() { } /// Specifies the type of information to log /// for debugging. The permitted values are none, requestContent, /// responseContent, or both requestContent and responseContent - /// separated by a comma. The default is none. When setting this - /// value, carefully consider the type of information you are passing - /// in during deployment. By logging information about the request or + /// separated by a comma. The default is none. When setting this value, + /// carefully consider the type of information you are passing in + /// during deployment. By logging information about the request or /// response, you could potentially expose sensitive data that is /// retrieved through the deployment operations. public DebugSetting(string detailLevel = default(string)) { DetailLevel = detailLevel; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets specifies the type of information to log for /// debugging. The permitted values are none, requestContent, /// responseContent, or both requestContent and responseContent - /// separated by a comma. The default is none. When setting this - /// value, carefully consider the type of information you are passing - /// in during deployment. By logging information about the request or + /// separated by a comma. The default is none. When setting this value, + /// carefully consider the type of information you are passing in + /// during deployment. By logging information about the request or /// response, you could potentially expose sensitive data that is /// retrieved through the deployment operations. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "detailLevel")] + [JsonProperty(PropertyName = "detailLevel")] public string DetailLevel { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Dependency.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Dependency.cs index 5ee575dfd07e..dfbbe31aa24a 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Dependency.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Dependency.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +23,10 @@ public partial class Dependency /// /// Initializes a new instance of the Dependency class. /// - public Dependency() { } + public Dependency() + { + CustomInit(); + } /// /// Initializes a new instance of the Dependency class. @@ -27,36 +35,42 @@ public Dependency() { } /// The ID of the dependency. /// The dependency resource type. /// The dependency resource name. - public Dependency(System.Collections.Generic.IList dependsOn = default(System.Collections.Generic.IList), string id = default(string), string resourceType = default(string), string resourceName = default(string)) + public Dependency(IList dependsOn = default(IList), string id = default(string), string resourceType = default(string), string resourceName = default(string)) { DependsOn = dependsOn; Id = id; ResourceType = resourceType; ResourceName = resourceName; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the list of dependencies. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "dependsOn")] - public System.Collections.Generic.IList DependsOn { get; set; } + [JsonProperty(PropertyName = "dependsOn")] + public IList DependsOn { get; set; } /// /// Gets or sets the ID of the dependency. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the dependency resource type. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + [JsonProperty(PropertyName = "resourceType")] public string ResourceType { get; set; } /// /// Gets or sets the dependency resource name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceName")] + [JsonProperty(PropertyName = "resourceName")] public string ResourceName { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Deployment.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Deployment.cs index 2e0715234203..8a84c7845126 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Deployment.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Deployment.cs @@ -1,13 +1,17 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +22,10 @@ public partial class Deployment /// /// Initializes a new instance of the Deployment class. /// - public Deployment() { } + public Deployment() + { + CustomInit(); + } /// /// Initializes a new instance of the Deployment class. @@ -27,29 +34,35 @@ public Deployment() { } public Deployment(DeploymentProperties properties) { Properties = properties; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the deployment properties. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public DeploymentProperties Properties { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (Properties == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Properties"); + throw new ValidationException(ValidationRules.CannotBeNull, "Properties"); } - if (this.Properties != null) + if (Properties != null) { - this.Properties.Validate(); + Properties.Validate(); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExportResult.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExportResult.cs index b8816e181784..7a6d04bcefdf 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExportResult.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExportResult.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class DeploymentExportResult /// /// Initializes a new instance of the DeploymentExportResult class. /// - public DeploymentExportResult() { } + public DeploymentExportResult() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentExportResult class. @@ -27,12 +33,18 @@ public DeploymentExportResult() { } public DeploymentExportResult(object template = default(object)) { Template = template; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the template content. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + [JsonProperty(PropertyName = "template")] public object Template { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtended.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtended.cs index 27709c671e41..47adaa04cf98 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtended.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtended.cs @@ -1,13 +1,17 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +22,10 @@ public partial class DeploymentExtended /// /// Initializes a new instance of the DeploymentExtended class. /// - public DeploymentExtended() { } + public DeploymentExtended() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentExtended class. @@ -31,41 +38,47 @@ public DeploymentExtended() { } Id = id; Name = name; Properties = properties; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the ID of the deployment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the name of the deployment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets deployment properties. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public DeploymentPropertiesExtended Properties { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (Name == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } - if (this.Properties != null) + if (Properties != null) { - this.Properties.Validate(); + Properties.Validate(); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtendedFilter.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtendedFilter.cs index d6b222d4d229..d718f38e5b66 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtendedFilter.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentExtendedFilter.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class DeploymentExtendedFilter /// /// Initializes a new instance of the DeploymentExtendedFilter class. /// - public DeploymentExtendedFilter() { } + public DeploymentExtendedFilter() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentExtendedFilter class. @@ -27,12 +33,18 @@ public DeploymentExtendedFilter() { } public DeploymentExtendedFilter(string provisioningState = default(string)) { ProvisioningState = provisioningState; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the provisioning state. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + [JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentMode.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentMode.cs index 5b9c085ceab6..75858d645dc5 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentMode.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentMode.cs @@ -1,23 +1,60 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator 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.Models { + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; /// /// Defines values for DeploymentMode. /// - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + [JsonConverter(typeof(StringEnumConverter))] public enum DeploymentMode { - [System.Runtime.Serialization.EnumMember(Value = "Incremental")] + [EnumMember(Value = "Incremental")] Incremental, - [System.Runtime.Serialization.EnumMember(Value = "Complete")] + [EnumMember(Value = "Complete")] Complete } + internal static class DeploymentModeEnumExtension + { + internal static string ToSerializedValue(this DeploymentMode? value) + { + return value == null ? null : ((DeploymentMode)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this DeploymentMode value) + { + switch( value ) + { + case DeploymentMode.Incremental: + return "Incremental"; + case DeploymentMode.Complete: + return "Complete"; + } + return null; + } + + internal static DeploymentMode? ParseDeploymentMode(this string value) + { + switch( value ) + { + case "Incremental": + return DeploymentMode.Incremental; + case "Complete": + return DeploymentMode.Complete; + } + return null; + } + } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperation.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperation.cs index b71a4c15c0d6..3448f5876439 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperation.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperation.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class DeploymentOperation /// /// Initializes a new instance of the DeploymentOperation class. /// - public DeploymentOperation() { } + public DeploymentOperation() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentOperation class. @@ -31,24 +37,30 @@ public DeploymentOperation() { } Id = id; OperationId = operationId; Properties = properties; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets full deployment operation ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets deployment operation ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "operationId")] + [JsonProperty(PropertyName = "operationId")] public string OperationId { get; private set; } /// /// Gets or sets deployment properties. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public DeploymentOperationProperties Properties { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperationProperties.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperationProperties.cs index bf5fe02c8c4c..513107d235f4 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperationProperties.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentOperationProperties.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -19,7 +22,10 @@ public partial class DeploymentOperationProperties /// Initializes a new instance of the DeploymentOperationProperties /// class. /// - public DeploymentOperationProperties() { } + public DeploymentOperationProperties() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentOperationProperties @@ -28,8 +34,8 @@ public DeploymentOperationProperties() { } /// The state of the /// provisioning. /// The date and time of the operation. - /// Deployment operation service - /// request id. + /// Deployment operation service request + /// id. /// Operation status code. /// Operation status message. /// The target resource. @@ -45,54 +51,60 @@ public DeploymentOperationProperties() { } TargetResource = targetResource; Request = request; Response = response; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the state of the provisioning. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + [JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState { get; private set; } /// /// Gets the date and time of the operation. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "timestamp")] + [JsonProperty(PropertyName = "timestamp")] public System.DateTime? Timestamp { get; private set; } /// /// Gets deployment operation service request id. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "serviceRequestId")] + [JsonProperty(PropertyName = "serviceRequestId")] public string ServiceRequestId { get; private set; } /// /// Gets operation status code. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "statusCode")] + [JsonProperty(PropertyName = "statusCode")] public string StatusCode { get; private set; } /// /// Gets operation status message. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "statusMessage")] + [JsonProperty(PropertyName = "statusMessage")] public object StatusMessage { get; private set; } /// /// Gets the target resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "targetResource")] + [JsonProperty(PropertyName = "targetResource")] public TargetResource TargetResource { get; private set; } /// /// Gets the HTTP request message. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "request")] + [JsonProperty(PropertyName = "request")] public HttpMessage Request { get; private set; } /// /// Gets the HTTP response message. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "response")] + [JsonProperty(PropertyName = "response")] public HttpMessage Response { get; private set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentProperties.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentProperties.cs index 57771e4bf23e..e84eca8b4584 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentProperties.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentProperties.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,19 +21,22 @@ public partial class DeploymentProperties /// /// Initializes a new instance of the DeploymentProperties class. /// - public DeploymentProperties() { } + public DeploymentProperties() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentProperties class. /// /// The mode that is used to deploy resources. This /// value can be either Incremental or Complete. In Incremental mode, - /// resources are deployed without deleting existing resources that - /// are not included in the template. In Complete mode, resources are - /// deployed and existing resources in the resource group that are - /// not included in the template are deleted. Be careful when using - /// Complete mode as you may unintentionally delete resources. - /// Possible values include: 'Incremental', 'Complete' + /// resources are deployed without deleting existing resources that are + /// not included in the template. In Complete mode, resources are + /// deployed and existing resources in the resource group that are not + /// included in the template are deleted. Be careful when using + /// Complete mode as you may unintentionally delete resources. Possible + /// values include: 'Incremental', 'Complete' /// The template content. You use this element /// when you want to pass the template syntax directly in the request /// rather than link to an existing template. It can be a JObject or @@ -46,8 +52,8 @@ public DeploymentProperties() { } /// parametersLink property or the parameters property, but not both. /// It can be a JObject or a well formed JSON string. /// The URI of parameters file. You use - /// this element to link to an existing parameters file. Use either - /// the parametersLink property or the parameters property, but not + /// this element to link to an existing parameters file. Use either the + /// parametersLink property or the parameters property, but not /// both. /// The debug setting of the /// deployment. @@ -59,8 +65,14 @@ public DeploymentProperties() { } ParametersLink = parametersLink; Mode = mode; DebugSetting = debugSetting; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the template content. You use this element when you /// want to pass the template syntax directly in the request rather @@ -68,69 +80,69 @@ public DeploymentProperties() { } /// well-formed JSON string. Use either the templateLink property or /// the template property, but not both. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + [JsonProperty(PropertyName = "template")] public object Template { get; set; } /// /// Gets or sets the URI of the template. Use either the templateLink /// property or the template property, but not both. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "templateLink")] + [JsonProperty(PropertyName = "templateLink")] public TemplateLink TemplateLink { get; set; } /// /// Gets or sets name and value pairs that define the deployment - /// parameters for the template. You use this element when you want - /// to provide the parameter values directly in the request rather - /// than link to an existing parameter file. Use either the - /// parametersLink property or the parameters property, but not both. - /// It can be a JObject or a well formed JSON string. + /// parameters for the template. You use this element when you want to + /// provide the parameter values directly in the request rather than + /// link to an existing parameter file. Use either the parametersLink + /// property or the parameters property, but not both. It can be a + /// JObject or a well formed JSON string. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + [JsonProperty(PropertyName = "parameters")] public object Parameters { get; set; } /// /// Gets or sets the URI of parameters file. You use this element to - /// link to an existing parameters file. Use either the - /// parametersLink property or the parameters property, but not both. + /// link to an existing parameters file. Use either the parametersLink + /// property or the parameters property, but not both. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "parametersLink")] + [JsonProperty(PropertyName = "parametersLink")] public ParametersLink ParametersLink { get; set; } /// /// Gets or sets the mode that is used to deploy resources. This value /// can be either Incremental or Complete. In Incremental mode, - /// resources are deployed without deleting existing resources that - /// are not included in the template. In Complete mode, resources are - /// deployed and existing resources in the resource group that are - /// not included in the template are deleted. Be careful when using - /// Complete mode as you may unintentionally delete resources. - /// Possible values include: 'Incremental', 'Complete' + /// resources are deployed without deleting existing resources that are + /// not included in the template. In Complete mode, resources are + /// deployed and existing resources in the resource group that are not + /// included in the template are deleted. Be careful when using + /// Complete mode as you may unintentionally delete resources. Possible + /// values include: 'Incremental', 'Complete' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "mode")] + [JsonProperty(PropertyName = "mode")] public DeploymentMode Mode { get; set; } /// /// Gets or sets the debug setting of the deployment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "debugSetting")] + [JsonProperty(PropertyName = "debugSetting")] public DebugSetting DebugSetting { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (this.TemplateLink != null) + if (TemplateLink != null) { - this.TemplateLink.Validate(); + TemplateLink.Validate(); } - if (this.ParametersLink != null) + if (ParametersLink != null) { - this.ParametersLink.Validate(); + ParametersLink.Validate(); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentPropertiesExtended.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentPropertiesExtended.cs index 9fabb79e608c..6ddaca6b0fa1 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentPropertiesExtended.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentPropertiesExtended.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -19,7 +24,10 @@ public partial class DeploymentPropertiesExtended /// Initializes a new instance of the DeploymentPropertiesExtended /// class. /// - public DeploymentPropertiesExtended() { } + public DeploymentPropertiesExtended() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentPropertiesExtended @@ -50,7 +58,7 @@ public DeploymentPropertiesExtended() { } /// 'Complete' /// The debug setting of the /// deployment. - public DeploymentPropertiesExtended(string provisioningState = default(string), string correlationId = default(string), System.DateTime? timestamp = default(System.DateTime?), object outputs = default(object), System.Collections.Generic.IList providers = default(System.Collections.Generic.IList), System.Collections.Generic.IList dependencies = default(System.Collections.Generic.IList), object template = default(object), TemplateLink templateLink = default(TemplateLink), object parameters = default(object), ParametersLink parametersLink = default(ParametersLink), DeploymentMode? mode = default(DeploymentMode?), DebugSetting debugSetting = default(DebugSetting)) + public DeploymentPropertiesExtended(string provisioningState = default(string), string correlationId = default(string), System.DateTime? timestamp = default(System.DateTime?), object outputs = default(object), IList providers = default(IList), IList dependencies = default(IList), object template = default(object), TemplateLink templateLink = default(TemplateLink), object parameters = default(object), ParametersLink parametersLink = default(ParametersLink), DeploymentMode? mode = default(DeploymentMode?), DebugSetting debugSetting = default(DebugSetting)) { ProvisioningState = provisioningState; CorrelationId = correlationId; @@ -64,101 +72,107 @@ public DeploymentPropertiesExtended() { } ParametersLink = parametersLink; Mode = mode; DebugSetting = debugSetting; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the state of the provisioning. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + [JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState { get; private set; } /// /// Gets the correlation ID of the deployment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "correlationId")] + [JsonProperty(PropertyName = "correlationId")] public string CorrelationId { get; private set; } /// /// Gets the timestamp of the template deployment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "timestamp")] + [JsonProperty(PropertyName = "timestamp")] public System.DateTime? Timestamp { get; private set; } /// /// Gets or sets key/value pairs that represent deploymentoutput. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "outputs")] + [JsonProperty(PropertyName = "outputs")] public object Outputs { get; set; } /// /// Gets or sets the list of resource providers needed for the /// deployment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "providers")] - public System.Collections.Generic.IList Providers { get; set; } + [JsonProperty(PropertyName = "providers")] + public IList Providers { get; set; } /// /// Gets or sets the list of deployment dependencies. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "dependencies")] - public System.Collections.Generic.IList Dependencies { get; set; } + [JsonProperty(PropertyName = "dependencies")] + public IList Dependencies { get; set; } /// /// Gets or sets the template content. Use only one of Template or /// TemplateLink. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + [JsonProperty(PropertyName = "template")] public object Template { get; set; } /// /// Gets or sets the URI referencing the template. Use only one of /// Template or TemplateLink. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "templateLink")] + [JsonProperty(PropertyName = "templateLink")] public TemplateLink TemplateLink { get; set; } /// /// Gets or sets deployment parameters. Use only one of Parameters or /// ParametersLink. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "parameters")] + [JsonProperty(PropertyName = "parameters")] public object Parameters { get; set; } /// /// Gets or sets the URI referencing the parameters. Use only one of /// Parameters or ParametersLink. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "parametersLink")] + [JsonProperty(PropertyName = "parametersLink")] public ParametersLink ParametersLink { get; set; } /// /// Gets or sets the deployment mode. Possible values are Incremental /// and Complete. Possible values include: 'Incremental', 'Complete' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "mode")] + [JsonProperty(PropertyName = "mode")] public DeploymentMode? Mode { get; set; } /// /// Gets or sets the debug setting of the deployment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "debugSetting")] + [JsonProperty(PropertyName = "debugSetting")] public DebugSetting DebugSetting { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (this.TemplateLink != null) + if (TemplateLink != null) { - this.TemplateLink.Validate(); + TemplateLink.Validate(); } - if (this.ParametersLink != null) + if (ParametersLink != null) { - this.ParametersLink.Validate(); + ParametersLink.Validate(); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentValidateResult.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentValidateResult.cs index 9e147755b3d4..8105bb8697de 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentValidateResult.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/DeploymentValidateResult.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class DeploymentValidateResult /// /// Initializes a new instance of the DeploymentValidateResult class. /// - public DeploymentValidateResult() { } + public DeploymentValidateResult() + { + CustomInit(); + } /// /// Initializes a new instance of the DeploymentValidateResult class. @@ -30,31 +36,37 @@ public DeploymentValidateResult() { } { Error = error; Properties = properties; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets validation error. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + [JsonProperty(PropertyName = "error")] public ResourceManagementErrorWithDetails Error { get; set; } /// /// Gets or sets the template deployment properties. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public DeploymentPropertiesExtended Properties { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (this.Properties != null) + if (Properties != null) { - this.Properties.Validate(); + Properties.Validate(); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ErrorResponse.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..70806b993aa6 --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ErrorResponse.cs @@ -0,0 +1,69 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Error reponse indicates ARM is not able to process the incoming + /// request. The reason is provided in the error message. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// Http status code. + /// Error code. + /// Error message indicating why the + /// operation failed. + public ErrorResponse(string httpStatus = default(string), string errorCode = default(string), string errorMessage = default(string)) + { + HttpStatus = httpStatus; + ErrorCode = errorCode; + ErrorMessage = errorMessage; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets http status code. + /// + [JsonProperty(PropertyName = "httpStatus")] + public string HttpStatus { get; set; } + + /// + /// Gets or sets error code. + /// + [JsonProperty(PropertyName = "errorCode")] + public string ErrorCode { get; set; } + + /// + /// Gets or sets error message indicating why the operation failed. + /// + [JsonProperty(PropertyName = "errorMessage")] + public string ErrorMessage { get; set; } + + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ErrorResponseException.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..d709c77d50ae --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ExportTemplateRequest.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ExportTemplateRequest.cs index ee19d33ed7b6..c1be4041bc16 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ExportTemplateRequest.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ExportTemplateRequest.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +23,10 @@ public partial class ExportTemplateRequest /// /// Initializes a new instance of the ExportTemplateRequest class. /// - public ExportTemplateRequest() { } + public ExportTemplateRequest() + { + CustomInit(); + } /// /// Initializes a new instance of the ExportTemplateRequest class. @@ -26,29 +34,35 @@ public ExportTemplateRequest() { } /// The IDs of the resources. The only /// supported string currently is '*' (all resources). Future updates /// will support exporting specific resources. - /// The export template options. Supported - /// values include 'IncludeParameterDefaultValue', 'IncludeComments' - /// or 'IncludeParameterDefaultValue, IncludeComments - public ExportTemplateRequest(System.Collections.Generic.IList resources = default(System.Collections.Generic.IList), string options = default(string)) + /// The export template options. Supported values + /// include 'IncludeParameterDefaultValue', 'IncludeComments' or + /// 'IncludeParameterDefaultValue, IncludeComments + public ExportTemplateRequest(IList resources = default(IList), string options = default(string)) { Resources = resources; Options = options; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the IDs of the resources. The only supported string /// currently is '*' (all resources). Future updates will support /// exporting specific resources. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resources")] - public System.Collections.Generic.IList Resources { get; set; } + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; set; } /// /// Gets or sets the export template options. Supported values include /// 'IncludeParameterDefaultValue', 'IncludeComments' or /// 'IncludeParameterDefaultValue, IncludeComments /// - [Newtonsoft.Json.JsonProperty(PropertyName = "options")] + [JsonProperty(PropertyName = "options")] public string Options { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureProperties.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureProperties.cs index fc7ee0d7bb1a..6e86168579bc 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureProperties.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureProperties.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class FeatureProperties /// /// Initializes a new instance of the FeatureProperties class. /// - public FeatureProperties() { } + public FeatureProperties() + { + CustomInit(); + } /// /// Initializes a new instance of the FeatureProperties class. @@ -28,13 +34,19 @@ public FeatureProperties() { } public FeatureProperties(string state = default(string)) { State = state; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the registration state of the feature for the /// subscription. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "state")] + [JsonProperty(PropertyName = "state")] public string State { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureResult.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureResult.cs index 922630403006..56b34b019958 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureResult.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/FeatureResult.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class FeatureResult /// /// Initializes a new instance of the FeatureResult class. /// - public FeatureResult() { } + public FeatureResult() + { + CustomInit(); + } /// /// Initializes a new instance of the FeatureResult class. @@ -34,30 +40,36 @@ public FeatureResult() { } Properties = properties; Id = id; Type = type; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the name of the feature. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets properties of the previewed feature. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public FeatureProperties Properties { get; set; } /// /// Gets or sets the resource ID of the feature. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the resource type of the feature. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + [JsonProperty(PropertyName = "type")] public string Type { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Filter.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Filter.cs index b749804f298f..143f1a28943a 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Filter.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Filter.cs @@ -1,21 +1,54 @@ +// // 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.Models { + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; /// /// Defines values for Filter. /// - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + [JsonConverter(typeof(StringEnumConverter))] public enum Filter { - [System.Runtime.Serialization.EnumMember(Value = "atScope()")] + [EnumMember(Value = "atScope()")] AtScope } + internal static class FilterEnumExtension + { + internal static string ToSerializedValue(this Filter? value) + { + return value == null ? null : ((Filter)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this Filter value) + { + switch( value ) + { + case Filter.AtScope: + return "atScope()"; + } + return null; + } + + internal static Filter? ParseFilter(this string value) + { + switch( value ) + { + case "atScope()": + return Filter.AtScope; + } + return null; + } + } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResource.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResource.cs index b153f5dce7db..3cf47094c670 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResource.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResource.cs @@ -1,13 +1,19 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +24,10 @@ public partial class GenericResource : Resource /// /// Initializes a new instance of the GenericResource class. /// - public GenericResource() { } + public GenericResource() + { + CustomInit(); + } /// /// Initializes a new instance of the GenericResource class. @@ -35,7 +44,7 @@ public GenericResource() { } /// resource. /// The SKU of the resource. /// The identity of the resource. - public GenericResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), Plan plan = default(Plan), object properties = default(object), string kind = default(string), string managedBy = default(string), Sku sku = default(Sku), Identity identity = default(Identity)) + public GenericResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), Plan plan = default(Plan), object properties = default(object), string kind = default(string), string managedBy = default(string), Sku sku = default(Sku), Identity identity = default(Identity)) : base(id, name, type, location, tags) { Plan = plan; @@ -44,57 +53,63 @@ public GenericResource() { } ManagedBy = managedBy; Sku = sku; Identity = identity; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the plan of the resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "plan")] + [JsonProperty(PropertyName = "plan")] public Plan Plan { get; set; } /// /// Gets or sets the resource properties. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public object Properties { get; set; } /// /// Gets or sets the kind of the resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + [JsonProperty(PropertyName = "kind")] public string Kind { get; set; } /// /// Gets or sets ID of the resource that manages this resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "managedBy")] + [JsonProperty(PropertyName = "managedBy")] public string ManagedBy { get; set; } /// /// Gets or sets the SKU of the resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + [JsonProperty(PropertyName = "sku")] public Sku Sku { get; set; } /// /// Gets or sets the identity of the resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "identity")] + [JsonProperty(PropertyName = "identity")] public Identity Identity { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (this.Kind != null) + if (Kind != null) { - if (!System.Text.RegularExpressions.Regex.IsMatch(this.Kind, "^[-\\w\\._,\\(\\)]+$")) + if (!System.Text.RegularExpressions.Regex.IsMatch(Kind, "^[-\\w\\._,\\(\\)]+$")) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "Kind", "^[-\\w\\._,\\(\\)]+$"); + throw new ValidationException(ValidationRules.Pattern, "Kind", "^[-\\w\\._,\\(\\)]+$"); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResourceFilter.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResourceFilter.cs index 0b78bce37dad..93dbd2d06e57 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResourceFilter.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/GenericResourceFilter.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class GenericResourceFilter /// /// Initializes a new instance of the GenericResourceFilter class. /// - public GenericResourceFilter() { } + public GenericResourceFilter() + { + CustomInit(); + } /// /// Initializes a new instance of the GenericResourceFilter class. @@ -31,24 +37,30 @@ public GenericResourceFilter() { } ResourceType = resourceType; Tagname = tagname; Tagvalue = tagvalue; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the resource type. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + [JsonProperty(PropertyName = "resourceType")] public string ResourceType { get; set; } /// /// Gets or sets the tag name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tagname")] + [JsonProperty(PropertyName = "tagname")] public string Tagname { get; set; } /// /// Gets or sets the tag value. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tagvalue")] + [JsonProperty(PropertyName = "tagvalue")] public string Tagvalue { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/HttpMessage.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/HttpMessage.cs index 242bc54dc54e..c9622e0b67ba 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/HttpMessage.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/HttpMessage.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class HttpMessage /// /// Initializes a new instance of the HttpMessage class. /// - public HttpMessage() { } + public HttpMessage() + { + CustomInit(); + } /// /// Initializes a new instance of the HttpMessage class. @@ -27,12 +33,18 @@ public HttpMessage() { } public HttpMessage(object content = default(object)) { Content = content; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets HTTP message content. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "content")] + [JsonProperty(PropertyName = "content")] public object Content { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Identity.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Identity.cs index 7c3b7345ca4d..8a9ac19a9bae 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Identity.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Identity.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class Identity /// /// Initializes a new instance of the Identity class. /// - public Identity() { } + public Identity() + { + CustomInit(); + } /// /// Initializes a new instance of the Identity class. @@ -33,25 +39,31 @@ public Identity() { } PrincipalId = principalId; TenantId = tenantId; Type = type; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the principal ID of resource identity. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "principalId")] + [JsonProperty(PropertyName = "principalId")] public string PrincipalId { get; private set; } /// /// Gets the tenant ID of resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + [JsonProperty(PropertyName = "tenantId")] public string TenantId { get; private set; } /// /// Gets or sets the identity type. Possible values include: /// 'SystemAssigned' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + [JsonProperty(PropertyName = "type")] public ResourceIdentityType? Type { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Location.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Location.cs index 6c5bba3da259..5d1603837a6c 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Location.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Location.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class Location /// /// Initializes a new instance of the Location class. /// - public Location() { } + public Location() + { + CustomInit(); + } /// /// Initializes a new instance of the Location class. @@ -39,43 +45,49 @@ public Location() { } DisplayName = displayName; Latitude = latitude; Longitude = longitude; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the fully qualified ID of the location. For example, /// /subscriptions/00000000-0000-0000-0000-000000000000/locations/westus. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets the subscription ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + [JsonProperty(PropertyName = "subscriptionId")] public string SubscriptionId { get; private set; } /// /// Gets the location name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// /// Gets the display name of the location. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; private set; } /// /// Gets the latitude of the location. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "latitude")] + [JsonProperty(PropertyName = "latitude")] public string Latitude { get; private set; } /// /// Gets the longitude of the location. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "longitude")] + [JsonProperty(PropertyName = "longitude")] public string Longitude { get; private set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/LockLevel.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/LockLevel.cs index 83cd04193fb1..f57b4854103d 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/LockLevel.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/LockLevel.cs @@ -1,10 +1,12 @@ +// // 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.Models { diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockObject.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockObject.cs index 777393f6091f..6ae25cd92270 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockObject.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockObject.cs @@ -1,35 +1,46 @@ +// // 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.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// /// The lock information. /// - [Microsoft.Rest.Serialization.JsonTransformation] - public partial class ManagementLockObject : Microsoft.Rest.Azure.IResource + [Rest.Serialization.JsonTransformation] + public partial class ManagementLockObject : IResource { /// /// Initializes a new instance of the ManagementLockObject class. /// - public ManagementLockObject() { } + public ManagementLockObject() + { + CustomInit(); + } /// /// Initializes a new instance of the ManagementLockObject class. /// /// The level of the lock. Possible values are: - /// NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means - /// authorized users are able to read and modify the resources, but - /// not delete. ReadOnly means authorized users can only read from a - /// resource, but they can't modify or delete it. Possible values - /// include: 'NotSpecified', 'CanNotDelete', 'ReadOnly' + /// NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized + /// users are able to read and modify the resources, but not delete. + /// ReadOnly means authorized users can only read from a resource, but + /// they can't modify or delete it. Possible values include: + /// 'NotSpecified', 'CanNotDelete', 'ReadOnly' /// Notes about the lock. Maximum of 512 /// characters. /// The owners of the lock. @@ -37,7 +48,7 @@ public ManagementLockObject() { } /// The resource type of the lock - /// Microsoft.Authorization/locks. /// The name of the lock. - public ManagementLockObject(string level, string notes = default(string), System.Collections.Generic.IList owners = default(System.Collections.Generic.IList), string id = default(string), string type = default(string), string name = default(string)) + public ManagementLockObject(string level, string notes = default(string), IList owners = default(IList), string id = default(string), string type = default(string), string name = default(string)) { Level = level; Notes = notes; @@ -45,60 +56,66 @@ public ManagementLockObject() { } Id = id; Type = type; Name = name; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the level of the lock. Possible values are: - /// NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means - /// authorized users are able to read and modify the resources, but - /// not delete. ReadOnly means authorized users can only read from a - /// resource, but they can't modify or delete it. Possible values - /// include: 'NotSpecified', 'CanNotDelete', 'ReadOnly' + /// NotSpecified, CanNotDelete, ReadOnly. CanNotDelete means authorized + /// users are able to read and modify the resources, but not delete. + /// ReadOnly means authorized users can only read from a resource, but + /// they can't modify or delete it. Possible values include: + /// 'NotSpecified', 'CanNotDelete', 'ReadOnly' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.level")] + [JsonProperty(PropertyName = "properties.level")] public string Level { get; set; } /// /// Gets or sets notes about the lock. Maximum of 512 characters. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.notes")] + [JsonProperty(PropertyName = "properties.notes")] public string Notes { get; set; } /// /// Gets or sets the owners of the lock. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.owners")] - public System.Collections.Generic.IList Owners { get; set; } + [JsonProperty(PropertyName = "properties.owners")] + public IList Owners { get; set; } /// /// Gets the resource ID of the lock. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets the resource type of the lock - Microsoft.Authorization/locks. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + [JsonProperty(PropertyName = "type")] public string Type { get; private set; } /// /// Gets or sets the name of the lock. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (Level == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Level"); + throw new ValidationException(ValidationRules.CannotBeNull, "Level"); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockOwner.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockOwner.cs index 33137cd59e6b..3223e31ecba7 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockOwner.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ManagementLockOwner.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class ManagementLockOwner /// /// Initializes a new instance of the ManagementLockOwner class. /// - public ManagementLockOwner() { } + public ManagementLockOwner() + { + CustomInit(); + } /// /// Initializes a new instance of the ManagementLockOwner class. @@ -28,12 +34,18 @@ public ManagementLockOwner() { } public ManagementLockOwner(string applicationId = default(string)) { ApplicationId = applicationId; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the application ID of the lock owner. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "applicationId")] + [JsonProperty(PropertyName = "applicationId")] public string ApplicationId { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Page.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Page.cs index 677da685b1f2..c6f2533504c2 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Page.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Page.cs @@ -1,44 +1,51 @@ +// // 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.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; /// /// Defines a page in Azure responses. /// /// Type of the page content items - [Newtonsoft.Json.JsonObject] - public class Page : Microsoft.Rest.Azure.IPage + [JsonObject] + public class Page : IPage { /// /// Gets the link to the next page. /// - [Newtonsoft.Json.JsonProperty("nextLink")] - public System.String NextPageLink { get; private set; } + [JsonProperty("nextLink")] + public string NextPageLink { get; private set; } - [Newtonsoft.Json.JsonProperty("value")] - private System.Collections.Generic.IList Items{ get; set; } + [JsonProperty("value")] + private IList Items{ get; set; } /// /// Returns an enumerator that iterates through the collection. /// /// A an enumerator that can be used to iterate through the collection. - public System.Collections.Generic.IEnumerator GetEnumerator() + public IEnumerator GetEnumerator() { - return (Items == null) ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); } /// /// Returns an enumerator that iterates through the collection. /// /// A an enumerator that can be used to iterate through the collection. - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ParametersLink.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ParametersLink.cs index 917c0ac1c2d5..f7a77971618f 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ParametersLink.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ParametersLink.cs @@ -1,13 +1,17 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +22,10 @@ public partial class ParametersLink /// /// Initializes a new instance of the ParametersLink class. /// - public ParametersLink() { } + public ParametersLink() + { + CustomInit(); + } /// /// Initializes a new instance of the ParametersLink class. @@ -30,32 +37,38 @@ public ParametersLink() { } { Uri = uri; ContentVersion = contentVersion; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the URI of the parameters file. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "uri")] + [JsonProperty(PropertyName = "uri")] public string Uri { get; set; } /// /// Gets or sets if included, must match the ContentVersion in the /// template. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "contentVersion")] + [JsonProperty(PropertyName = "contentVersion")] public string ContentVersion { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (Uri == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Uri"); + throw new ValidationException(ValidationRules.CannotBeNull, "Uri"); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Plan.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Plan.cs index e2d42532aaf4..dcf185bddc13 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Plan.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Plan.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class Plan /// /// Initializes a new instance of the Plan class. /// - public Plan() { } + public Plan() + { + CustomInit(); + } /// /// Initializes a new instance of the Plan class. @@ -33,30 +39,36 @@ public Plan() { } Publisher = publisher; Product = product; PromotionCode = promotionCode; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the plan ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets the publisher ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + [JsonProperty(PropertyName = "publisher")] public string Publisher { get; set; } /// /// Gets or sets the offer ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "product")] + [JsonProperty(PropertyName = "product")] public string Product { get; set; } /// /// Gets or sets the promotion code. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "promotionCode")] + [JsonProperty(PropertyName = "promotionCode")] public string PromotionCode { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyAssignment.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyAssignment.cs index c7e688391ae1..c775108f01e0 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyAssignment.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyAssignment.cs @@ -1,25 +1,36 @@ +// // 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.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// - /// The policy definition. + /// The policy assignment. /// - [Microsoft.Rest.Serialization.JsonTransformation] - public partial class PolicyAssignment : Microsoft.Rest.Azure.IResource + [Rest.Serialization.JsonTransformation] + public partial class PolicyAssignment : IResource { /// /// Initializes a new instance of the PolicyAssignment class. /// - public PolicyAssignment() { } + public PolicyAssignment() + { + CustomInit(); + } /// /// Initializes a new instance of the PolicyAssignment class. @@ -29,54 +40,116 @@ public PolicyAssignment() { } /// The ID of the policy /// definition. /// The scope for the policy assignment. + /// The policy's excluded scopes. + /// Required if a parameter is used in policy + /// rule. + /// This message will be part of response in + /// case of policy violation. + /// The policy assignment metadata. /// The ID of the policy assignment. /// The type of the policy assignment. /// The name of the policy assignment. - public PolicyAssignment(string displayName = default(string), string policyDefinitionId = default(string), string scope = default(string), string id = default(string), string type = default(string), string name = default(string)) + /// The policy sku. + public PolicyAssignment(string displayName = default(string), string policyDefinitionId = default(string), string scope = default(string), IList notScopes = default(IList), object parameters = default(object), string description = default(string), object metadata = default(object), string id = default(string), string type = default(string), string name = default(string), PolicySku sku = default(PolicySku)) { DisplayName = displayName; PolicyDefinitionId = policyDefinitionId; Scope = scope; + NotScopes = notScopes; + Parameters = parameters; + Description = description; + Metadata = metadata; Id = id; Type = type; Name = name; + Sku = sku; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the display name of the policy assignment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } /// /// Gets or sets the ID of the policy definition. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.policyDefinitionId")] + [JsonProperty(PropertyName = "properties.policyDefinitionId")] public string PolicyDefinitionId { get; set; } /// /// Gets or sets the scope for the policy assignment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.scope")] + [JsonProperty(PropertyName = "properties.scope")] public string Scope { get; set; } /// - /// Gets or sets the ID of the policy assignment. + /// Gets or sets the policy's excluded scopes. + /// + [JsonProperty(PropertyName = "properties.notScopes")] + public IList NotScopes { get; set; } + + /// + /// Gets or sets required if a parameter is used in policy rule. + /// + [JsonProperty(PropertyName = "properties.parameters")] + public object Parameters { get; set; } + + /// + /// Gets or sets this message will be part of response in case of + /// policy violation. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the policy assignment metadata. + /// + [JsonProperty(PropertyName = "properties.metadata")] + public object Metadata { get; set; } + + /// + /// Gets the ID of the policy assignment. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the type of the policy assignment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } /// - /// Gets or sets the type of the policy assignment. + /// Gets the name of the policy assignment. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] - public string Type { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } /// - /// Gets or sets the name of the policy assignment. + /// Gets or sets the policy sku. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [JsonProperty(PropertyName = "sku")] + public PolicySku Sku { get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Sku != null) + { + Sku.Validate(); + } + } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyDefinition.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyDefinition.cs index 25bf4f2631db..eaadaf848219 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyDefinition.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyDefinition.cs @@ -1,25 +1,34 @@ +// // 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.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; using System.Linq; /// /// The policy definition. /// - [Microsoft.Rest.Serialization.JsonTransformation] - public partial class PolicyDefinition : Microsoft.Rest.Azure.IResource + [Rest.Serialization.JsonTransformation] + public partial class PolicyDefinition : IResource { /// /// Initializes a new instance of the PolicyDefinition class. /// - public PolicyDefinition() { } + public PolicyDefinition() + { + CustomInit(); + } /// /// Initializes a new instance of the PolicyDefinition class. @@ -27,64 +36,95 @@ public PolicyDefinition() { } /// The type of policy definition. Possible /// values are NotSpecified, BuiltIn, and Custom. Possible values /// include: 'NotSpecified', 'BuiltIn', 'Custom' + /// The policy definition mode. Possible values are + /// NotSpecified, Indexed, and All. Possible values include: + /// 'NotSpecified', 'Indexed', 'All' /// The display name of the policy /// definition. /// The policy definition /// description. /// The policy rule. + /// The policy definition metadata. + /// Required if a parameter is used in policy + /// rule. /// The ID of the policy definition. - /// The name of the policy definition. If you do - /// not specify a value for name, the value is inferred from the name - /// value in the request URI. - public PolicyDefinition(string policyType = default(string), string displayName = default(string), string description = default(string), object policyRule = default(object), string id = default(string), string name = default(string)) + /// The name of the policy definition. + public PolicyDefinition(string policyType = default(string), string mode = default(string), string displayName = default(string), string description = default(string), object policyRule = default(object), object metadata = default(object), object parameters = default(object), string id = default(string), string name = default(string)) { PolicyType = policyType; + Mode = mode; DisplayName = displayName; Description = description; PolicyRule = policyRule; + Metadata = metadata; + Parameters = parameters; Id = id; Name = name; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the type of policy definition. Possible values are /// NotSpecified, BuiltIn, and Custom. Possible values include: /// 'NotSpecified', 'BuiltIn', 'Custom' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.policyType")] + [JsonProperty(PropertyName = "properties.policyType")] public string PolicyType { get; set; } + /// + /// Gets or sets the policy definition mode. Possible values are + /// NotSpecified, Indexed, and All. Possible values include: + /// 'NotSpecified', 'Indexed', 'All' + /// + [JsonProperty(PropertyName = "properties.mode")] + public string Mode { get; set; } + /// /// Gets or sets the display name of the policy definition. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.displayName")] + [JsonProperty(PropertyName = "properties.displayName")] public string DisplayName { get; set; } /// /// Gets or sets the policy definition description. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.description")] + [JsonProperty(PropertyName = "properties.description")] public string Description { get; set; } /// /// Gets or sets the policy rule. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.policyRule")] + [JsonProperty(PropertyName = "properties.policyRule")] public object PolicyRule { get; set; } /// - /// Gets or sets the ID of the policy definition. + /// Gets or sets the policy definition metadata. + /// + [JsonProperty(PropertyName = "properties.metadata")] + public object Metadata { get; set; } + + /// + /// Gets or sets required if a parameter is used in policy rule. + /// + [JsonProperty(PropertyName = "properties.parameters")] + public object Parameters { get; set; } + + /// + /// Gets the ID of the policy definition. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] - public string Id { get; set; } + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } /// - /// Gets or sets the name of the policy definition. If you do not - /// specify a value for name, the value is inferred from the name - /// value in the request URI. + /// Gets the name of the policy definition. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] - public string Name { get; set; } + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyDefinitionReference.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyDefinitionReference.cs new file mode 100644 index 000000000000..bb365e44e335 --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyDefinitionReference.cs @@ -0,0 +1,62 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The policy definition reference. + /// + public partial class PolicyDefinitionReference + { + /// + /// Initializes a new instance of the PolicyDefinitionReference class. + /// + public PolicyDefinitionReference() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicyDefinitionReference class. + /// + /// The ID of the policy definition or + /// policy set definition. + /// Required if a parameter is used in policy + /// rule. + public PolicyDefinitionReference(string policyDefinitionId = default(string), object parameters = default(object)) + { + PolicyDefinitionId = policyDefinitionId; + Parameters = parameters; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the ID of the policy definition or policy set + /// definition. + /// + [JsonProperty(PropertyName = "policyDefinitionId")] + public string PolicyDefinitionId { get; set; } + + /// + /// Gets or sets required if a parameter is used in policy rule. + /// + [JsonProperty(PropertyName = "parameters")] + public object Parameters { get; set; } + + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyMode.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyMode.cs new file mode 100644 index 000000000000..5cc586bdacef --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyMode.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager.Models +{ + + /// + /// Defines values for PolicyMode. + /// + public static class PolicyMode + { + public const string NotSpecified = "NotSpecified"; + public const string Indexed = "Indexed"; + public const string All = "All"; + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicySetDefinition.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicySetDefinition.cs new file mode 100644 index 000000000000..f4a3db4c1d08 --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicySetDefinition.cs @@ -0,0 +1,145 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The policy set definition. + /// + [Rest.Serialization.JsonTransformation] + public partial class PolicySetDefinition : IResource + { + /// + /// Initializes a new instance of the PolicySetDefinition class. + /// + public PolicySetDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicySetDefinition class. + /// + /// An array of policy definition + /// references. + /// The type of policy definition. Possible + /// values are NotSpecified, BuiltIn, and Custom. Possible values + /// include: 'NotSpecified', 'BuiltIn', 'Custom' + /// The display name of the policy set + /// definition. + /// The policy set definition + /// description. + /// The policy set definition metadata. + /// The policy set definition parameters that + /// can be used in policy definition references. + /// The ID of the policy set definition. + /// The name of the policy set definition. + /// The type of the resource + /// (Microsoft.Authorization/policySetDefinitions). + public PolicySetDefinition(IList policyDefinitions, string policyType = default(string), string displayName = default(string), string description = default(string), object metadata = default(object), object parameters = default(object), string id = default(string), string name = default(string), string type = default(string)) + { + PolicyType = policyType; + DisplayName = displayName; + Description = description; + Metadata = metadata; + Parameters = parameters; + PolicyDefinitions = policyDefinitions; + Id = id; + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the type of policy definition. Possible values are + /// NotSpecified, BuiltIn, and Custom. Possible values include: + /// 'NotSpecified', 'BuiltIn', 'Custom' + /// + [JsonProperty(PropertyName = "properties.policyType")] + public string PolicyType { get; set; } + + /// + /// Gets or sets the display name of the policy set definition. + /// + [JsonProperty(PropertyName = "properties.displayName")] + public string DisplayName { get; set; } + + /// + /// Gets or sets the policy set definition description. + /// + [JsonProperty(PropertyName = "properties.description")] + public string Description { get; set; } + + /// + /// Gets or sets the policy set definition metadata. + /// + [JsonProperty(PropertyName = "properties.metadata")] + public object Metadata { get; set; } + + /// + /// Gets or sets the policy set definition parameters that can be used + /// in policy definition references. + /// + [JsonProperty(PropertyName = "properties.parameters")] + public object Parameters { get; set; } + + /// + /// Gets or sets an array of policy definition references. + /// + [JsonProperty(PropertyName = "properties.policyDefinitions")] + public IList PolicyDefinitions { get; set; } + + /// + /// Gets the ID of the policy set definition. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets the name of the policy set definition. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Gets the type of the resource + /// (Microsoft.Authorization/policySetDefinitions). + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PolicyDefinitions == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PolicyDefinitions"); + } + } + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicySku.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicySku.cs new file mode 100644 index 000000000000..9700410ebae3 --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicySku.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The policy sku. + /// + public partial class PolicySku + { + /// + /// Initializes a new instance of the PolicySku class. + /// + public PolicySku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PolicySku class. + /// + /// The name of the policy sku. Possible values are + /// A0 and A1. + /// The policy sku tier. Possible values are Free + /// and Standard. + public PolicySku(string name, string tier = default(string)) + { + Name = name; + Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the policy sku. Possible values are A0 and + /// A1. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the policy sku tier. Possible values are Free and + /// Standard. + /// + [JsonProperty(PropertyName = "tier")] + public string Tier { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + } + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyType.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyType.cs index 1c1e386ff57e..6b26c12aec15 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyType.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/PolicyType.cs @@ -1,18 +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.Models { /// - /// Defines values for policyType. + /// Defines values for PolicyType. /// - public static class policyType + public static class PolicyType { public const string NotSpecified = "NotSpecified"; public const string BuiltIn = "BuiltIn"; diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Provider.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Provider.cs index 8bc8ac7e09f7..45fdf3399b8e 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Provider.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Provider.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +23,10 @@ public partial class Provider /// /// Initializes a new instance of the Provider class. /// - public Provider() { } + public Provider() + { + CustomInit(); + } /// /// Initializes a new instance of the Provider class. @@ -30,37 +38,43 @@ public Provider() { } /// provider. /// The collection of provider resource /// types. - public Provider(string id = default(string), string namespaceProperty = default(string), string registrationState = default(string), System.Collections.Generic.IList resourceTypes = default(System.Collections.Generic.IList)) + public Provider(string id = default(string), string namespaceProperty = default(string), string registrationState = default(string), IList resourceTypes = default(IList)) { Id = id; NamespaceProperty = namespaceProperty; RegistrationState = registrationState; ResourceTypes = resourceTypes; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the provider ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets or sets the namespace of the resource provider. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "namespace")] + [JsonProperty(PropertyName = "namespace")] public string NamespaceProperty { get; set; } /// /// Gets the registration state of the provider. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "registrationState")] + [JsonProperty(PropertyName = "registrationState")] public string RegistrationState { get; private set; } /// /// Gets the collection of provider resource types. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceTypes")] - public System.Collections.Generic.IList ResourceTypes { get; private set; } + [JsonProperty(PropertyName = "resourceTypes")] + public IList ResourceTypes { get; private set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ProviderResourceType.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ProviderResourceType.cs index 6c4a7729fe34..dd1bd5a5114a 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ProviderResourceType.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ProviderResourceType.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +23,10 @@ public partial class ProviderResourceType /// /// Initializes a new instance of the ProviderResourceType class. /// - public ProviderResourceType() { } + public ProviderResourceType() + { + CustomInit(); + } /// /// Initializes a new instance of the ProviderResourceType class. @@ -30,45 +38,51 @@ public ProviderResourceType() { } /// resource type. /// The API version. /// The properties. - public ProviderResourceType(string resourceType = default(string), System.Collections.Generic.IList locations = default(System.Collections.Generic.IList), System.Collections.Generic.IList aliases = default(System.Collections.Generic.IList), System.Collections.Generic.IList apiVersions = default(System.Collections.Generic.IList), System.Collections.Generic.IDictionary properties = default(System.Collections.Generic.IDictionary)) + public ProviderResourceType(string resourceType = default(string), IList locations = default(IList), IList aliases = default(IList), IList apiVersions = default(IList), IDictionary properties = default(IDictionary)) { ResourceType = resourceType; Locations = locations; Aliases = aliases; ApiVersions = apiVersions; Properties = properties; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the resource type. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + [JsonProperty(PropertyName = "resourceType")] public string ResourceType { get; set; } /// /// Gets or sets the collection of locations where this resource type /// can be created. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "locations")] - public System.Collections.Generic.IList Locations { get; set; } + [JsonProperty(PropertyName = "locations")] + public IList Locations { get; set; } /// /// Gets or sets the aliases that are supported by this resource type. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "aliases")] - public System.Collections.Generic.IList Aliases { get; set; } + [JsonProperty(PropertyName = "aliases")] + public IList Aliases { get; set; } /// /// Gets or sets the API version. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "apiVersions")] - public System.Collections.Generic.IList ApiVersions { get; set; } + [JsonProperty(PropertyName = "apiVersions")] + public IList ApiVersions { get; set; } /// /// Gets or sets the properties. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] - public System.Collections.Generic.IDictionary Properties { get; set; } + [JsonProperty(PropertyName = "properties")] + public IDictionary Properties { get; set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Resource.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Resource.cs index 8093a606f558..72bd0b6adc7e 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Resource.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Resource.cs @@ -1,24 +1,34 @@ +// // 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.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// /// Resource. /// - public partial class Resource : Microsoft.Rest.Azure.IResource + public partial class Resource : IResource { /// /// Initializes a new instance of the Resource class. /// - public Resource() { } + public Resource() + { + CustomInit(); + } /// /// Initializes a new instance of the Resource class. @@ -28,44 +38,50 @@ public Resource() { } /// Resource type /// Resource location /// Resource tags - public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + public Resource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Id = id; Name = name; Type = type; Location = location; Tags = tags; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets resource ID /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets resource name /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// /// Gets resource type /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + [JsonProperty(PropertyName = "type")] public string Type { get; private set; } /// /// Gets or sets resource location /// - [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// /// Gets or sets resource tags /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] - public System.Collections.Generic.IDictionary Tags { get; set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroup.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroup.cs index b7efb511469e..c9727db98a1b 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroup.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroup.cs @@ -1,13 +1,19 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +24,10 @@ public partial class ResourceGroup /// /// Initializes a new instance of the ResourceGroup class. /// - public ResourceGroup() { } + public ResourceGroup() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceGroup class. @@ -31,7 +40,7 @@ public ResourceGroup() { } /// The ID of the resource that manages this /// resource group. /// The tags attached to the resource group. - public ResourceGroup(string location, string id = default(string), string name = default(string), ResourceGroupProperties properties = default(ResourceGroupProperties), string managedBy = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + public ResourceGroup(string location, string id = default(string), string name = default(string), ResourceGroupProperties properties = default(ResourceGroupProperties), string managedBy = default(string), IDictionary tags = default(IDictionary)) { Id = id; Name = name; @@ -39,23 +48,29 @@ public ResourceGroup() { } Location = location; ManagedBy = managedBy; Tags = tags; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the ID of the resource group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets or sets the name of the resource group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public ResourceGroupProperties Properties { get; set; } /// @@ -63,33 +78,33 @@ public ResourceGroup() { } /// changed after the resource group has been created. It muct be one /// of the supported Azure locations. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// /// Gets or sets the ID of the resource that manages this resource /// group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "managedBy")] + [JsonProperty(PropertyName = "managedBy")] public string ManagedBy { get; set; } /// /// Gets or sets the tags attached to the resource group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] - public System.Collections.Generic.IDictionary Tags { get; set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (Location == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupExportResult.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupExportResult.cs index b6b258bea2b0..86c8207f9988 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupExportResult.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupExportResult.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class ResourceGroupExportResult /// /// Initializes a new instance of the ResourceGroupExportResult class. /// - public ResourceGroupExportResult() { } + public ResourceGroupExportResult() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceGroupExportResult class. @@ -29,18 +35,24 @@ public ResourceGroupExportResult() { } { Template = template; Error = error; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the template content. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "template")] + [JsonProperty(PropertyName = "template")] public object Template { get; set; } /// /// Gets or sets the error. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "error")] + [JsonProperty(PropertyName = "error")] public ResourceManagementErrorWithDetails Error { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupFilter.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupFilter.cs index e8797be57294..fbac36f76492 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupFilter.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupFilter.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class ResourceGroupFilter /// /// Initializes a new instance of the ResourceGroupFilter class. /// - public ResourceGroupFilter() { } + public ResourceGroupFilter() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceGroupFilter class. @@ -29,18 +35,24 @@ public ResourceGroupFilter() { } { TagName = tagName; TagValue = tagValue; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the tag name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tagName")] + [JsonProperty(PropertyName = "tagName")] public string TagName { get; set; } /// /// Gets or sets the tag value. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tagValue")] + [JsonProperty(PropertyName = "tagValue")] public string TagValue { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupPatchable.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupPatchable.cs index 002eb9dad627..27d0177c3be8 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupPatchable.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupPatchable.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +23,10 @@ public partial class ResourceGroupPatchable /// /// Initializes a new instance of the ResourceGroupPatchable class. /// - public ResourceGroupPatchable() { } + public ResourceGroupPatchable() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceGroupPatchable class. @@ -27,37 +35,43 @@ public ResourceGroupPatchable() { } /// The ID of the resource that manages this /// resource group. /// The tags attached to the resource group. - public ResourceGroupPatchable(string name = default(string), ResourceGroupProperties properties = default(ResourceGroupProperties), string managedBy = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + public ResourceGroupPatchable(string name = default(string), ResourceGroupProperties properties = default(ResourceGroupProperties), string managedBy = default(string), IDictionary tags = default(IDictionary)) { Name = name; Properties = properties; ManagedBy = managedBy; Tags = tags; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the name of the resource group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public ResourceGroupProperties Properties { get; set; } /// /// Gets or sets the ID of the resource that manages this resource /// group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "managedBy")] + [JsonProperty(PropertyName = "managedBy")] public string ManagedBy { get; set; } /// /// Gets or sets the tags attached to the resource group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] - public System.Collections.Generic.IDictionary Tags { get; set; } + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupProperties.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupProperties.cs index 011bc8191e9e..ca4be497ba04 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupProperties.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceGroupProperties.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class ResourceGroupProperties /// /// Initializes a new instance of the ResourceGroupProperties class. /// - public ResourceGroupProperties() { } + public ResourceGroupProperties() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceGroupProperties class. @@ -27,12 +33,18 @@ public ResourceGroupProperties() { } public ResourceGroupProperties(string provisioningState = default(string)) { ProvisioningState = provisioningState; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the provisioning state. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + [JsonProperty(PropertyName = "provisioningState")] public string ProvisioningState { get; private set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceIdentityType.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceIdentityType.cs index 4c7d461e8c53..605a35f8f760 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceIdentityType.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceIdentityType.cs @@ -1,21 +1,54 @@ +// // 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.Models { + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; /// /// Defines values for ResourceIdentityType. /// - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + [JsonConverter(typeof(StringEnumConverter))] public enum ResourceIdentityType { - [System.Runtime.Serialization.EnumMember(Value = "SystemAssigned")] + [EnumMember(Value = "SystemAssigned")] SystemAssigned } + internal static class ResourceIdentityTypeEnumExtension + { + internal static string ToSerializedValue(this ResourceIdentityType? value) + { + return value == null ? null : ((ResourceIdentityType)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this ResourceIdentityType value) + { + switch( value ) + { + case ResourceIdentityType.SystemAssigned: + return "SystemAssigned"; + } + return null; + } + + internal static ResourceIdentityType? ParseResourceIdentityType(this string value) + { + switch( value ) + { + case "SystemAssigned": + return ResourceIdentityType.SystemAssigned; + } + return null; + } + } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLink.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLink.cs index f74be7f63575..62581fd45697 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLink.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLink.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class ResourceLink /// /// Initializes a new instance of the ResourceLink class. /// - public ResourceLink() { } + public ResourceLink() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceLink class. @@ -32,37 +38,43 @@ public ResourceLink() { } Id = id; Name = name; Properties = properties; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the fully qualified ID of the resource link. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets the name of the resource link. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// /// Gets or sets properties for resource link. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public ResourceLinkProperties Properties { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { - if (this.Properties != null) + if (Properties != null) { - this.Properties.Validate(); + Properties.Validate(); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkFilter.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkFilter.cs index 2713238ae2c4..ac38b654ad12 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkFilter.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkFilter.cs @@ -1,13 +1,17 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +22,10 @@ public partial class ResourceLinkFilter /// /// Initializes a new instance of the ResourceLinkFilter class. /// - public ResourceLinkFilter() { } + public ResourceLinkFilter() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceLinkFilter class. @@ -27,25 +34,31 @@ public ResourceLinkFilter() { } public ResourceLinkFilter(string targetId) { TargetId = targetId; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the ID of the target resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "targetId")] + [JsonProperty(PropertyName = "targetId")] public string TargetId { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (TargetId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "TargetId"); + throw new ValidationException(ValidationRules.CannotBeNull, "TargetId"); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkProperties.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkProperties.cs index 701a49c9525e..e6bbfbcc6dac 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkProperties.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceLinkProperties.cs @@ -1,13 +1,17 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +22,10 @@ public partial class ResourceLinkProperties /// /// Initializes a new instance of the ResourceLinkProperties class. /// - public ResourceLinkProperties() { } + public ResourceLinkProperties() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourceLinkProperties class. @@ -33,38 +40,44 @@ public ResourceLinkProperties() { } SourceId = sourceId; TargetId = targetId; Notes = notes; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the fully qualified ID of the source resource in the link. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "sourceId")] + [JsonProperty(PropertyName = "sourceId")] public string SourceId { get; private set; } /// /// Gets or sets the fully qualified ID of the target resource in the /// link. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "targetId")] + [JsonProperty(PropertyName = "targetId")] public string TargetId { get; set; } /// /// Gets or sets notes about the resource link. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "notes")] + [JsonProperty(PropertyName = "notes")] public string Notes { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (TargetId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "TargetId"); + throw new ValidationException(ValidationRules.CannotBeNull, "TargetId"); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceManagementErrorWithDetails.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceManagementErrorWithDetails.cs index 6f49c7b858ba..1b9ac400b93d 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceManagementErrorWithDetails.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceManagementErrorWithDetails.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -19,7 +24,10 @@ public partial class ResourceManagementErrorWithDetails /// Initializes a new instance of the /// ResourceManagementErrorWithDetails class. /// - public ResourceManagementErrorWithDetails() { } + public ResourceManagementErrorWithDetails() + { + CustomInit(); + } /// /// Initializes a new instance of the @@ -31,37 +39,43 @@ public ResourceManagementErrorWithDetails() { } /// error. /// The target of the error. /// Validation error. - public ResourceManagementErrorWithDetails(string code = default(string), string message = default(string), string target = default(string), System.Collections.Generic.IList details = default(System.Collections.Generic.IList)) + public ResourceManagementErrorWithDetails(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) { Code = code; Message = message; Target = target; Details = details; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the error code returned when exporting the template. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + [JsonProperty(PropertyName = "code")] public string Code { get; private set; } /// /// Gets the error message describing the export error. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + [JsonProperty(PropertyName = "message")] public string Message { get; private set; } /// /// Gets the target of the error. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + [JsonProperty(PropertyName = "target")] public string Target { get; private set; } /// /// Gets validation error. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "details")] - public System.Collections.Generic.IList Details { get; private set; } + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceProviderOperationDisplayProperties.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceProviderOperationDisplayProperties.cs index fdad50526287..14d49f0e0b96 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceProviderOperationDisplayProperties.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourceProviderOperationDisplayProperties.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -19,7 +22,10 @@ public partial class ResourceProviderOperationDisplayProperties /// Initializes a new instance of the /// ResourceProviderOperationDisplayProperties class. /// - public ResourceProviderOperationDisplayProperties() { } + public ResourceProviderOperationDisplayProperties() + { + CustomInit(); + } /// /// Initializes a new instance of the @@ -37,36 +43,42 @@ public ResourceProviderOperationDisplayProperties() { } Resource = resource; Operation = operation; Description = description; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets operation description. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "publisher")] + [JsonProperty(PropertyName = "publisher")] public string Publisher { get; set; } /// /// Gets or sets operation provider. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + [JsonProperty(PropertyName = "provider")] public string Provider { get; set; } /// /// Gets or sets operation resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + [JsonProperty(PropertyName = "resource")] public string Resource { get; set; } /// /// Gets or sets operation. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + [JsonProperty(PropertyName = "operation")] public string Operation { get; set; } /// /// Gets or sets operation description. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + [JsonProperty(PropertyName = "description")] public string Description { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourcesMoveInfo.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourcesMoveInfo.cs index d1a0c806989c..486ec8f4481c 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourcesMoveInfo.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/ResourcesMoveInfo.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +23,10 @@ public partial class ResourcesMoveInfo /// /// Initializes a new instance of the ResourcesMoveInfo class. /// - public ResourcesMoveInfo() { } + public ResourcesMoveInfo() + { + CustomInit(); + } /// /// Initializes a new instance of the ResourcesMoveInfo class. @@ -26,22 +34,28 @@ public ResourcesMoveInfo() { } /// The IDs of the resources. /// The target resource /// group. - public ResourcesMoveInfo(System.Collections.Generic.IList resources = default(System.Collections.Generic.IList), string targetResourceGroup = default(string)) + public ResourcesMoveInfo(IList resources = default(IList), string targetResourceGroup = default(string)) { Resources = resources; TargetResourceGroup = targetResourceGroup; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the IDs of the resources. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resources")] - public System.Collections.Generic.IList Resources { get; set; } + [JsonProperty(PropertyName = "resources")] + public IList Resources { get; set; } /// /// Gets or sets the target resource group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceGroup")] + [JsonProperty(PropertyName = "targetResourceGroup")] public string TargetResourceGroup { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Sku.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Sku.cs index 78e52028daf2..c61194047f1d 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Sku.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Sku.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class Sku /// /// Initializes a new instance of the Sku class. /// - public Sku() { } + public Sku() + { + CustomInit(); + } /// /// Initializes a new instance of the Sku class. @@ -37,42 +43,48 @@ public Sku() { } Family = family; Model = model; Capacity = capacity; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the SKU name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets the SKU tier. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tier")] + [JsonProperty(PropertyName = "tier")] public string Tier { get; set; } /// /// Gets or sets the SKU size. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "size")] + [JsonProperty(PropertyName = "size")] public string Size { get; set; } /// /// Gets or sets the SKU family. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "family")] + [JsonProperty(PropertyName = "family")] public string Family { get; set; } /// /// Gets or sets the SKU model. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "model")] + [JsonProperty(PropertyName = "model")] public string Model { get; set; } /// /// Gets or sets the SKU capacity. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "capacity")] + [JsonProperty(PropertyName = "capacity")] public int? Capacity { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubResource.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubResource.cs index b8ace68ec767..f193d2772aa6 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubResource.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubResource.cs @@ -1,24 +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.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; using System.Linq; /// /// Sub-resource. /// - public partial class SubResource : Microsoft.Rest.Azure.IResource + public partial class SubResource : IResource { /// /// Initializes a new instance of the SubResource class. /// - public SubResource() { } + public SubResource() + { + CustomInit(); + } /// /// Initializes a new instance of the SubResource class. @@ -27,12 +35,18 @@ public SubResource() { } public SubResource(string id = default(string)) { Id = id; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets resource ID /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Subscription.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Subscription.cs index 772a127e6d8c..33d02896d6c4 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Subscription.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/Subscription.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class Subscription /// /// Initializes a new instance of the Subscription class. /// - public Subscription() { } + public Subscription() + { + CustomInit(); + } /// /// Initializes a new instance of the Subscription class. @@ -46,47 +52,53 @@ public Subscription() { } State = state; SubscriptionPolicies = subscriptionPolicies; AuthorizationSource = authorizationSource; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the fully qualified ID for the subscription. For example, /// /subscriptions/00000000-0000-0000-0000-000000000000. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets the subscription ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionId")] + [JsonProperty(PropertyName = "subscriptionId")] public string SubscriptionId { get; private set; } /// /// Gets the subscription display name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] + [JsonProperty(PropertyName = "displayName")] public string DisplayName { get; private set; } /// /// Gets the subscription state. Possible values are Enabled, Warned, - /// PastDue, Disabled, and Deleted. Possible values include: - /// 'Enabled', 'Warned', 'PastDue', 'Disabled', 'Deleted' + /// PastDue, Disabled, and Deleted. Possible values include: 'Enabled', + /// 'Warned', 'PastDue', 'Disabled', 'Deleted' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "state")] + [JsonProperty(PropertyName = "state")] public SubscriptionState? State { get; private set; } /// /// Gets or sets the subscription policies. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "subscriptionPolicies")] + [JsonProperty(PropertyName = "subscriptionPolicies")] public SubscriptionPolicies SubscriptionPolicies { get; set; } /// /// Gets or sets the authorization source of the request. Valid values - /// are one or more combinations of Legacy, RoleBased, Bypassed, - /// Direct and Management. For example, 'Legacy, RoleBased'. + /// are one or more combinations of Legacy, RoleBased, Bypassed, Direct + /// and Management. For example, 'Legacy, RoleBased'. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "authorizationSource")] + [JsonProperty(PropertyName = "authorizationSource")] public string AuthorizationSource { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionPolicies.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionPolicies.cs index 351e11f70be0..b98fb80edd07 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionPolicies.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionPolicies.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,47 +21,55 @@ public partial class SubscriptionPolicies /// /// Initializes a new instance of the SubscriptionPolicies class. /// - public SubscriptionPolicies() { } + public SubscriptionPolicies() + { + CustomInit(); + } /// /// Initializes a new instance of the SubscriptionPolicies class. /// /// The subscription location /// placement ID. The ID indicates which regions are visible for a - /// subscription. For example, a subscription with a location - /// placement Id of Public_2014-09-01 has access to Azure public - /// regions. + /// subscription. For example, a subscription with a location placement + /// Id of Public_2014-09-01 has access to Azure public regions. /// The subscription quota ID. /// The subscription spending limit. /// Possible values include: 'On', 'Off', 'CurrentPeriodOff' - public SubscriptionPolicies(string locationPlacementId = default(string), string quotaId = default(string), spendingLimit? spendingLimit = default(spendingLimit?)) + public SubscriptionPolicies(string locationPlacementId = default(string), string quotaId = default(string), SpendingLimit? spendingLimit = default(SpendingLimit?)) { LocationPlacementId = locationPlacementId; QuotaId = quotaId; SpendingLimit = spendingLimit; + CustomInit(); } /// - /// Gets the subscription location placement ID. The ID indicates - /// which regions are visible for a subscription. For example, a - /// subscription with a location placement Id of Public_2014-09-01 - /// has access to Azure public regions. + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the subscription location placement ID. The ID indicates which + /// regions are visible for a subscription. For example, a subscription + /// with a location placement Id of Public_2014-09-01 has access to + /// Azure public regions. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "locationPlacementId")] + [JsonProperty(PropertyName = "locationPlacementId")] public string LocationPlacementId { get; private set; } /// /// Gets the subscription quota ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "quotaId")] + [JsonProperty(PropertyName = "quotaId")] public string QuotaId { get; private set; } /// /// Gets the subscription spending limit. Possible values include: /// 'On', 'Off', 'CurrentPeriodOff' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "spendingLimit")] - public spendingLimit? SpendingLimit { get; private set; } + [JsonProperty(PropertyName = "spendingLimit")] + public SpendingLimit? SpendingLimit { get; private set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionState.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionState.cs index d31a66a1ca06..7f5f21e56aca 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionState.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/SubscriptionState.cs @@ -1,29 +1,78 @@ +// // 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.Models { + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; /// /// Defines values for SubscriptionState. /// - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + [JsonConverter(typeof(StringEnumConverter))] public enum SubscriptionState { - [System.Runtime.Serialization.EnumMember(Value = "Enabled")] + [EnumMember(Value = "Enabled")] Enabled, - [System.Runtime.Serialization.EnumMember(Value = "Warned")] + [EnumMember(Value = "Warned")] Warned, - [System.Runtime.Serialization.EnumMember(Value = "PastDue")] + [EnumMember(Value = "PastDue")] PastDue, - [System.Runtime.Serialization.EnumMember(Value = "Disabled")] + [EnumMember(Value = "Disabled")] Disabled, - [System.Runtime.Serialization.EnumMember(Value = "Deleted")] + [EnumMember(Value = "Deleted")] Deleted } + internal static class SubscriptionStateEnumExtension + { + internal static string ToSerializedValue(this SubscriptionState? value) + { + return value == null ? null : ((SubscriptionState)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SubscriptionState value) + { + switch( value ) + { + case SubscriptionState.Enabled: + return "Enabled"; + case SubscriptionState.Warned: + return "Warned"; + case SubscriptionState.PastDue: + return "PastDue"; + case SubscriptionState.Disabled: + return "Disabled"; + case SubscriptionState.Deleted: + return "Deleted"; + } + return null; + } + + internal static SubscriptionState? ParseSubscriptionState(this string value) + { + switch( value ) + { + case "Enabled": + return SubscriptionState.Enabled; + case "Warned": + return SubscriptionState.Warned; + case "PastDue": + return SubscriptionState.PastDue; + case "Disabled": + return SubscriptionState.Disabled; + case "Deleted": + return SubscriptionState.Deleted; + } + return null; + } + } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagCount.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagCount.cs index dcee569836c3..fdcb67a3c80f 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagCount.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagCount.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class TagCount /// /// Initializes a new instance of the TagCount class. /// - public TagCount() { } + public TagCount() + { + CustomInit(); + } /// /// Initializes a new instance of the TagCount class. @@ -29,18 +35,24 @@ public TagCount() { } { Type = type; Value = value; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets type of count. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + [JsonProperty(PropertyName = "type")] public string Type { get; set; } /// /// Gets or sets value of count. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + [JsonProperty(PropertyName = "value")] public int? Value { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagDetails.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagDetails.cs index e5f44309bfeb..e0bca0ebebc4 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagDetails.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagDetails.cs @@ -1,13 +1,18 @@ +// // 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.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -18,7 +23,10 @@ public partial class TagDetails /// /// Initializes a new instance of the TagDetails class. /// - public TagDetails() { } + public TagDetails() + { + CustomInit(); + } /// /// Initializes a new instance of the TagDetails class. @@ -26,27 +34,33 @@ public TagDetails() { } /// The tag ID. /// The tag name. /// The total number of resources that use the - /// resource tag. When a tag is initially created and has no - /// associated resources, the value is 0. + /// resource tag. When a tag is initially created and has no associated + /// resources, the value is 0. /// The list of tag values. - public TagDetails(string id = default(string), string tagName = default(string), TagCount count = default(TagCount), System.Collections.Generic.IList values = default(System.Collections.Generic.IList)) + public TagDetails(string id = default(string), string tagName = default(string), TagCount count = default(TagCount), IList values = default(IList)) { Id = id; TagName = tagName; Count = count; Values = values; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the tag ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the tag name. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tagName")] + [JsonProperty(PropertyName = "tagName")] public string TagName { get; set; } /// @@ -54,14 +68,14 @@ public TagDetails() { } /// tag. When a tag is initially created and has no associated /// resources, the value is 0. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "count")] + [JsonProperty(PropertyName = "count")] public TagCount Count { get; set; } /// /// Gets or sets the list of tag values. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "values")] - public System.Collections.Generic.IList Values { get; set; } + [JsonProperty(PropertyName = "values")] + public IList Values { get; set; } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagValue.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagValue.cs index 175e9e912062..97c9be5c39c1 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagValue.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TagValue.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class TagValue /// /// Initializes a new instance of the TagValue class. /// - public TagValue() { } + public TagValue() + { + CustomInit(); + } /// /// Initializes a new instance of the TagValue class. @@ -31,24 +37,30 @@ public TagValue() { } Id = id; TagValueProperty = tagValueProperty; Count = count; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the tag ID. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the tag value. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tagValue")] + [JsonProperty(PropertyName = "tagValue")] public string TagValueProperty { get; set; } /// /// Gets or sets the tag value count. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "count")] + [JsonProperty(PropertyName = "count")] public TagCount Count { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TargetResource.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TargetResource.cs index edfcd46f0234..7e6640cb5831 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TargetResource.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TargetResource.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +21,10 @@ public partial class TargetResource /// /// Initializes a new instance of the TargetResource class. /// - public TargetResource() { } + public TargetResource() + { + CustomInit(); + } /// /// Initializes a new instance of the TargetResource class. @@ -31,24 +37,30 @@ public TargetResource() { } Id = id; ResourceName = resourceName; ResourceType = resourceType; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the ID of the resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; set; } /// /// Gets or sets the name of the resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceName")] + [JsonProperty(PropertyName = "resourceName")] public string ResourceName { get; set; } /// /// Gets or sets the type of the resource. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resourceType")] + [JsonProperty(PropertyName = "resourceType")] public string ResourceType { get; set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TemplateLink.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TemplateLink.cs index 68aa27ba94df..e0b5ea143904 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TemplateLink.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TemplateLink.cs @@ -1,13 +1,17 @@ +// // 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.Models { + using Microsoft.Rest; + using Newtonsoft.Json; using System.Linq; /// @@ -18,7 +22,10 @@ public partial class TemplateLink /// /// Initializes a new instance of the TemplateLink class. /// - public TemplateLink() { } + public TemplateLink() + { + CustomInit(); + } /// /// Initializes a new instance of the TemplateLink class. @@ -30,32 +37,38 @@ public TemplateLink() { } { Uri = uri; ContentVersion = contentVersion; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the URI of the template to deploy. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "uri")] + [JsonProperty(PropertyName = "uri")] public string Uri { get; set; } /// /// Gets or sets if included, must match the ContentVersion in the /// template. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "contentVersion")] + [JsonProperty(PropertyName = "contentVersion")] public string ContentVersion { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (Uri == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Uri"); + throw new ValidationException(ValidationRules.CannotBeNull, "Uri"); } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TenantIdDescription.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TenantIdDescription.cs index 7b262d9c2a38..b45f453f98f6 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TenantIdDescription.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/TenantIdDescription.cs @@ -1,13 +1,16 @@ +// // 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.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -18,33 +21,42 @@ public partial class TenantIdDescription /// /// Initializes a new instance of the TenantIdDescription class. /// - public TenantIdDescription() { } + public TenantIdDescription() + { + CustomInit(); + } /// /// Initializes a new instance of the TenantIdDescription class. /// - /// The fully qualified ID of the tenant. For - /// example, /tenants/00000000-0000-0000-0000-000000000000. + /// The fully qualified ID of the tenant. For example, + /// /tenants/00000000-0000-0000-0000-000000000000. /// The tenant ID. For example, /// 00000000-0000-0000-0000-000000000000. public TenantIdDescription(string id = default(string), string tenantId = default(string)) { Id = id; TenantId = tenantId; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets the fully qualified ID of the tenant. For example, /// /tenants/00000000-0000-0000-0000-000000000000. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// /// Gets the tenant ID. For example, /// 00000000-0000-0000-0000-000000000000. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "tenantId")] + [JsonProperty(PropertyName = "tenantId")] public string TenantId { get; private set; } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/spendingLimit.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/spendingLimit.cs index 5e206f4fdb82..e839fbd1afda 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/Models/spendingLimit.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/Models/spendingLimit.cs @@ -1,25 +1,66 @@ +// // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for // license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator 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.Models { + using Newtonsoft.Json; + using Newtonsoft.Json.Converters; + using System.Runtime; + using System.Runtime.Serialization; /// - /// Defines values for spendingLimit. + /// Defines values for SpendingLimit. /// - [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] - public enum spendingLimit + [JsonConverter(typeof(StringEnumConverter))] + public enum SpendingLimit { - [System.Runtime.Serialization.EnumMember(Value = "On")] + [EnumMember(Value = "On")] On, - [System.Runtime.Serialization.EnumMember(Value = "Off")] + [EnumMember(Value = "Off")] Off, - [System.Runtime.Serialization.EnumMember(Value = "CurrentPeriodOff")] + [EnumMember(Value = "CurrentPeriodOff")] CurrentPeriodOff } + internal static class SpendingLimitEnumExtension + { + internal static string ToSerializedValue(this SpendingLimit? value) + { + return value == null ? null : ((SpendingLimit)value).ToSerializedValue(); + } + + internal static string ToSerializedValue(this SpendingLimit value) + { + switch( value ) + { + case SpendingLimit.On: + return "On"; + case SpendingLimit.Off: + return "Off"; + case SpendingLimit.CurrentPeriodOff: + return "CurrentPeriodOff"; + } + return null; + } + + internal static SpendingLimit? ParseSpendingLimit(this string value) + { + switch( value ) + { + case "On": + return SpendingLimit.On; + case "Off": + return SpendingLimit.Off; + case "CurrentPeriodOff": + return SpendingLimit.CurrentPeriodOff; + } + return null; + } + } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyAssignmentsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyAssignmentsOperations.cs index 1b62f7c43480..b84137568b2a 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyAssignmentsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyAssignmentsOperations.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; /// /// PolicyAssignmentsOperations operations. /// - internal partial class PolicyAssignmentsOperations : Microsoft.Rest.IServiceOperations, IPolicyAssignmentsOperations + internal partial class PolicyAssignmentsOperations : IServiceOperations, IPolicyAssignmentsOperations { /// /// Initializes a new instance of the PolicyAssignmentsOperations class. @@ -29,11 +39,11 @@ internal partial class PolicyAssignmentsOperations : Microsoft.Rest.IServiceOper /// internal PolicyAssignmentsOperations(PolicyClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -56,76 +66,79 @@ internal PolicyAssignmentsOperations(PolicyClient 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> DeleteWithHttpMessagesAsync(string scope, string policyAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> DeleteWithHttpMessagesAsync(string scope, string policyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } if (policyAssignmentName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyAssignmentName"); - } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyAssignmentName"); } + string apiVersion = "2017-06-01-preview"; // 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("scope", scope); tracingParameters.Add("policyAssignmentName", policyAssignmentName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}").ToString(); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}").ToString(); _url = _url.Replace("{scope}", scope); _url = _url.Replace("{policyAssignmentName}", System.Uri.EscapeDataString(policyAssignmentName)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + List _queryParameters = new List(); + if (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(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) @@ -141,51 +154,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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) + if ((int)_statusCode != 200 && (int)_statusCode != 204) { - var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -195,7 +203,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -208,21 +216,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -232,8 +240,8 @@ internal PolicyAssignmentsOperations(PolicyClient client) /// /// /// Policy assignments are inherited by child resources. For example, when you - /// apply a policy to a resource group that policy is assigned to all - /// resources in the group. + /// apply a policy to a resource group that policy is assigned to all resources + /// in the group. /// /// /// The scope of the policy assignment. @@ -250,81 +258,88 @@ internal PolicyAssignmentsOperations(PolicyClient 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> CreateWithHttpMessagesAsync(string scope, string policyAssignmentName, PolicyAssignment parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateWithHttpMessagesAsync(string scope, string policyAssignmentName, PolicyAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } if (policyAssignmentName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyAssignmentName"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyAssignmentName"); } if (parameters == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (this.Client.ApiVersion == null) + if (parameters != null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + parameters.Validate(); } + string apiVersion = "2017-06-01-preview"; // 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("scope", scope); tracingParameters.Add("policyAssignmentName", policyAssignmentName); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); } // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}").ToString(); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}").ToString(); _url = _url.Replace("{scope}", scope); _url = _url.Replace("{policyAssignmentName}", System.Uri.EscapeDataString(policyAssignmentName)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + List _queryParameters = new List(); + if (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(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) @@ -341,56 +356,51 @@ internal PolicyAssignmentsOperations(PolicyClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 201) { - var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -400,7 +410,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -413,21 +423,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -447,76 +457,79 @@ internal PolicyAssignmentsOperations(PolicyClient 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 scope, string policyAssignmentName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string scope, string policyAssignmentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } if (policyAssignmentName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyAssignmentName"); - } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyAssignmentName"); } + string apiVersion = "2017-06-01-preview"; // 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("scope", scope); tracingParameters.Add("policyAssignmentName", policyAssignmentName); + tracingParameters.Add("apiVersion", apiVersion); 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 _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/policyassignments/{policyAssignmentName}").ToString(); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName}").ToString(); _url = _url.Replace("{scope}", scope); _url = _url.Replace("{policyAssignmentName}", System.Uri.EscapeDataString(policyAssignmentName)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + List _queryParameters = new List(); + if (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(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) @@ -532,51 +545,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -586,7 +594,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -599,21 +607,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -633,95 +641,98 @@ internal PolicyAssignmentsOperations(PolicyClient 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>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListForResourceGroupWithHttpMessagesAsync(string resourceGroupName, string filter = default(string), 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) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.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"); } + string apiVersion = "2017-06-01-preview"; // 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("filter", filter); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroup", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroup", 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.Authorization/policyAssignments").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 (filter != null) { _queryParameters.Add(string.Format("$filter={0}", filter)); } - if (this.Client.ApiVersion != null) + if (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(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) @@ -737,51 +748,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -791,7 +797,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -804,21 +810,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -851,123 +857,127 @@ internal PolicyAssignmentsOperations(PolicyClient 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>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, 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)) + [System.Obsolete()] + public async Task>> ListForResourceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); - } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } - 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"); } + string apiVersion = "2017-06-01-preview"; // 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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); tracingParameters.Add("resourceType", resourceType); tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListForResource", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForResource", tracingParameters); } // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyassignments").ToString(); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); _url = _url.Replace("{parentResourcePath}", parentResourcePath); _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _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 (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(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) @@ -983,51 +993,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1037,7 +1042,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -1050,21 +1055,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -1081,78 +1086,81 @@ internal PolicyAssignmentsOperations(PolicyClient 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(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>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.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"); } + string apiVersion = "2017-06-01-preview"; // 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("apiVersion", apiVersion); 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 _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyassignments").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyAssignments").ToString(); + _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 (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(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) @@ -1168,51 +1176,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1222,7 +1225,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -1235,21 +1238,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -1260,8 +1263,8 @@ internal PolicyAssignmentsOperations(PolicyClient client) /// /// When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -1275,70 +1278,73 @@ internal PolicyAssignmentsOperations(PolicyClient 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> DeleteByIdWithHttpMessagesAsync(string policyAssignmentId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> DeleteByIdWithHttpMessagesAsync(string policyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (policyAssignmentId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyAssignmentId"); - } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyAssignmentId"); } + string apiVersion = "2017-06-01-preview"; // 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("policyAssignmentId", policyAssignmentId); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteById", 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("/") ? "" : "/")), "{policyAssignmentId}").ToString(); _url = _url.Replace("{policyAssignmentId}", policyAssignmentId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + List _queryParameters = new List(); + if (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(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) @@ -1354,51 +1360,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1408,7 +1409,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -1421,21 +1422,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -1445,11 +1446,11 @@ internal PolicyAssignmentsOperations(PolicyClient client) /// /// /// Policy assignments are inherited by child resources. For example, when you - /// apply a policy to a resource group that policy is assigned to all - /// resources in the group. When providing a scope for the assigment, use + /// apply a policy to a resource group that policy is assigned to all resources + /// in the group. When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -1466,75 +1467,82 @@ internal PolicyAssignmentsOperations(PolicyClient 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> CreateByIdWithHttpMessagesAsync(string policyAssignmentId, PolicyAssignment parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateByIdWithHttpMessagesAsync(string policyAssignmentId, PolicyAssignment parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (policyAssignmentId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyAssignmentId"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyAssignmentId"); } if (parameters == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (this.Client.ApiVersion == null) + if (parameters != null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + parameters.Validate(); } + string apiVersion = "2017-06-01-preview"; // 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("policyAssignmentId", policyAssignmentId); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateById", 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("/") ? "" : "/")), "{policyAssignmentId}").ToString(); _url = _url.Replace("{policyAssignmentId}", policyAssignmentId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + List _queryParameters = new List(); + if (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(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) @@ -1551,56 +1559,51 @@ internal PolicyAssignmentsOperations(PolicyClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 201) { - var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1610,7 +1613,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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,21 +1626,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -1648,8 +1651,8 @@ internal PolicyAssignmentsOperations(PolicyClient client) /// /// When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -1663,70 +1666,73 @@ internal PolicyAssignmentsOperations(PolicyClient 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> GetByIdWithHttpMessagesAsync(string policyAssignmentId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetByIdWithHttpMessagesAsync(string policyAssignmentId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (policyAssignmentId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyAssignmentId"); - } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyAssignmentId"); } + string apiVersion = "2017-06-01-preview"; // 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("policyAssignmentId", policyAssignmentId); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetById", 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("/") ? "" : "/")), "{policyAssignmentId}").ToString(); _url = _url.Replace("{policyAssignmentId}", policyAssignmentId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + List _queryParameters = new List(); + if (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(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) @@ -1742,51 +1748,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1796,7 +1797,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -1809,21 +1810,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -1840,61 +1841,66 @@ internal PolicyAssignmentsOperations(PolicyClient 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>> ListForResourceGroupNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListForResourceGroupNextWithHttpMessagesAsync(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, "ListForResourceGroupNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForResourceGroupNext", 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) @@ -1910,51 +1916,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -1964,7 +1965,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -1977,21 +1978,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -2008,61 +2009,67 @@ internal PolicyAssignmentsOperations(PolicyClient 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>> ListForResourceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + [System.Obsolete()] + public async Task>> ListForResourceNextWithHttpMessagesAsync(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, "ListForResourceNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListForResourceNext", 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) @@ -2078,51 +2085,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2132,7 +2134,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -2145,21 +2147,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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; } @@ -2176,61 +2178,66 @@ internal PolicyAssignmentsOperations(PolicyClient 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) @@ -2246,51 +2253,46 @@ internal PolicyAssignmentsOperations(PolicyClient 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 ErrorResponseException(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); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new Microsoft.Rest.Azure.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); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + ServiceClientTracing.Error(_invocationId, ex); } _httpRequest.Dispose(); if (_httpResponse != null) @@ -2300,7 +2302,7 @@ internal PolicyAssignmentsOperations(PolicyClient 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")) @@ -2313,21 +2315,21 @@ internal PolicyAssignmentsOperations(PolicyClient 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/PolicyAssignmentsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyAssignmentsOperationsExtensions.cs index 2f6f22d4ec64..942c887f67c2 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyAssignmentsOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyAssignmentsOperationsExtensions.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 PolicyAssignmentsOperations. @@ -31,7 +36,7 @@ public static partial class PolicyAssignmentsOperationsExtensions /// public static PolicyAssignment Delete(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).DeleteAsync(scope, policyAssignmentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.DeleteAsync(scope, policyAssignmentName).GetAwaiter().GetResult(); } /// @@ -49,7 +54,7 @@ public static PolicyAssignment Delete(this IPolicyAssignmentsOperations operatio /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeleteWithHttpMessagesAsync(scope, policyAssignmentName, null, cancellationToken).ConfigureAwait(false)) { @@ -62,8 +67,8 @@ public static PolicyAssignment Delete(this IPolicyAssignmentsOperations operatio /// /// /// Policy assignments are inherited by child resources. For example, when you - /// apply a policy to a resource group that policy is assigned to all - /// resources in the group. + /// apply a policy to a resource group that policy is assigned to all resources + /// in the group. /// /// /// The operations group for this extension method. @@ -79,7 +84,7 @@ public static PolicyAssignment Delete(this IPolicyAssignmentsOperations operatio /// public static PolicyAssignment Create(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, PolicyAssignment parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).CreateAsync(scope, policyAssignmentName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateAsync(scope, policyAssignmentName, parameters).GetAwaiter().GetResult(); } /// @@ -87,8 +92,8 @@ public static PolicyAssignment Create(this IPolicyAssignmentsOperations operatio /// /// /// Policy assignments are inherited by child resources. For example, when you - /// apply a policy to a resource group that policy is assigned to all - /// resources in the group. + /// apply a policy to a resource group that policy is assigned to all resources + /// in the group. /// /// /// The operations group for this extension method. @@ -105,7 +110,7 @@ public static PolicyAssignment Create(this IPolicyAssignmentsOperations operatio /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateAsync(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateAsync(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, PolicyAssignment parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateWithHttpMessagesAsync(scope, policyAssignmentName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -127,7 +132,7 @@ public static PolicyAssignment Create(this IPolicyAssignmentsOperations operatio /// public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).GetAsync(scope, policyAssignmentName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(scope, policyAssignmentName).GetAwaiter().GetResult(); } /// @@ -145,7 +150,7 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IPolicyAssignmentsOperations operations, string scope, string policyAssignmentName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(scope, policyAssignmentName, null, cancellationToken).ConfigureAwait(false)) { @@ -165,9 +170,9 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// The filter to apply on the operation. /// - public static Microsoft.Rest.Azure.IPage ListForResourceGroup(this IPolicyAssignmentsOperations operations, string resourceGroupName, string filter = default(string)) + public static IPage ListForResourceGroup(this IPolicyAssignmentsOperations operations, string resourceGroupName, string filter = default(string)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).ListForResourceGroupAsync(resourceGroupName, filter), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListForResourceGroupAsync(resourceGroupName, filter).GetAwaiter().GetResult(); } /// @@ -185,7 +190,7 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// The cancellation token. /// - public static async Task> ListForResourceGroupAsync(this IPolicyAssignmentsOperations operations, string resourceGroupName, string filter = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListForResourceGroupAsync(this IPolicyAssignmentsOperations operations, string resourceGroupName, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForResourceGroupWithHttpMessagesAsync(resourceGroupName, filter, null, cancellationToken).ConfigureAwait(false)) { @@ -218,9 +223,10 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage ListForResource(this IPolicyAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + [System.Obsolete()] + public static IPage ListForResource(this IPolicyAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListForResourceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery).GetAwaiter().GetResult(); } /// @@ -251,7 +257,8 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// The cancellation token. /// - public static async Task> ListForResourceAsync(this IPolicyAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + [System.Obsolete()] + public static async Task> ListForResourceAsync(this IPolicyAssignmentsOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForResourceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -268,9 +275,9 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage List(this IPolicyAssignmentsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage List(this IPolicyAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).ListAsync(odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -285,7 +292,7 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// The cancellation token. /// - public static async Task> ListAsync(this IPolicyAssignmentsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this IPolicyAssignmentsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -299,8 +306,8 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// /// When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -313,7 +320,7 @@ public static PolicyAssignment Get(this IPolicyAssignmentsOperations operations, /// public static PolicyAssignment DeleteById(this IPolicyAssignmentsOperations operations, string policyAssignmentId) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).DeleteByIdAsync(policyAssignmentId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.DeleteByIdAsync(policyAssignmentId).GetAwaiter().GetResult(); } /// @@ -322,8 +329,8 @@ public static PolicyAssignment DeleteById(this IPolicyAssignmentsOperations oper /// /// When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -337,7 +344,7 @@ public static PolicyAssignment DeleteById(this IPolicyAssignmentsOperations oper /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteByIdAsync(this IPolicyAssignmentsOperations operations, string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteByIdAsync(this IPolicyAssignmentsOperations operations, string policyAssignmentId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeleteByIdWithHttpMessagesAsync(policyAssignmentId, null, cancellationToken).ConfigureAwait(false)) { @@ -350,11 +357,11 @@ public static PolicyAssignment DeleteById(this IPolicyAssignmentsOperations oper /// /// /// Policy assignments are inherited by child resources. For example, when you - /// apply a policy to a resource group that policy is assigned to all - /// resources in the group. When providing a scope for the assigment, use + /// apply a policy to a resource group that policy is assigned to all resources + /// in the group. When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -370,7 +377,7 @@ public static PolicyAssignment DeleteById(this IPolicyAssignmentsOperations oper /// public static PolicyAssignment CreateById(this IPolicyAssignmentsOperations operations, string policyAssignmentId, PolicyAssignment parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).CreateByIdAsync(policyAssignmentId, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateByIdAsync(policyAssignmentId, parameters).GetAwaiter().GetResult(); } /// @@ -378,11 +385,11 @@ public static PolicyAssignment CreateById(this IPolicyAssignmentsOperations oper /// /// /// Policy assignments are inherited by child resources. For example, when you - /// apply a policy to a resource group that policy is assigned to all - /// resources in the group. When providing a scope for the assigment, use + /// apply a policy to a resource group that policy is assigned to all resources + /// in the group. When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -399,7 +406,7 @@ public static PolicyAssignment CreateById(this IPolicyAssignmentsOperations oper /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateByIdAsync(this IPolicyAssignmentsOperations operations, string policyAssignmentId, PolicyAssignment parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateByIdAsync(this IPolicyAssignmentsOperations operations, string policyAssignmentId, PolicyAssignment parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateByIdWithHttpMessagesAsync(policyAssignmentId, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -413,8 +420,8 @@ public static PolicyAssignment CreateById(this IPolicyAssignmentsOperations oper /// /// When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -427,7 +434,7 @@ public static PolicyAssignment CreateById(this IPolicyAssignmentsOperations oper /// public static PolicyAssignment GetById(this IPolicyAssignmentsOperations operations, string policyAssignmentId) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).GetByIdAsync(policyAssignmentId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetByIdAsync(policyAssignmentId).GetAwaiter().GetResult(); } /// @@ -436,8 +443,8 @@ public static PolicyAssignment GetById(this IPolicyAssignmentsOperations operati /// /// When providing a scope for the assigment, use /// '/subscriptions/{subscription-id}/' for subscriptions, - /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' - /// for resource groups, and + /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for + /// resource groups, and /// '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider-namespace}/{resource-type}/{resource-name}' /// for resources. /// @@ -451,7 +458,7 @@ public static PolicyAssignment GetById(this IPolicyAssignmentsOperations operati /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetByIdAsync(this IPolicyAssignmentsOperations operations, string policyAssignmentId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetByIdAsync(this IPolicyAssignmentsOperations operations, string policyAssignmentId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetByIdWithHttpMessagesAsync(policyAssignmentId, null, cancellationToken).ConfigureAwait(false)) { @@ -468,9 +475,9 @@ public static PolicyAssignment GetById(this IPolicyAssignmentsOperations operati /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListForResourceGroupNext(this IPolicyAssignmentsOperations operations, string nextPageLink) + public static IPage ListForResourceGroupNext(this IPolicyAssignmentsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).ListForResourceGroupNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListForResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -485,7 +492,7 @@ public static Microsoft.Rest.Azure.IPage ListForResourceGroupN /// /// The cancellation token. /// - public static async Task> ListForResourceGroupNextAsync(this IPolicyAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListForResourceGroupNextAsync(this IPolicyAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -502,9 +509,10 @@ public static Microsoft.Rest.Azure.IPage ListForResourceGroupN /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListForResourceNext(this IPolicyAssignmentsOperations operations, string nextPageLink) + [System.Obsolete()] + public static IPage ListForResourceNext(this IPolicyAssignmentsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)s).ListForResourceNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListForResourceNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -519,7 +527,8 @@ public static Microsoft.Rest.Azure.IPage ListForResourceNext(t /// /// The cancellation token. /// - public static async Task> ListForResourceNextAsync(this IPolicyAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + [System.Obsolete()] + public static async Task> ListForResourceNextAsync(this IPolicyAssignmentsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListForResourceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -536,9 +545,9 @@ public static Microsoft.Rest.Azure.IPage ListForResourceNext(t /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this IPolicyAssignmentsOperations operations, string nextPageLink) + public static IPage ListNext(this IPolicyAssignmentsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyAssignmentsOperations)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(); } /// @@ -553,7 +562,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this IPolicy /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IPolicyAssignmentsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this IPolicyAssignmentsOperations 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/PolicyClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyClient.cs index 854259866b3c..349bf9f807d0 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyClient.cs @@ -1,23 +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 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; /// /// To manage and control access to your resources, you can define /// customized policies and assign them at a scope. /// - public partial class PolicyClient : Microsoft.Rest.ServiceClient, IPolicyClient, IAzureClient + public partial class PolicyClient : ServiceClient, IPolicyClient, IAzureClient { /// /// The base URI of the service. @@ -27,28 +35,23 @@ public partial class PolicyClient : 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. /// public string SubscriptionId { get; set; } - /// - /// The API version to use for the operation. - /// - public string ApiVersion { get; private set; } - /// /// Gets or sets the preferred language for the response. /// @@ -71,6 +74,11 @@ public partial class PolicyClient : Microsoft.Rest.ServiceClient, /// public virtual IPolicyAssignmentsOperations PolicyAssignments { get; private set; } + /// + /// Gets the IPolicySetDefinitionsOperations. + /// + public virtual IPolicySetDefinitionsOperations PolicySetDefinitions { get; private set; } + /// /// Gets the IPolicyDefinitionsOperations. /// @@ -82,9 +90,9 @@ public partial class PolicyClient : Microsoft.Rest.ServiceClient, /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected PolicyClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + protected PolicyClient(params DelegatingHandler[] handlers) : base(handlers) { - this.Initialize(); + Initialize(); } /// @@ -96,9 +104,9 @@ protected PolicyClient(params System.Net.Http.DelegatingHandler[] handlers) : ba /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected PolicyClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected PolicyClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { - this.Initialize(); + Initialize(); } /// @@ -113,13 +121,13 @@ protected PolicyClient(System.Net.Http.HttpClientHandler rootHandler, params Sys /// /// Thrown when a required parameter is null /// - protected PolicyClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + protected PolicyClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -137,13 +145,13 @@ protected PolicyClient(System.Uri baseUri, params System.Net.Http.DelegatingHand /// /// Thrown when a required parameter is null /// - protected PolicyClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected PolicyClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -158,16 +166,16 @@ protected PolicyClient(System.Uri baseUri, System.Net.Http.HttpClientHandler roo /// /// Thrown when a required parameter is null /// - public PolicyClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public PolicyClient(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); } } @@ -186,16 +194,16 @@ public PolicyClient(Microsoft.Rest.ServiceClientCredentials credentials, params /// /// Thrown when a required parameter is null /// - public PolicyClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public PolicyClient(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); } } @@ -214,7 +222,7 @@ public PolicyClient(Microsoft.Rest.ServiceClientCredentials credentials, System. /// /// Thrown when a required parameter is null /// - public PolicyClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public PolicyClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -224,11 +232,11 @@ public PolicyClient(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); } } @@ -250,7 +258,7 @@ public PolicyClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials /// /// Thrown when a required parameter is null /// - public PolicyClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public PolicyClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -260,11 +268,11 @@ public PolicyClient(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); } } @@ -277,42 +285,42 @@ public PolicyClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials /// private void Initialize() { - this.PolicyAssignments = new PolicyAssignmentsOperations(this); - this.PolicyDefinitions = new PolicyDefinitionsOperations(this); - this.BaseUri = new System.Uri("https://management.azure.com"); - this.ApiVersion = "2016-04-01"; - this.AcceptLanguage = "en-US"; - this.LongRunningOperationRetryTimeout = 30; - this.GenerateClientRequestId = true; - SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + PolicyAssignments = new PolicyAssignmentsOperations(this); + PolicySetDefinitions = new PolicySetDefinitionsOperations(this); + PolicyDefinitions = new PolicyDefinitionsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + 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() } }; - SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); - DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + SerializationSettings.Converters.Add(new TransformationJsonConverter()); + 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.Serialization.TransformationJsonConverter()); - DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); - } + DeserializationSettings.Converters.Add(new TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); + } } } diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyDefinitionsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyDefinitionsOperations.cs index db2b2b5e2275..175b9adf392e 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyDefinitionsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyDefinitionsOperations.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; /// /// PolicyDefinitionsOperations operations. /// - internal partial class PolicyDefinitionsOperations : Microsoft.Rest.IServiceOperations, IPolicyDefinitionsOperations + internal partial class PolicyDefinitionsOperations : IServiceOperations, IPolicyDefinitionsOperations { /// /// Initializes a new instance of the PolicyDefinitionsOperations class. @@ -29,11 +39,11 @@ internal partial class PolicyDefinitionsOperations : Microsoft.Rest.IServiceOper /// internal PolicyDefinitionsOperations(PolicyClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -56,80 +66,83 @@ internal PolicyDefinitionsOperations(PolicyClient 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> CreateOrUpdateWithHttpMessagesAsync(string policyDefinitionName, PolicyDefinition parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string policyDefinitionName, PolicyDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (policyDefinitionName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyDefinitionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyDefinitionName"); } if (parameters == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - if (this.Client.ApiVersion == null) + if (Client.SubscriptionId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2016-12-01"; // 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("policyDefinitionName", policyDefinitionName); tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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.Authorization/policydefinitions/{policyDefinitionName}").ToString(); _url = _url.Replace("{policyDefinitionName}", System.Uri.EscapeDataString(policyDefinitionName)); - _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 (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(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) @@ -146,56 +159,56 @@ internal PolicyDefinitionsOperations(PolicyClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 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) @@ -205,7 +218,7 @@ internal PolicyDefinitionsOperations(PolicyClient 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")) @@ -218,21 +231,21 @@ internal PolicyDefinitionsOperations(PolicyClient 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; } @@ -249,72 +262,75 @@ internal PolicyDefinitionsOperations(PolicyClient 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 DeleteWithHttpMessagesAsync(string policyDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string policyDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (policyDefinitionName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyDefinitionName"); - } - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyDefinitionName"); } - 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"); } + string apiVersion = "2016-12-01"; // 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("policyDefinitionName", policyDefinitionName); + tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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.Authorization/policydefinitions/{policyDefinitionName}").ToString(); _url = _url.Replace("{policyDefinitionName}", System.Uri.EscapeDataString(policyDefinitionName)); - _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 (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(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) @@ -330,43 +346,51 @@ internal PolicyDefinitionsOperations(PolicyClient 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 && (int)_statusCode != 200) { - 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) @@ -376,7 +400,7 @@ internal PolicyDefinitionsOperations(PolicyClient 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")) @@ -385,7 +409,7 @@ internal PolicyDefinitionsOperations(PolicyClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -402,75 +426,78 @@ internal PolicyDefinitionsOperations(PolicyClient 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 policyDefinitionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string policyDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (policyDefinitionName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "policyDefinitionName"); + throw new ValidationException(ValidationRules.CannotBeNull, "policyDefinitionName"); } - if (this.Client.ApiVersion == null) + if (Client.SubscriptionId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + string apiVersion = "2016-12-01"; // 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("policyDefinitionName", policyDefinitionName); + tracingParameters.Add("apiVersion", apiVersion); 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.Authorization/policydefinitions/{policyDefinitionName}").ToString(); _url = _url.Replace("{policyDefinitionName}", System.Uri.EscapeDataString(policyDefinitionName)); - _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 (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(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) @@ -486,51 +513,51 @@ internal PolicyDefinitionsOperations(PolicyClient 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) @@ -540,7 +567,7 @@ internal PolicyDefinitionsOperations(PolicyClient 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")) @@ -553,21 +580,21 @@ internal PolicyDefinitionsOperations(PolicyClient 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; } @@ -584,78 +611,81 @@ internal PolicyDefinitionsOperations(PolicyClient 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(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>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (this.Client.ApiVersion == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.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"); } + string apiVersion = "2016-12-01"; // 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("apiVersion", apiVersion); 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.Authorization/policydefinitions").ToString(); - _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 (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(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) @@ -671,51 +701,51 @@ internal PolicyDefinitionsOperations(PolicyClient 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) @@ -725,7 +755,7 @@ internal PolicyDefinitionsOperations(PolicyClient 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")) @@ -738,21 +768,21 @@ internal PolicyDefinitionsOperations(PolicyClient 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; } @@ -769,61 +799,66 @@ internal PolicyDefinitionsOperations(PolicyClient 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) @@ -839,51 +874,51 @@ internal PolicyDefinitionsOperations(PolicyClient 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) @@ -893,7 +928,7 @@ internal PolicyDefinitionsOperations(PolicyClient 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")) @@ -906,21 +941,21 @@ internal PolicyDefinitionsOperations(PolicyClient 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/PolicyDefinitionsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyDefinitionsOperationsExtensions.cs index efb3b4246fc3..cce24d38404d 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyDefinitionsOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicyDefinitionsOperationsExtensions.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 PolicyDefinitionsOperations. @@ -31,7 +36,7 @@ public static partial class PolicyDefinitionsOperationsExtensions /// public static PolicyDefinition CreateOrUpdate(this IPolicyDefinitionsOperations operations, string policyDefinitionName, PolicyDefinition parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyDefinitionsOperations)s).CreateOrUpdateAsync(policyDefinitionName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(policyDefinitionName, parameters).GetAwaiter().GetResult(); } /// @@ -49,7 +54,7 @@ public static PolicyDefinition CreateOrUpdate(this IPolicyDefinitionsOperations /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IPolicyDefinitionsOperations operations, string policyDefinitionName, PolicyDefinition parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this IPolicyDefinitionsOperations operations, string policyDefinitionName, PolicyDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(policyDefinitionName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -68,7 +73,7 @@ public static PolicyDefinition CreateOrUpdate(this IPolicyDefinitionsOperations /// public static void Delete(this IPolicyDefinitionsOperations operations, string policyDefinitionName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyDefinitionsOperations)s).DeleteAsync(policyDefinitionName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(policyDefinitionName).GetAwaiter().GetResult(); } /// @@ -83,9 +88,9 @@ public static void Delete(this IPolicyDefinitionsOperations operations, string p /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this IPolicyDefinitionsOperations operations, string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this IPolicyDefinitionsOperations operations, string policyDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(policyDefinitionName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(policyDefinitionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -99,7 +104,7 @@ public static void Delete(this IPolicyDefinitionsOperations operations, string p /// public static PolicyDefinition Get(this IPolicyDefinitionsOperations operations, string policyDefinitionName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyDefinitionsOperations)s).GetAsync(policyDefinitionName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(policyDefinitionName).GetAwaiter().GetResult(); } /// @@ -114,7 +119,7 @@ public static PolicyDefinition Get(this IPolicyDefinitionsOperations operations, /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IPolicyDefinitionsOperations operations, string policyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IPolicyDefinitionsOperations operations, string policyDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(policyDefinitionName, null, cancellationToken).ConfigureAwait(false)) { @@ -131,9 +136,9 @@ public static PolicyDefinition Get(this IPolicyDefinitionsOperations operations, /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage List(this IPolicyDefinitionsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage List(this IPolicyDefinitionsOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyDefinitionsOperations)s).ListAsync(odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -148,7 +153,7 @@ public static PolicyDefinition Get(this IPolicyDefinitionsOperations operations, /// /// The cancellation token. /// - public static async Task> ListAsync(this IPolicyDefinitionsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this IPolicyDefinitionsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -165,9 +170,9 @@ public static PolicyDefinition Get(this IPolicyDefinitionsOperations operations, /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this IPolicyDefinitionsOperations operations, string nextPageLink) + public static IPage ListNext(this IPolicyDefinitionsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IPolicyDefinitionsOperations)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(); } /// @@ -182,7 +187,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this IPolicy /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IPolicyDefinitionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this IPolicyDefinitionsOperations 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/PolicySetDefinitionsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicySetDefinitionsOperations.cs new file mode 100644 index 000000000000..2308f9164376 --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicySetDefinitionsOperations.cs @@ -0,0 +1,948 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager +{ + 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; + + /// + /// PolicySetDefinitionsOperations operations. + /// + internal partial class PolicySetDefinitionsOperations : IServiceOperations, IPolicySetDefinitionsOperations + { + /// + /// Initializes a new instance of the PolicySetDefinitionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PolicySetDefinitionsOperations(PolicyClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PolicyClient + /// + public PolicyClient Client { get; private set; } + + /// + /// Creates or updates a policy set definition. + /// + /// + /// The name of the policy set definition to create. + /// + /// + /// The policy set definition properties. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string policySetDefinitionName, PolicySetDefinition parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (policySetDefinitionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetDefinitionName"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("policySetDefinitionName", policySetDefinitionName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}").ToString(); + _url = _url.Replace("{policySetDefinitionName}", System.Uri.EscapeDataString(policySetDefinitionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _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 (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201 && (int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a policy set definition. + /// + /// + /// The name of the policy set definition to delete. + /// + /// + /// Headers that will be added to request. + /// + /// + /// 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 Task DeleteWithHttpMessagesAsync(string policySetDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (policySetDefinitionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetDefinitionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("policySetDefinitionName", policySetDefinitionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}").ToString(); + _url = _url.Replace("{policySetDefinitionName}", System.Uri.EscapeDataString(policySetDefinitionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 204 && (int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets the policy set definition. + /// + /// + /// The name of the policy set definition to get. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetWithHttpMessagesAsync(string policySetDefinitionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (policySetDefinitionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "policySetDefinitionName"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("policySetDefinitionName", policySetDefinitionName); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions/{policySetDefinitionName}").ToString(); + _url = _url.Replace("{policySetDefinitionName}", System.Uri.EscapeDataString(policySetDefinitionName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + string apiVersion = "2017-06-01-preview"; + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policysetdefinitions").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (apiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/PolicySetDefinitionsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicySetDefinitionsOperationsExtensions.cs new file mode 100644 index 000000000000..8fa05110bab6 --- /dev/null +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/PolicySetDefinitionsOperationsExtensions.cs @@ -0,0 +1,192 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceManager +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PolicySetDefinitionsOperations. + /// + public static partial class PolicySetDefinitionsOperationsExtensions + { + /// + /// Creates or updates a policy set definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the policy set definition to create. + /// + /// + /// The policy set definition properties. + /// + public static PolicySetDefinition CreateOrUpdate(this IPolicySetDefinitionsOperations operations, string policySetDefinitionName, PolicySetDefinition parameters) + { + return operations.CreateOrUpdateAsync(policySetDefinitionName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Creates or updates a policy set definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the policy set definition to create. + /// + /// + /// The policy set definition properties. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPolicySetDefinitionsOperations operations, string policySetDefinitionName, PolicySetDefinition parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(policySetDefinitionName, parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a policy set definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the policy set definition to delete. + /// + public static void Delete(this IPolicySetDefinitionsOperations operations, string policySetDefinitionName) + { + operations.DeleteAsync(policySetDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a policy set definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the policy set definition to delete. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPolicySetDefinitionsOperations operations, string policySetDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(policySetDefinitionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Gets the policy set definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the policy set definition to get. + /// + public static PolicySetDefinition Get(this IPolicySetDefinitionsOperations operations, string policySetDefinitionName) + { + return operations.GetAsync(policySetDefinitionName).GetAwaiter().GetResult(); + } + + /// + /// Gets the policy set definition. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the policy set definition to get. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPolicySetDefinitionsOperations operations, string policySetDefinitionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(policySetDefinitionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IPolicySetDefinitionsOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPolicySetDefinitionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IPolicySetDefinitionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets all the policy set definitions for a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IPolicySetDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ProvidersOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ProvidersOperations.cs index 6bbc3a3d1d64..757773397d80 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ProvidersOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ProvidersOperations.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; /// /// ProvidersOperations operations. /// - internal partial class ProvidersOperations : Microsoft.Rest.IServiceOperations, IProvidersOperations + internal partial class ProvidersOperations : IServiceOperations, IProvidersOperations { /// /// Initializes a new instance of the ProvidersOperations class. @@ -29,11 +38,11 @@ internal partial class ProvidersOperations : Microsoft.Rest.IServiceOperations internal ProvidersOperations(ResourceManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -53,75 +62,80 @@ internal ProvidersOperations(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> UnregisterWithHttpMessagesAsync(string resourceProviderNamespace, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> UnregisterWithHttpMessagesAsync(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, "Unregister", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Unregister", 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/{resourceProviderNamespace}/unregister").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("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) @@ -137,51 +151,51 @@ internal ProvidersOperations(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) @@ -191,7 +205,7 @@ internal ProvidersOperations(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")) @@ -204,21 +218,21 @@ internal ProvidersOperations(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; } @@ -235,75 +249,80 @@ internal ProvidersOperations(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> RegisterWithHttpMessagesAsync(string resourceProviderNamespace, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> RegisterWithHttpMessagesAsync(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, "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/{resourceProviderNamespace}/register").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("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) @@ -319,51 +338,51 @@ internal ProvidersOperations(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) @@ -373,7 +392,7 @@ internal ProvidersOperations(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")) @@ -386,21 +405,21 @@ internal ProvidersOperations(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; } @@ -423,79 +442,84 @@ internal ProvidersOperations(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(int? top = default(int?), string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(int? top = default(int?), string expand = default(string), 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("top", top); tracingParameters.Add("expand", expand); 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").ToString(); - _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 (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - 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) @@ -511,51 +535,51 @@ internal ProvidersOperations(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) @@ -565,7 +589,7 @@ internal ProvidersOperations(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")) @@ -578,21 +602,21 @@ internal ProvidersOperations(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; } @@ -613,80 +637,85 @@ internal ProvidersOperations(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 resourceProviderNamespace, string expand = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceProviderNamespace, string expand = default(string), 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("expand", expand); tracingParameters.Add("resourceProviderNamespace", resourceProviderNamespace); 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/{resourceProviderNamespace}").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(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); if (expand != null) { _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); } - 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) @@ -702,51 +731,51 @@ internal ProvidersOperations(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) @@ -756,7 +785,7 @@ internal ProvidersOperations(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")) @@ -769,21 +798,21 @@ internal ProvidersOperations(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; } @@ -800,61 +829,66 @@ internal ProvidersOperations(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) @@ -870,51 +904,51 @@ internal ProvidersOperations(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) @@ -924,7 +958,7 @@ internal ProvidersOperations(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")) @@ -937,21 +971,21 @@ internal ProvidersOperations(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/ProvidersOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ProvidersOperationsExtensions.cs index 47b968ddbddd..817cdd9fe274 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ProvidersOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ProvidersOperationsExtensions.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 ProvidersOperations. @@ -28,7 +32,7 @@ public static partial class ProvidersOperationsExtensions /// public static Provider Unregister(this IProvidersOperations operations, string resourceProviderNamespace) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IProvidersOperations)s).UnregisterAsync(resourceProviderNamespace), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.UnregisterAsync(resourceProviderNamespace).GetAwaiter().GetResult(); } /// @@ -43,7 +47,7 @@ public static Provider Unregister(this IProvidersOperations operations, string r /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task UnregisterAsync(this IProvidersOperations operations, string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task UnregisterAsync(this IProvidersOperations operations, string resourceProviderNamespace, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UnregisterWithHttpMessagesAsync(resourceProviderNamespace, null, cancellationToken).ConfigureAwait(false)) { @@ -62,7 +66,7 @@ public static Provider Unregister(this IProvidersOperations operations, string r /// public static Provider Register(this IProvidersOperations operations, string resourceProviderNamespace) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IProvidersOperations)s).RegisterAsync(resourceProviderNamespace), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.RegisterAsync(resourceProviderNamespace).GetAwaiter().GetResult(); } /// @@ -77,7 +81,7 @@ public static Provider Register(this IProvidersOperations operations, string res /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task RegisterAsync(this IProvidersOperations operations, string resourceProviderNamespace, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task RegisterAsync(this IProvidersOperations operations, string resourceProviderNamespace, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.RegisterWithHttpMessagesAsync(resourceProviderNamespace, null, cancellationToken).ConfigureAwait(false)) { @@ -100,9 +104,9 @@ public static Provider Register(this IProvidersOperations operations, string res /// metadata. To include property aliases in response, use /// $expand=resourceTypes/aliases. /// - public static Microsoft.Rest.Azure.IPage List(this IProvidersOperations operations, int? top = default(int?), string expand = default(string)) + public static IPage List(this IProvidersOperations operations, int? top = default(int?), string expand = default(string)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IProvidersOperations)s).ListAsync(top, expand), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync(top, expand).GetAwaiter().GetResult(); } /// @@ -123,7 +127,7 @@ public static Provider Register(this IProvidersOperations operations, string res /// /// The cancellation token. /// - public static async Task> ListAsync(this IProvidersOperations operations, int? top = default(int?), string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this IProvidersOperations operations, int? top = default(int?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(top, expand, null, cancellationToken).ConfigureAwait(false)) { @@ -146,7 +150,7 @@ public static Provider Register(this IProvidersOperations operations, string res /// public static Provider Get(this IProvidersOperations operations, string resourceProviderNamespace, string expand = default(string)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IProvidersOperations)s).GetAsync(resourceProviderNamespace, expand), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(resourceProviderNamespace, expand).GetAwaiter().GetResult(); } /// @@ -165,7 +169,7 @@ public static Provider Register(this IProvidersOperations operations, string res /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IProvidersOperations operations, string resourceProviderNamespace, string expand = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IProvidersOperations operations, string resourceProviderNamespace, string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceProviderNamespace, expand, null, cancellationToken).ConfigureAwait(false)) { @@ -182,9 +186,9 @@ public static Provider Register(this IProvidersOperations operations, string res /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this IProvidersOperations operations, string nextPageLink) + public static IPage ListNext(this IProvidersOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IProvidersOperations)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(); } /// @@ -199,7 +203,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this IProvidersOpera /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IProvidersOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this IProvidersOperations 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/ResourceGroupsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceGroupsOperations.cs index cef21d8964ba..d86a07d39ae2 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceGroupsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceGroupsOperations.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; /// /// ResourceGroupsOperations operations. /// - internal partial class ResourceGroupsOperations : Microsoft.Rest.IServiceOperations, IResourceGroupsOperations + internal partial class ResourceGroupsOperations : IServiceOperations, IResourceGroupsOperations { /// /// Initializes a new instance of the ResourceGroupsOperations class. @@ -29,11 +39,11 @@ internal partial class ResourceGroupsOperations : Microsoft.Rest.IServiceOperati /// internal ResourceGroupsOperations(ResourceManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -53,87 +63,92 @@ internal ResourceGroupsOperations(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, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, 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("resourceGroupName", resourceGroupName); 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}").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(); - 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) @@ -149,51 +164,51 @@ internal ResourceGroupsOperations(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) @@ -203,17 +218,17 @@ internal ResourceGroupsOperations(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; } @@ -233,99 +248,104 @@ internal ResourceGroupsOperations(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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroup parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroup 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 (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("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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}").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(); - 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) @@ -342,56 +362,56 @@ internal ResourceGroupsOperations(ResourceManagementClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 201 && (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) @@ -401,7 +421,7 @@ internal ResourceGroupsOperations(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")) @@ -414,16 +434,16 @@ internal ResourceGroupsOperations(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 @@ -432,21 +452,21 @@ internal ResourceGroupsOperations(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; } @@ -468,12 +488,11 @@ internal ResourceGroupsOperations(ResourceManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync( - resourceGroupName, customHeaders, cancellationToken); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -488,90 +507,95 @@ internal ResourceGroupsOperations(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, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, 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("resourceGroupName", resourceGroupName); 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}").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(); - 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) @@ -587,51 +611,51 @@ internal ResourceGroupsOperations(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) @@ -641,7 +665,7 @@ internal ResourceGroupsOperations(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")) @@ -654,21 +678,21 @@ internal ResourceGroupsOperations(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; } @@ -693,95 +717,100 @@ internal ResourceGroupsOperations(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> UpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroupPatchable parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, ResourceGroupPatchable 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 (parameters == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - 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("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", 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}").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(); - 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("PATCH"); + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("PATCH"); _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) @@ -798,56 +827,56 @@ internal ResourceGroupsOperations(ResourceManagementClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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) { - 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) @@ -857,7 +886,7 @@ internal ResourceGroupsOperations(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")) @@ -870,21 +899,21 @@ internal ResourceGroupsOperations(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; } @@ -904,95 +933,100 @@ internal ResourceGroupsOperations(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, ExportTemplateRequest parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> ExportTemplateWithHttpMessagesAsync(string resourceGroupName, ExportTemplateRequest 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 (parameters == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - 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("parameters", parameters); 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}/exportTemplate").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(); - 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) @@ -1009,56 +1043,56 @@ internal ResourceGroupsOperations(ResourceManagementClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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) { - 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) @@ -1068,7 +1102,7 @@ internal ResourceGroupsOperations(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")) @@ -1081,21 +1115,21 @@ internal ResourceGroupsOperations(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; } @@ -1112,78 +1146,83 @@ internal ResourceGroupsOperations(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(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>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), 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("odataQuery", odataQuery); 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").ToString(); - _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) @@ -1199,51 +1238,51 @@ internal ResourceGroupsOperations(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) @@ -1253,7 +1292,7 @@ internal ResourceGroupsOperations(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")) @@ -1266,21 +1305,21 @@ internal ResourceGroupsOperations(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; } @@ -1302,87 +1341,92 @@ internal ResourceGroupsOperations(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, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, 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("resourceGroupName", resourceGroupName); 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}").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(); - 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) @@ -1398,43 +1442,51 @@ internal ResourceGroupsOperations(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 != 200) { - 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) @@ -1444,7 +1496,7 @@ internal ResourceGroupsOperations(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")) @@ -1453,7 +1505,7 @@ internal ResourceGroupsOperations(ResourceManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -1470,61 +1522,66 @@ internal ResourceGroupsOperations(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) @@ -1540,51 +1597,51 @@ internal ResourceGroupsOperations(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) @@ -1594,7 +1651,7 @@ internal ResourceGroupsOperations(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")) @@ -1607,21 +1664,21 @@ internal ResourceGroupsOperations(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/ResourceGroupsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceGroupsOperationsExtensions.cs index 750224505efb..6d8a7d3a13f8 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceGroupsOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceGroupsOperationsExtensions.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 ResourceGroupsOperations. @@ -28,7 +33,7 @@ public static partial class ResourceGroupsOperationsExtensions /// public static bool CheckExistence(this IResourceGroupsOperations operations, string resourceGroupName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).CheckExistenceAsync(resourceGroupName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CheckExistenceAsync(resourceGroupName).GetAwaiter().GetResult(); } /// @@ -43,7 +48,7 @@ public static bool CheckExistence(this IResourceGroupsOperations operations, str /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CheckExistenceAsync(this IResourceGroupsOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CheckExistenceAsync(this IResourceGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CheckExistenceWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -65,7 +70,7 @@ public static bool CheckExistence(this IResourceGroupsOperations operations, str /// public static ResourceGroup CreateOrUpdate(this IResourceGroupsOperations operations, string resourceGroupName, ResourceGroup parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).CreateOrUpdateAsync(resourceGroupName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, parameters).GetAwaiter().GetResult(); } /// @@ -83,7 +88,7 @@ public static ResourceGroup CreateOrUpdate(this IResourceGroupsOperations operat /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IResourceGroupsOperations operations, string resourceGroupName, ResourceGroup parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this IResourceGroupsOperations operations, string resourceGroupName, ResourceGroup parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -107,7 +112,7 @@ public static ResourceGroup CreateOrUpdate(this IResourceGroupsOperations operat /// public static void Delete(this IResourceGroupsOperations operations, string resourceGroupName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).DeleteAsync(resourceGroupName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName).GetAwaiter().GetResult(); } /// @@ -127,9 +132,9 @@ public static void Delete(this IResourceGroupsOperations operations, string reso /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this IResourceGroupsOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this IResourceGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -143,7 +148,7 @@ public static void Delete(this IResourceGroupsOperations operations, string reso /// public static ResourceGroup Get(this IResourceGroupsOperations operations, string resourceGroupName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).GetAsync(resourceGroupName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName).GetAwaiter().GetResult(); } /// @@ -158,7 +163,7 @@ public static ResourceGroup Get(this IResourceGroupsOperations operations, strin /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IResourceGroupsOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IResourceGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -185,7 +190,7 @@ public static ResourceGroup Get(this IResourceGroupsOperations operations, strin /// public static ResourceGroup Update(this IResourceGroupsOperations operations, string resourceGroupName, ResourceGroupPatchable parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).UpdateAsync(resourceGroupName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, parameters).GetAwaiter().GetResult(); } /// @@ -208,7 +213,7 @@ public static ResourceGroup Update(this IResourceGroupsOperations operations, st /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task UpdateAsync(this IResourceGroupsOperations operations, string resourceGroupName, ResourceGroupPatchable parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task UpdateAsync(this IResourceGroupsOperations operations, string resourceGroupName, ResourceGroupPatchable parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -230,7 +235,7 @@ public static ResourceGroup Update(this IResourceGroupsOperations operations, st /// public static ResourceGroupExportResult ExportTemplate(this IResourceGroupsOperations operations, string resourceGroupName, ExportTemplateRequest parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).ExportTemplateAsync(resourceGroupName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ExportTemplateAsync(resourceGroupName, parameters).GetAwaiter().GetResult(); } /// @@ -248,7 +253,7 @@ public static ResourceGroupExportResult ExportTemplate(this IResourceGroupsOpera /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task ExportTemplateAsync(this IResourceGroupsOperations operations, string resourceGroupName, ExportTemplateRequest parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task ExportTemplateAsync(this IResourceGroupsOperations operations, string resourceGroupName, ExportTemplateRequest parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ExportTemplateWithHttpMessagesAsync(resourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -265,9 +270,9 @@ public static ResourceGroupExportResult ExportTemplate(this IResourceGroupsOpera /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage List(this IResourceGroupsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage List(this IResourceGroupsOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).ListAsync(odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -282,7 +287,7 @@ public static ResourceGroupExportResult ExportTemplate(this IResourceGroupsOpera /// /// The cancellation token. /// - public static async Task> ListAsync(this IResourceGroupsOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this IResourceGroupsOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -306,7 +311,7 @@ public static ResourceGroupExportResult ExportTemplate(this IResourceGroupsOpera /// public static void BeginDelete(this IResourceGroupsOperations operations, string resourceGroupName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)s).BeginDeleteAsync(resourceGroupName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName).GetAwaiter().GetResult(); } /// @@ -326,9 +331,9 @@ public static void BeginDelete(this IResourceGroupsOperations operations, string /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginDeleteAsync(this IResourceGroupsOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task BeginDeleteAsync(this IResourceGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -340,9 +345,9 @@ public static void BeginDelete(this IResourceGroupsOperations operations, string /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this IResourceGroupsOperations operations, string nextPageLink) + public static IPage ListNext(this IResourceGroupsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceGroupsOperations)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(); } /// @@ -357,7 +362,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this IResourceG /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IResourceGroupsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this IResourceGroupsOperations 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/ResourceLinksOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceLinksOperations.cs index de48caa6ca2a..689c836c8ca2 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceLinksOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceLinksOperations.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; /// /// ResourceLinksOperations operations. /// - internal partial class ResourceLinksOperations : Microsoft.Rest.IServiceOperations, IResourceLinksOperations + internal partial class ResourceLinksOperations : IServiceOperations, IResourceLinksOperations { /// /// Initializes a new instance of the ResourceLinksOperations class. @@ -29,11 +39,11 @@ internal partial class ResourceLinksOperations : Microsoft.Rest.IServiceOperatio /// internal ResourceLinksOperations(ManagementLinkClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -56,67 +66,72 @@ internal ResourceLinksOperations(ManagementLinkClient 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 DeleteWithHttpMessagesAsync(string linkId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (linkId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); } - 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"); } // 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("linkId", linkId); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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("/") ? "" : "/")), "{linkId}").ToString(); _url = _url.Replace("{linkId}", linkId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -132,43 +147,51 @@ internal ResourceLinksOperations(ManagementLinkClient 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 && (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) @@ -178,7 +201,7 @@ internal ResourceLinksOperations(ManagementLinkClient 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")) @@ -187,7 +210,7 @@ internal ResourceLinksOperations(ManagementLinkClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -210,79 +233,84 @@ internal ResourceLinksOperations(ManagementLinkClient 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> CreateOrUpdateWithHttpMessagesAsync(string linkId, ResourceLink parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string linkId, ResourceLink parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (linkId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); } 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"); } // 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("linkId", linkId); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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("/") ? "" : "/")), "{linkId}").ToString(); _url = _url.Replace("{linkId}", linkId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -299,56 +327,56 @@ internal ResourceLinksOperations(ManagementLinkClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 201 && (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) @@ -358,7 +386,7 @@ internal ResourceLinksOperations(ManagementLinkClient 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")) @@ -371,16 +399,16 @@ internal ResourceLinksOperations(ManagementLinkClient 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 @@ -389,21 +417,21 @@ internal ResourceLinksOperations(ManagementLinkClient 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; } @@ -421,70 +449,75 @@ internal ResourceLinksOperations(ManagementLinkClient 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 linkId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string linkId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (linkId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "linkId"); + throw new ValidationException(ValidationRules.CannotBeNull, "linkId"); } - 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"); } // 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("linkId", linkId); 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("/") ? "" : "/")), "{linkId}").ToString(); _url = _url.Replace("{linkId}", linkId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -500,51 +533,51 @@ internal ResourceLinksOperations(ManagementLinkClient 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) @@ -554,7 +587,7 @@ internal ResourceLinksOperations(ManagementLinkClient 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")) @@ -567,21 +600,21 @@ internal ResourceLinksOperations(ManagementLinkClient 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; } @@ -598,78 +631,83 @@ internal ResourceLinksOperations(ManagementLinkClient 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>> ListAtSubscriptionWithHttpMessagesAsync(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>> ListAtSubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), 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("odataQuery", odataQuery); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscription", 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.Resources/links").ToString(); - _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) @@ -685,51 +723,51 @@ internal ResourceLinksOperations(ManagementLinkClient 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) @@ -739,7 +777,7 @@ internal ResourceLinksOperations(ManagementLinkClient 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")) @@ -752,21 +790,21 @@ internal ResourceLinksOperations(ManagementLinkClient 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; } @@ -789,79 +827,84 @@ internal ResourceLinksOperations(ManagementLinkClient 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>> ListAtSourceScopeWithHttpMessagesAsync(string scope, 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>> ListAtSourceScopeWithHttpMessagesAsync(string scope, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (scope == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "scope"); + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); } - 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"); } // 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("scope", scope); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListAtSourceScope", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtSourceScope", 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("/") ? "" : "/")), "{scope}/providers/Microsoft.Resources/links").ToString(); _url = _url.Replace("{scope}", scope); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + 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) @@ -877,51 +920,51 @@ internal ResourceLinksOperations(ManagementLinkClient 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) @@ -931,7 +974,7 @@ internal ResourceLinksOperations(ManagementLinkClient 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")) @@ -944,21 +987,21 @@ internal ResourceLinksOperations(ManagementLinkClient 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; } @@ -975,61 +1018,66 @@ internal ResourceLinksOperations(ManagementLinkClient 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>> ListAtSubscriptionNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListAtSubscriptionNextWithHttpMessagesAsync(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, "ListAtSubscriptionNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtSubscriptionNext", 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) @@ -1045,51 +1093,51 @@ internal ResourceLinksOperations(ManagementLinkClient 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) @@ -1099,7 +1147,7 @@ internal ResourceLinksOperations(ManagementLinkClient 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")) @@ -1112,21 +1160,21 @@ internal ResourceLinksOperations(ManagementLinkClient 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; } @@ -1143,61 +1191,66 @@ internal ResourceLinksOperations(ManagementLinkClient 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>> ListAtSourceScopeNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListAtSourceScopeNextWithHttpMessagesAsync(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, "ListAtSourceScopeNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListAtSourceScopeNext", 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) @@ -1213,51 +1266,51 @@ internal ResourceLinksOperations(ManagementLinkClient 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) @@ -1267,7 +1320,7 @@ internal ResourceLinksOperations(ManagementLinkClient 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")) @@ -1280,21 +1333,21 @@ internal ResourceLinksOperations(ManagementLinkClient 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/ResourceLinksOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceLinksOperationsExtensions.cs index d86ec9f7e685..0f8d42239e7c 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceLinksOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceLinksOperationsExtensions.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 ResourceLinksOperations. @@ -31,7 +36,7 @@ public static partial class ResourceLinksOperationsExtensions /// public static void Delete(this IResourceLinksOperations operations, string linkId) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceLinksOperations)s).DeleteAsync(linkId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(linkId).GetAwaiter().GetResult(); } /// @@ -49,9 +54,9 @@ public static void Delete(this IResourceLinksOperations operations, string linkI /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this IResourceLinksOperations operations, string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this IResourceLinksOperations operations, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(linkId, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(linkId, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -71,7 +76,7 @@ public static void Delete(this IResourceLinksOperations operations, string linkI /// public static ResourceLink CreateOrUpdate(this IResourceLinksOperations operations, string linkId, ResourceLink parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceLinksOperations)s).CreateOrUpdateAsync(linkId, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(linkId, parameters).GetAwaiter().GetResult(); } /// @@ -92,7 +97,7 @@ public static ResourceLink CreateOrUpdate(this IResourceLinksOperations operatio /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IResourceLinksOperations operations, string linkId, ResourceLink parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this IResourceLinksOperations operations, string linkId, ResourceLink parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(linkId, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -112,7 +117,7 @@ public static ResourceLink CreateOrUpdate(this IResourceLinksOperations operatio /// public static ResourceLink Get(this IResourceLinksOperations operations, string linkId) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceLinksOperations)s).GetAsync(linkId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(linkId).GetAwaiter().GetResult(); } /// @@ -128,7 +133,7 @@ public static ResourceLink Get(this IResourceLinksOperations operations, string /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IResourceLinksOperations operations, string linkId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IResourceLinksOperations operations, string linkId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(linkId, null, cancellationToken).ConfigureAwait(false)) { @@ -145,9 +150,9 @@ public static ResourceLink Get(this IResourceLinksOperations operations, string /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage ListAtSubscription(this IResourceLinksOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage ListAtSubscription(this IResourceLinksOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceLinksOperations)s).ListAtSubscriptionAsync(odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtSubscriptionAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -162,7 +167,7 @@ public static ResourceLink Get(this IResourceLinksOperations operations, string /// /// The cancellation token. /// - public static async Task> ListAtSubscriptionAsync(this IResourceLinksOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtSubscriptionAsync(this IResourceLinksOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -185,9 +190,9 @@ public static ResourceLink Get(this IResourceLinksOperations operations, string /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage ListAtSourceScope(this IResourceLinksOperations operations, string scope, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage ListAtSourceScope(this IResourceLinksOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceLinksOperations)s).ListAtSourceScopeAsync(scope, odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtSourceScopeAsync(scope, odataQuery).GetAwaiter().GetResult(); } /// @@ -208,7 +213,7 @@ public static ResourceLink Get(this IResourceLinksOperations operations, string /// /// The cancellation token. /// - public static async Task> ListAtSourceScopeAsync(this IResourceLinksOperations operations, string scope, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtSourceScopeAsync(this IResourceLinksOperations operations, string scope, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSourceScopeWithHttpMessagesAsync(scope, odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -225,9 +230,9 @@ public static ResourceLink Get(this IResourceLinksOperations operations, string /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListAtSubscriptionNext(this IResourceLinksOperations operations, string nextPageLink) + public static IPage ListAtSubscriptionNext(this IResourceLinksOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceLinksOperations)s).ListAtSubscriptionNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtSubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -242,7 +247,7 @@ public static Microsoft.Rest.Azure.IPage ListAtSubscriptionNext(th /// /// The cancellation token. /// - public static async Task> ListAtSubscriptionNextAsync(this IResourceLinksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtSubscriptionNextAsync(this IResourceLinksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -259,9 +264,9 @@ public static Microsoft.Rest.Azure.IPage ListAtSubscriptionNext(th /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListAtSourceScopeNext(this IResourceLinksOperations operations, string nextPageLink) + public static IPage ListAtSourceScopeNext(this IResourceLinksOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourceLinksOperations)s).ListAtSourceScopeNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAtSourceScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -276,7 +281,7 @@ public static Microsoft.Rest.Azure.IPage ListAtSourceScopeNext(thi /// /// The cancellation token. /// - public static async Task> ListAtSourceScopeNextAsync(this IResourceLinksOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAtSourceScopeNextAsync(this IResourceLinksOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAtSourceScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { diff --git a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceManagementClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceManagementClient.cs index ccdefde0c363..72dfe14424c1 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceManagementClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourceManagementClient.cs @@ -1,22 +1,30 @@ +// // 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; /// /// Provides operations for working with resources and resource groups. /// - public partial class ResourceManagementClient : Microsoft.Rest.ServiceClient, IResourceManagementClient, IAzureClient + public partial class ResourceManagementClient : ServiceClient, IResourceManagementClient, IAzureClient { /// /// The base URI of the service. @@ -26,17 +34,17 @@ public partial class ResourceManagementClient : 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. @@ -101,9 +109,9 @@ public partial class ResourceManagementClient : Microsoft.Rest.ServiceClient /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ResourceManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + protected ResourceManagementClient(params DelegatingHandler[] handlers) : base(handlers) { - this.Initialize(); + Initialize(); } /// @@ -115,9 +123,9 @@ protected ResourceManagementClient(params System.Net.Http.DelegatingHandler[] ha /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected ResourceManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected ResourceManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { - this.Initialize(); + Initialize(); } /// @@ -132,13 +140,13 @@ protected ResourceManagementClient(System.Net.Http.HttpClientHandler rootHandler /// /// Thrown when a required parameter is null /// - protected ResourceManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + protected ResourceManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -156,13 +164,13 @@ protected ResourceManagementClient(System.Uri baseUri, params System.Net.Http.De /// /// Thrown when a required parameter is null /// - protected ResourceManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected ResourceManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -177,16 +185,16 @@ protected ResourceManagementClient(System.Uri baseUri, System.Net.Http.HttpClien /// /// Thrown when a required parameter is null /// - public ResourceManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public ResourceManagementClient(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); } } @@ -205,16 +213,16 @@ public ResourceManagementClient(Microsoft.Rest.ServiceClientCredentials credenti /// /// Thrown when a required parameter is null /// - public ResourceManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ResourceManagementClient(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); } } @@ -233,7 +241,7 @@ public ResourceManagementClient(Microsoft.Rest.ServiceClientCredentials credenti /// /// Thrown when a required parameter is null /// - public ResourceManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public ResourceManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -243,11 +251,11 @@ public ResourceManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClient { 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); } } @@ -269,7 +277,7 @@ public ResourceManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClient /// /// Thrown when a required parameter is null /// - public ResourceManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public ResourceManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -279,11 +287,11 @@ public ResourceManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClient { 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); } } @@ -296,44 +304,44 @@ public ResourceManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClient /// private void Initialize() { - this.Deployments = new DeploymentsOperations(this); - this.Providers = new ProvidersOperations(this); - this.Resources = new ResourcesOperations(this); - this.ResourceGroups = new ResourceGroupsOperations(this); - this.Tags = new TagsOperations(this); - this.DeploymentOperations = new DeploymentOperations(this); - this.BaseUri = new System.Uri("https://management.azure.com"); - this.ApiVersion = "2017-05-10"; - this.AcceptLanguage = "en-US"; - this.LongRunningOperationRetryTimeout = 30; - this.GenerateClientRequestId = true; - SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + Deployments = new DeploymentsOperations(this); + Providers = new ProvidersOperations(this); + Resources = new ResourcesOperations(this); + ResourceGroups = new ResourceGroupsOperations(this); + Tags = new TagsOperations(this); + DeploymentOperations = new DeploymentOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2017-05-10"; + 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/ResourcesOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourcesOperations.cs index 71263a6c4759..2093b8bc547e 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourcesOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourcesOperations.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; /// /// ResourcesOperations operations. /// - internal partial class ResourcesOperations : Microsoft.Rest.IServiceOperations, IResourcesOperations + internal partial class ResourcesOperations : IServiceOperations, IResourcesOperations { /// /// Initializes a new instance of the ResourcesOperations class. @@ -29,11 +39,11 @@ internal partial class ResourcesOperations : Microsoft.Rest.IServiceOperations internal ResourcesOperations(ResourceManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -56,99 +66,104 @@ internal ResourcesOperations(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}/resources").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) @@ -164,51 +179,51 @@ internal ResourcesOperations(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) @@ -218,7 +233,7 @@ internal ResourcesOperations(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")) @@ -231,21 +246,21 @@ internal ResourcesOperations(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; } @@ -254,14 +269,14 @@ internal ResourcesOperations(ResourceManagementClient client) /// Moves resources from one resource group to another resource group. /// /// - /// The resources to move must be in the same source resource group. The - /// target resource group may be in a different subscription. When moving - /// resources, both the source group and the target group are locked for the - /// duration of the operation. Write and delete operations are blocked on the - /// groups until the move completes. + /// The resources to move must be in the same source resource group. The target + /// resource group may be in a different subscription. When moving resources, + /// both the source group and the target group are locked for the duration of + /// the operation. Write and delete operations are blocked on the groups until + /// the move completes. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to move. /// /// /// Parameters for moving resources. @@ -272,12 +287,44 @@ internal ResourcesOperations(ResourceManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task MoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task MoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginMoveResourcesWithHttpMessagesAsync( - sourceResourceGroupName, parameters, customHeaders, cancellationToken); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); + AzureOperationResponse _response = await BeginMoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Validates whether resources can be moved from one resource group to another + /// resource group. + /// + /// + /// This operation checks whether the specified resources can be moved to the + /// target. The resources to move must be in the same source resource group. + /// The target resource group may be in a different subscription. If validation + /// succeeds, it returns HTTP response code 204 (no content). If validation + /// fails, it returns HTTP response code 409 (Conflict) with an error message. + /// Retrieve the URL in the Location header value to check the result of the + /// long-running operation. + /// + /// + /// The name of the resource group containing the resources to validate for + /// move. + /// + /// + /// Parameters for moving resources. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task ValidateMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginValidateMoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -292,78 +339,83 @@ internal ResourcesOperations(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(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>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), 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("odataQuery", odataQuery); 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}/resources").ToString(); - _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) @@ -379,51 +431,51 @@ internal ResourcesOperations(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) @@ -433,7 +485,7 @@ internal ResourcesOperations(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")) @@ -446,21 +498,21 @@ internal ResourcesOperations(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; } @@ -493,67 +545,70 @@ internal ResourcesOperations(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 resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CheckExistenceWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); @@ -561,18 +616,18 @@ internal ResourcesOperations(ResourceManagementClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("apiVersion", apiVersion); 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); _url = _url.Replace("{parentResourcePath}", parentResourcePath); _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _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 (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -582,23 +637,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -614,51 +671,51 @@ internal ResourcesOperations(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) @@ -668,17 +725,17 @@ internal ResourcesOperations(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; } @@ -711,12 +768,11 @@ internal ResourcesOperations(ResourceManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync( - resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, customHeaders, cancellationToken); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -750,14 +806,11 @@ internal ResourcesOperations(ResourceManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync( - resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, customHeaders, cancellationToken); - return await this.Client.GetPutOrPatchOperationResultAsync(_response, - customHeaders, - cancellationToken); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -788,70 +841,73 @@ internal ResourcesOperations(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 resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); @@ -859,18 +915,18 @@ internal ResourcesOperations(ResourceManagementClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("apiVersion", apiVersion); 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); _url = _url.Replace("{parentResourcePath}", parentResourcePath); _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _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 (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -880,23 +936,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -912,51 +970,51 @@ internal ResourcesOperations(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) @@ -966,7 +1024,7 @@ internal ResourcesOperations(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")) @@ -979,21 +1037,21 @@ internal ResourcesOperations(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; } @@ -1015,42 +1073,45 @@ internal ResourcesOperations(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> CheckExistenceByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CheckExistenceByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceId"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); } // 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("resourceId", resourceId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CheckExistenceById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CheckExistenceById", 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("/") ? "" : "/")), "{resourceId}").ToString(); _url = _url.Replace("{resourceId}", resourceId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + List _queryParameters = new List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1060,23 +1121,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -1092,51 +1155,51 @@ internal ResourcesOperations(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) @@ -1146,17 +1209,17 @@ internal ResourcesOperations(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; } @@ -1178,12 +1241,11 @@ internal ResourcesOperations(ResourceManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task DeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteByIdWithHttpMessagesAsync( - resourceId, apiVersion, customHeaders, cancellationToken); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); + AzureOperationResponse _response = await BeginDeleteByIdWithHttpMessagesAsync(resourceId, apiVersion, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1206,14 +1268,11 @@ internal ResourcesOperations(ResourceManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> CreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateByIdWithHttpMessagesAsync( - resourceId, apiVersion, parameters, customHeaders, cancellationToken); - return await this.Client.GetPutOrPatchOperationResultAsync(_response, - customHeaders, - cancellationToken); + AzureOperationResponse _response = await BeginCreateOrUpdateByIdWithHttpMessagesAsync(resourceId, apiVersion, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1233,45 +1292,48 @@ internal ResourcesOperations(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> GetByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceId"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); } // 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("resourceId", resourceId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetById", 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("/") ? "" : "/")), "{resourceId}").ToString(); _url = _url.Replace("{resourceId}", resourceId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + List _queryParameters = new List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1281,23 +1343,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -1313,51 +1377,51 @@ internal ResourcesOperations(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) @@ -1367,7 +1431,7 @@ internal ResourcesOperations(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")) @@ -1380,21 +1444,21 @@ internal ResourcesOperations(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; } @@ -1403,14 +1467,14 @@ internal ResourcesOperations(ResourceManagementClient client) /// Moves resources from one resource group to another resource group. /// /// - /// The resources to move must be in the same source resource group. The - /// target resource group may be in a different subscription. When moving - /// resources, both the source group and the target group are locked for the - /// duration of the operation. Write and delete operations are blocked on the - /// groups until the move completes. + /// The resources to move must be in the same source resource group. The target + /// resource group may be in a different subscription. When moving resources, + /// both the source group and the target group are locked for the duration of + /// the operation. Write and delete operations are blocked on the groups until + /// the move completes. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to move. /// /// /// Parameters for moving resources. @@ -1421,92 +1485,97 @@ internal ResourcesOperations(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 BeginMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task BeginMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (sourceResourceGroupName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "sourceResourceGroupName"); + throw new ValidationException(ValidationRules.CannotBeNull, "sourceResourceGroupName"); } if (sourceResourceGroupName != null) { if (sourceResourceGroupName.Length > 90) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "sourceResourceGroupName", 90); + throw new ValidationException(ValidationRules.MaxLength, "sourceResourceGroupName", 90); } if (sourceResourceGroupName.Length < 1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "sourceResourceGroupName", 1); + throw new ValidationException(ValidationRules.MinLength, "sourceResourceGroupName", 1); } if (!System.Text.RegularExpressions.Regex.IsMatch(sourceResourceGroupName, "^[-\\w\\._\\(\\)]+$")) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "sourceResourceGroupName", "^[-\\w\\._\\(\\)]+$"); + throw new ValidationException(ValidationRules.Pattern, "sourceResourceGroupName", "^[-\\w\\._\\(\\)]+$"); } } if (parameters == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } - 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("sourceResourceGroupName", sourceResourceGroupName); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginMoveResources", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginMoveResources", 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/{sourceResourceGroupName}/moveResources").ToString(); _url = _url.Replace("{sourceResourceGroupName}", System.Uri.EscapeDataString(sourceResourceGroupName)); - _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) @@ -1523,48 +1592,56 @@ internal ResourcesOperations(ResourceManagementClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 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) @@ -1574,7 +1651,7 @@ internal ResourcesOperations(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")) @@ -1583,7 +1660,213 @@ internal ResourcesOperations(ResourceManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Validates whether resources can be moved from one resource group to another + /// resource group. + /// + /// + /// This operation checks whether the specified resources can be moved to the + /// target. The resources to move must be in the same source resource group. + /// The target resource group may be in a different subscription. If validation + /// succeeds, it returns HTTP response code 204 (no content). If validation + /// fails, it returns HTTP response code 409 (Conflict) with an error message. + /// Retrieve the URL in the Location header value to check the result of the + /// long-running operation. + /// + /// + /// The name of the resource group containing the resources to validate for + /// move. + /// + /// + /// Parameters for moving resources. + /// + /// + /// Headers that will be added to request. + /// + /// + /// 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 Task BeginValidateMoveResourcesWithHttpMessagesAsync(string sourceResourceGroupName, ResourcesMoveInfo parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (sourceResourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "sourceResourceGroupName"); + } + if (sourceResourceGroupName != null) + { + if (sourceResourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "sourceResourceGroupName", 90); + } + if (sourceResourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "sourceResourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(sourceResourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "sourceResourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("sourceResourceGroupName", sourceResourceGroupName); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginValidateMoveResources", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources").ToString(); + _url = _url.Replace("{sourceResourceGroupName}", System.Uri.EscapeDataString(sourceResourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _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 (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204 && (int)_statusCode != 409) + { + 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; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -1616,67 +1899,70 @@ internal ResourcesOperations(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 resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); @@ -1684,18 +1970,18 @@ internal ResourcesOperations(ResourceManagementClient client) tracingParameters.Add("resourceName", resourceName); tracingParameters.Add("apiVersion", apiVersion); 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); _url = _url.Replace("{parentResourcePath}", parentResourcePath); _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _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 (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1705,23 +1991,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -1737,43 +2025,51 @@ internal ResourcesOperations(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 && (int)_statusCode != 204 && (int)_statusCode != 202) { - 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) @@ -1783,7 +2079,7 @@ internal ResourcesOperations(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")) @@ -1792,7 +2088,7 @@ internal ResourcesOperations(ResourceManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -1828,78 +2124,81 @@ internal ResourcesOperations(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 resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource 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 (resourceProviderNamespace == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceProviderNamespace"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceProviderNamespace"); } if (parentResourcePath == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parentResourcePath"); + throw new ValidationException(ValidationRules.CannotBeNull, "parentResourcePath"); } if (resourceType == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceType"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceType"); } if (resourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); } 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.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("resourceProviderNamespace", resourceProviderNamespace); tracingParameters.Add("parentResourcePath", parentResourcePath); @@ -1908,18 +2207,18 @@ internal ResourcesOperations(ResourceManagementClient client) tracingParameters.Add("apiVersion", apiVersion); 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/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceProviderNamespace}", System.Uri.EscapeDataString(resourceProviderNamespace)); _url = _url.Replace("{parentResourcePath}", parentResourcePath); _url = _url.Replace("{resourceType}", resourceType); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); - _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 (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -1929,23 +2228,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -1962,56 +2263,56 @@ internal ResourcesOperations(ResourceManagementClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 201 && (int)_statusCode != 200 && (int)_statusCode != 202) { - 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) @@ -2021,7 +2322,7 @@ internal ResourcesOperations(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")) @@ -2034,16 +2335,16 @@ internal ResourcesOperations(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 @@ -2052,21 +2353,21 @@ internal ResourcesOperations(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; } @@ -2088,42 +2389,45 @@ internal ResourcesOperations(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 BeginDeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task BeginDeleteByIdWithHttpMessagesAsync(string resourceId, string apiVersion, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceId"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); } // 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("resourceId", resourceId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginDeleteById", 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("/") ? "" : "/")), "{resourceId}").ToString(); _url = _url.Replace("{resourceId}", resourceId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + List _queryParameters = new List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -2133,23 +2437,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -2165,43 +2471,51 @@ internal ResourcesOperations(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 && (int)_statusCode != 204 && (int)_statusCode != 202) { - 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) @@ -2211,7 +2525,7 @@ internal ResourcesOperations(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")) @@ -2220,7 +2534,7 @@ internal ResourcesOperations(ResourceManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -2245,54 +2559,57 @@ internal ResourcesOperations(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> BeginCreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> BeginCreateOrUpdateByIdWithHttpMessagesAsync(string resourceId, string apiVersion, GenericResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceId"); + throw new ValidationException(ValidationRules.CannotBeNull, "resourceId"); } if (apiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "apiVersion"); + throw new ValidationException(ValidationRules.CannotBeNull, "apiVersion"); } if (parameters == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); } if (parameters != null) { parameters.Validate(); } // 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("resourceId", resourceId); tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateById", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdateById", 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("/") ? "" : "/")), "{resourceId}").ToString(); _url = _url.Replace("{resourceId}", resourceId); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + List _queryParameters = new List(); if (apiVersion != null) { _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); @@ -2302,23 +2619,25 @@ internal ResourcesOperations(ResourceManagementClient client) _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) @@ -2335,56 +2654,56 @@ internal ResourcesOperations(ResourceManagementClient client) string _requestContent = null; if(parameters != null) { - _requestContent = Microsoft.Rest.Serialization.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 != 201 && (int)_statusCode != 200 && (int)_statusCode != 202) { - 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) @@ -2394,7 +2713,7 @@ internal ResourcesOperations(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")) @@ -2407,16 +2726,16 @@ internal ResourcesOperations(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 @@ -2425,21 +2744,21 @@ internal ResourcesOperations(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; } @@ -2456,61 +2775,66 @@ internal ResourcesOperations(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) @@ -2526,51 +2850,51 @@ internal ResourcesOperations(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) @@ -2580,7 +2904,7 @@ internal ResourcesOperations(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")) @@ -2593,21 +2917,21 @@ internal ResourcesOperations(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; } @@ -2624,61 +2948,66 @@ internal ResourcesOperations(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) @@ -2694,51 +3023,51 @@ internal ResourcesOperations(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) @@ -2748,7 +3077,7 @@ internal ResourcesOperations(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")) @@ -2761,21 +3090,21 @@ internal ResourcesOperations(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/ResourcesOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourcesOperationsExtensions.cs index a5fc5de3d9f3..3b1c0724ee43 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/ResourcesOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/ResourcesOperationsExtensions.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 ResourcesOperations. @@ -29,9 +34,9 @@ public static partial class ResourcesOperationsExtensions /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage ListByResourceGroup(this IResourcesOperations operations, string resourceGroupName, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage ListByResourceGroup(this IResourcesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)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(); } /// @@ -49,7 +54,7 @@ public static partial class ResourcesOperationsExtensions /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IResourcesOperations 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 IResourcesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -61,41 +66,41 @@ public static partial class ResourcesOperationsExtensions /// Moves resources from one resource group to another resource group. /// /// - /// The resources to move must be in the same source resource group. The - /// target resource group may be in a different subscription. When moving - /// resources, both the source group and the target group are locked for the - /// duration of the operation. Write and delete operations are blocked on the - /// groups until the move completes. + /// The resources to move must be in the same source resource group. The target + /// resource group may be in a different subscription. When moving resources, + /// both the source group and the target group are locked for the duration of + /// the operation. Write and delete operations are blocked on the groups until + /// the move completes. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to move. /// /// /// Parameters for moving resources. /// public static void MoveResources(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).MoveResourcesAsync(sourceResourceGroupName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.MoveResourcesAsync(sourceResourceGroupName, parameters).GetAwaiter().GetResult(); } /// /// Moves resources from one resource group to another resource group. /// /// - /// The resources to move must be in the same source resource group. The - /// target resource group may be in a different subscription. When moving - /// resources, both the source group and the target group are locked for the - /// duration of the operation. Write and delete operations are blocked on the - /// groups until the move completes. + /// The resources to move must be in the same source resource group. The target + /// resource group may be in a different subscription. When moving resources, + /// both the source group and the target group are locked for the duration of + /// the operation. Write and delete operations are blocked on the groups until + /// the move completes. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to move. /// /// /// Parameters for moving resources. @@ -103,9 +108,68 @@ public static void MoveResources(this IResourcesOperations operations, string so /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task MoveResourcesAsync(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task MoveResourcesAsync(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.MoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false); + (await operations.MoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Validates whether resources can be moved from one resource group to another + /// resource group. + /// + /// + /// This operation checks whether the specified resources can be moved to the + /// target. The resources to move must be in the same source resource group. + /// The target resource group may be in a different subscription. If validation + /// succeeds, it returns HTTP response code 204 (no content). If validation + /// fails, it returns HTTP response code 409 (Conflict) with an error message. + /// Retrieve the URL in the Location header value to check the result of the + /// long-running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group containing the resources to validate for + /// move. + /// + /// + /// Parameters for moving resources. + /// + public static void ValidateMoveResources(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters) + { + operations.ValidateMoveResourcesAsync(sourceResourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates whether resources can be moved from one resource group to another + /// resource group. + /// + /// + /// This operation checks whether the specified resources can be moved to the + /// target. The resources to move must be in the same source resource group. + /// The target resource group may be in a different subscription. If validation + /// succeeds, it returns HTTP response code 204 (no content). If validation + /// fails, it returns HTTP response code 409 (Conflict) with an error message. + /// Retrieve the URL in the Location header value to check the result of the + /// long-running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group containing the resources to validate for + /// move. + /// + /// + /// Parameters for moving resources. + /// + /// + /// The cancellation token. + /// + public static async Task ValidateMoveResourcesAsync(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.ValidateMoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -117,9 +181,9 @@ public static void MoveResources(this IResourcesOperations operations, string so /// /// OData parameters to apply to the operation. /// - public static Microsoft.Rest.Azure.IPage List(this IResourcesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery)) + public static IPage List(this IResourcesOperations operations, ODataQuery odataQuery = default(ODataQuery)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).ListAsync(odataQuery), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync(odataQuery).GetAwaiter().GetResult(); } /// @@ -134,7 +198,7 @@ public static void MoveResources(this IResourcesOperations operations, string so /// /// The cancellation token. /// - public static async Task> ListAsync(this IResourcesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery = default(Microsoft.Rest.Azure.OData.ODataQuery), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this IResourcesOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) { @@ -169,7 +233,7 @@ public static void MoveResources(this IResourcesOperations operations, string so /// public static bool CheckExistence(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).CheckExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CheckExistenceAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).GetAwaiter().GetResult(); } /// @@ -200,7 +264,7 @@ public static bool CheckExistence(this IResourcesOperations operations, string r /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CheckExistenceAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CheckExistenceAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CheckExistenceWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, null, cancellationToken).ConfigureAwait(false)) { @@ -235,7 +299,7 @@ public static bool CheckExistence(this IResourcesOperations operations, string r /// public static void Delete(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).DeleteAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).GetAwaiter().GetResult(); } /// @@ -266,9 +330,9 @@ public static void Delete(this IResourcesOperations operations, string resourceG /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -301,7 +365,7 @@ public static void Delete(this IResourcesOperations operations, string resourceG /// public static GenericResource CreateOrUpdate(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).CreateOrUpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).GetAwaiter().GetResult(); } /// @@ -335,7 +399,7 @@ public static GenericResource CreateOrUpdate(this IResourcesOperations operation /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -370,7 +434,7 @@ public static GenericResource CreateOrUpdate(this IResourcesOperations operation /// public static GenericResource Get(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).GetAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).GetAwaiter().GetResult(); } /// @@ -401,7 +465,7 @@ public static GenericResource Get(this IResourcesOperations operations, string r /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, null, cancellationToken).ConfigureAwait(false)) { @@ -425,7 +489,7 @@ public static GenericResource Get(this IResourcesOperations operations, string r /// public static bool CheckExistenceById(this IResourcesOperations operations, string resourceId, string apiVersion) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).CheckExistenceByIdAsync(resourceId, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CheckExistenceByIdAsync(resourceId, apiVersion).GetAwaiter().GetResult(); } /// @@ -445,7 +509,7 @@ public static bool CheckExistenceById(this IResourcesOperations operations, stri /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CheckExistenceByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CheckExistenceByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CheckExistenceByIdWithHttpMessagesAsync(resourceId, apiVersion, null, cancellationToken).ConfigureAwait(false)) { @@ -469,7 +533,7 @@ public static bool CheckExistenceById(this IResourcesOperations operations, stri /// public static void DeleteById(this IResourcesOperations operations, string resourceId, string apiVersion) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).DeleteByIdAsync(resourceId, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteByIdAsync(resourceId, apiVersion).GetAwaiter().GetResult(); } /// @@ -489,9 +553,9 @@ public static void DeleteById(this IResourcesOperations operations, string resou /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteByIdWithHttpMessagesAsync(resourceId, apiVersion, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteByIdWithHttpMessagesAsync(resourceId, apiVersion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -513,7 +577,7 @@ public static void DeleteById(this IResourcesOperations operations, string resou /// public static GenericResource CreateOrUpdateById(this IResourcesOperations operations, string resourceId, string apiVersion, GenericResource parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).CreateOrUpdateByIdAsync(resourceId, apiVersion, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateByIdAsync(resourceId, apiVersion, parameters).GetAwaiter().GetResult(); } /// @@ -536,7 +600,7 @@ public static GenericResource CreateOrUpdateById(this IResourcesOperations opera /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateByIdWithHttpMessagesAsync(resourceId, apiVersion, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -560,7 +624,7 @@ public static GenericResource CreateOrUpdateById(this IResourcesOperations opera /// public static GenericResource GetById(this IResourcesOperations operations, string resourceId, string apiVersion) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).GetByIdAsync(resourceId, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetByIdAsync(resourceId, apiVersion).GetAwaiter().GetResult(); } /// @@ -580,7 +644,7 @@ public static GenericResource GetById(this IResourcesOperations operations, stri /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetByIdWithHttpMessagesAsync(resourceId, apiVersion, null, cancellationToken).ConfigureAwait(false)) { @@ -592,41 +656,100 @@ public static GenericResource GetById(this IResourcesOperations operations, stri /// Moves resources from one resource group to another resource group. /// /// - /// The resources to move must be in the same source resource group. The - /// target resource group may be in a different subscription. When moving - /// resources, both the source group and the target group are locked for the - /// duration of the operation. Write and delete operations are blocked on the - /// groups until the move completes. + /// The resources to move must be in the same source resource group. The target + /// resource group may be in a different subscription. When moving resources, + /// both the source group and the target group are locked for the duration of + /// the operation. Write and delete operations are blocked on the groups until + /// the move completes. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to move. /// /// /// Parameters for moving resources. /// public static void BeginMoveResources(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).BeginMoveResourcesAsync(sourceResourceGroupName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.BeginMoveResourcesAsync(sourceResourceGroupName, parameters).GetAwaiter().GetResult(); } /// /// Moves resources from one resource group to another resource group. /// /// - /// The resources to move must be in the same source resource group. The - /// target resource group may be in a different subscription. When moving - /// resources, both the source group and the target group are locked for the - /// duration of the operation. Write and delete operations are blocked on the - /// groups until the move completes. + /// The resources to move must be in the same source resource group. The target + /// resource group may be in a different subscription. When moving resources, + /// both the source group and the target group are locked for the duration of + /// the operation. Write and delete operations are blocked on the groups until + /// the move completes. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group containing the resources to move. + /// + /// + /// Parameters for moving resources. + /// + /// + /// The cancellation token. + /// + public static async Task BeginMoveResourcesAsync(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginMoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Validates whether resources can be moved from one resource group to another + /// resource group. + /// + /// + /// This operation checks whether the specified resources can be moved to the + /// target. The resources to move must be in the same source resource group. + /// The target resource group may be in a different subscription. If validation + /// succeeds, it returns HTTP response code 204 (no content). If validation + /// fails, it returns HTTP response code 409 (Conflict) with an error message. + /// Retrieve the URL in the Location header value to check the result of the + /// long-running operation. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group containing the resources to validate for + /// move. + /// + /// + /// Parameters for moving resources. + /// + public static void BeginValidateMoveResources(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters) + { + operations.BeginValidateMoveResourcesAsync(sourceResourceGroupName, parameters).GetAwaiter().GetResult(); + } + + /// + /// Validates whether resources can be moved from one resource group to another + /// resource group. + /// + /// + /// This operation checks whether the specified resources can be moved to the + /// target. The resources to move must be in the same source resource group. + /// The target resource group may be in a different subscription. If validation + /// succeeds, it returns HTTP response code 204 (no content). If validation + /// fails, it returns HTTP response code 409 (Conflict) with an error message. + /// Retrieve the URL in the Location header value to check the result of the + /// long-running operation. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group containing the rsources to move. + /// The name of the resource group containing the resources to validate for + /// move. /// /// /// Parameters for moving resources. @@ -634,9 +757,9 @@ public static void BeginMoveResources(this IResourcesOperations operations, stri /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginMoveResourcesAsync(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task BeginValidateMoveResourcesAsync(this IResourcesOperations operations, string sourceResourceGroupName, ResourcesMoveInfo parameters, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.BeginMoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false); + (await operations.BeginValidateMoveResourcesWithHttpMessagesAsync(sourceResourceGroupName, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -666,7 +789,7 @@ public static void BeginMoveResources(this IResourcesOperations operations, stri /// public static void BeginDelete(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).BeginDeleteAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.BeginDeleteAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion).GetAwaiter().GetResult(); } /// @@ -697,9 +820,9 @@ public static void BeginDelete(this IResourcesOperations operations, string reso /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginDeleteAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task BeginDeleteAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, null, cancellationToken).ConfigureAwait(false); + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -732,7 +855,7 @@ public static void BeginDelete(this IResourcesOperations operations, string reso /// public static GenericResource BeginCreateOrUpdate(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters).GetAwaiter().GetResult(); } /// @@ -766,7 +889,7 @@ public static GenericResource BeginCreateOrUpdate(this IResourcesOperations oper /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IResourcesOperations operations, string resourceGroupName, string resourceProviderNamespace, string parentResourcePath, string resourceType, string resourceName, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceProviderNamespace, parentResourcePath, resourceType, resourceName, apiVersion, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -790,7 +913,7 @@ public static GenericResource BeginCreateOrUpdate(this IResourcesOperations oper /// public static void BeginDeleteById(this IResourcesOperations operations, string resourceId, string apiVersion) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).BeginDeleteByIdAsync(resourceId, apiVersion), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.BeginDeleteByIdAsync(resourceId, apiVersion).GetAwaiter().GetResult(); } /// @@ -810,9 +933,9 @@ public static void BeginDeleteById(this IResourcesOperations operations, string /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginDeleteByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task BeginDeleteByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.BeginDeleteByIdWithHttpMessagesAsync(resourceId, apiVersion, null, cancellationToken).ConfigureAwait(false); + (await operations.BeginDeleteByIdWithHttpMessagesAsync(resourceId, apiVersion, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -834,7 +957,7 @@ public static void BeginDeleteById(this IResourcesOperations operations, string /// public static GenericResource BeginCreateOrUpdateById(this IResourcesOperations operations, string resourceId, string apiVersion, GenericResource parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)s).BeginCreateOrUpdateByIdAsync(resourceId, apiVersion, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateByIdAsync(resourceId, apiVersion, parameters).GetAwaiter().GetResult(); } /// @@ -857,7 +980,7 @@ public static GenericResource BeginCreateOrUpdateById(this IResourcesOperations /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, GenericResource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task BeginCreateOrUpdateByIdAsync(this IResourcesOperations operations, string resourceId, string apiVersion, GenericResource parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateByIdWithHttpMessagesAsync(resourceId, apiVersion, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -874,9 +997,9 @@ public static GenericResource BeginCreateOrUpdateById(this IResourcesOperations /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListByResourceGroupNext(this IResourcesOperations operations, string nextPageLink) + public static IPage ListByResourceGroupNext(this IResourcesOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)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(); } /// @@ -891,7 +1014,7 @@ public static Microsoft.Rest.Azure.IPage ListByResourceGroupNex /// /// The cancellation token. /// - public static async Task> ListByResourceGroupNextAsync(this IResourcesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListByResourceGroupNextAsync(this IResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { @@ -908,9 +1031,9 @@ public static Microsoft.Rest.Azure.IPage ListByResourceGroupNex /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this IResourcesOperations operations, string nextPageLink) + public static IPage ListNext(this IResourcesOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IResourcesOperations)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(); } /// @@ -925,7 +1048,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this IResourc /// /// The cancellation token. /// - public static async Task> ListNextAsync(this IResourcesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this IResourcesOperations 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/SubscriptionClient.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionClient.cs index 19da084195bf..e8dae403f8c6 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionClient.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionClient.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; /// /// All resource groups and resources exist within subscriptions. These @@ -19,7 +27,7 @@ namespace Microsoft.Azure.Management.ResourceManager /// tenants. A tenant is a dedicated instance of Azure Active Directory /// (Azure AD) for your organization. /// - public partial class SubscriptionClient : Microsoft.Rest.ServiceClient, ISubscriptionClient, IAzureClient + public partial class SubscriptionClient : ServiceClient, ISubscriptionClient, IAzureClient { /// /// The base URI of the service. @@ -29,17 +37,17 @@ public partial class SubscriptionClient : 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 API version to use for the operation. @@ -79,9 +87,9 @@ public partial class SubscriptionClient : Microsoft.Rest.ServiceClient /// Optional. The delegating handlers to add to the http client pipeline. /// - protected SubscriptionClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + protected SubscriptionClient(params DelegatingHandler[] handlers) : base(handlers) { - this.Initialize(); + Initialize(); } /// @@ -93,9 +101,9 @@ protected SubscriptionClient(params System.Net.Http.DelegatingHandler[] handlers /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected SubscriptionClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected SubscriptionClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { - this.Initialize(); + Initialize(); } /// @@ -110,13 +118,13 @@ protected SubscriptionClient(System.Net.Http.HttpClientHandler rootHandler, para /// /// Thrown when a required parameter is null /// - protected SubscriptionClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + protected SubscriptionClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -134,13 +142,13 @@ protected SubscriptionClient(System.Uri baseUri, params System.Net.Http.Delegati /// /// Thrown when a required parameter is null /// - protected SubscriptionClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected SubscriptionClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -155,16 +163,16 @@ protected SubscriptionClient(System.Uri baseUri, System.Net.Http.HttpClientHandl /// /// Thrown when a required parameter is null /// - public SubscriptionClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public SubscriptionClient(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); } } @@ -183,16 +191,16 @@ public SubscriptionClient(Microsoft.Rest.ServiceClientCredentials credentials, p /// /// Thrown when a required parameter is null /// - public SubscriptionClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public SubscriptionClient(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); } } @@ -211,7 +219,7 @@ public SubscriptionClient(Microsoft.Rest.ServiceClientCredentials credentials, S /// /// Thrown when a required parameter is null /// - public SubscriptionClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public SubscriptionClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -221,11 +229,11 @@ public SubscriptionClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCreden { 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); } } @@ -247,7 +255,7 @@ public SubscriptionClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCreden /// /// Thrown when a required parameter is null /// - public SubscriptionClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public SubscriptionClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -257,11 +265,11 @@ public SubscriptionClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCreden { 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); } } @@ -274,40 +282,40 @@ public SubscriptionClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCreden /// private void Initialize() { - this.Subscriptions = new SubscriptionsOperations(this); - this.Tenants = new TenantsOperations(this); - this.BaseUri = new System.Uri("https://management.azure.com"); - this.ApiVersion = "2016-06-01"; - this.AcceptLanguage = "en-US"; - this.LongRunningOperationRetryTimeout = 30; - this.GenerateClientRequestId = true; - SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + Subscriptions = new SubscriptionsOperations(this); + Tenants = new TenantsOperations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2016-06-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/SubscriptionsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionsOperations.cs index 89661e36f8af..a2a83d60ccd6 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionsOperations.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; /// /// SubscriptionsOperations operations. /// - internal partial class SubscriptionsOperations : Microsoft.Rest.IServiceOperations, ISubscriptionsOperations + internal partial class SubscriptionsOperations : IServiceOperations, ISubscriptionsOperations { /// /// Initializes a new instance of the SubscriptionsOperations class. @@ -29,11 +38,11 @@ internal partial class SubscriptionsOperations : Microsoft.Rest.IServiceOperatio /// internal SubscriptionsOperations(SubscriptionClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -58,70 +67,75 @@ internal SubscriptionsOperations(SubscriptionClient 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>> ListLocationsWithHttpMessagesAsync(string subscriptionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListLocationsWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (subscriptionId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "subscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); } - 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"); } // 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("subscriptionId", subscriptionId); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListLocations", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListLocations", 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}/locations").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -137,51 +151,51 @@ internal SubscriptionsOperations(SubscriptionClient 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) @@ -191,7 +205,7 @@ internal SubscriptionsOperations(SubscriptionClient 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")) @@ -204,21 +218,21 @@ internal SubscriptionsOperations(SubscriptionClient 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; } @@ -235,70 +249,75 @@ internal SubscriptionsOperations(SubscriptionClient 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 subscriptionId, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string subscriptionId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (subscriptionId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "subscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "subscriptionId"); } - 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"); } // 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("subscriptionId", subscriptionId); 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}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(subscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -314,51 +333,51 @@ internal SubscriptionsOperations(SubscriptionClient 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) @@ -368,7 +387,7 @@ internal SubscriptionsOperations(SubscriptionClient 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")) @@ -381,21 +400,21 @@ internal SubscriptionsOperations(SubscriptionClient 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; } @@ -409,64 +428,69 @@ internal SubscriptionsOperations(SubscriptionClient 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(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(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"); } // 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, "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").ToString(); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -482,51 +506,51 @@ internal SubscriptionsOperations(SubscriptionClient 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) @@ -536,7 +560,7 @@ internal SubscriptionsOperations(SubscriptionClient 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")) @@ -549,21 +573,21 @@ internal SubscriptionsOperations(SubscriptionClient 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; } @@ -580,61 +604,66 @@ internal SubscriptionsOperations(SubscriptionClient 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) @@ -650,51 +679,51 @@ internal SubscriptionsOperations(SubscriptionClient 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) @@ -704,7 +733,7 @@ internal SubscriptionsOperations(SubscriptionClient 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")) @@ -717,21 +746,21 @@ internal SubscriptionsOperations(SubscriptionClient 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/SubscriptionsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionsOperationsExtensions.cs index fa35cd47f72b..adc41a4670a8 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionsOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/SubscriptionsOperationsExtensions.cs @@ -1,16 +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; - using Microsoft.Rest.Azure; - using Models; /// /// Extension methods for SubscriptionsOperations. @@ -31,9 +37,9 @@ public static partial class SubscriptionsOperationsExtensions /// /// The ID of the target subscription. /// - public static System.Collections.Generic.IEnumerable ListLocations(this ISubscriptionsOperations operations, string subscriptionId) + public static IEnumerable ListLocations(this ISubscriptionsOperations operations, string subscriptionId) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISubscriptionsOperations)s).ListLocationsAsync(subscriptionId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListLocationsAsync(subscriptionId).GetAwaiter().GetResult(); } /// @@ -53,7 +59,7 @@ public static System.Collections.Generic.IEnumerable ListLocations(thi /// /// The cancellation token. /// - public static async Task> ListLocationsAsync(this ISubscriptionsOperations operations, string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListLocationsAsync(this ISubscriptionsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListLocationsWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false)) { @@ -72,7 +78,7 @@ public static System.Collections.Generic.IEnumerable ListLocations(thi /// public static Subscription Get(this ISubscriptionsOperations operations, string subscriptionId) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISubscriptionsOperations)s).GetAsync(subscriptionId), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(subscriptionId).GetAwaiter().GetResult(); } /// @@ -87,7 +93,7 @@ public static Subscription Get(this ISubscriptionsOperations operations, string /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this ISubscriptionsOperations operations, string subscriptionId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this ISubscriptionsOperations operations, string subscriptionId, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(subscriptionId, null, cancellationToken).ConfigureAwait(false)) { @@ -101,9 +107,9 @@ public static Subscription Get(this ISubscriptionsOperations operations, string /// /// The operations group for this extension method. /// - public static Microsoft.Rest.Azure.IPage List(this ISubscriptionsOperations operations) + public static IPage List(this ISubscriptionsOperations operations) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISubscriptionsOperations)s).ListAsync(), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync().GetAwaiter().GetResult(); } /// @@ -115,7 +121,7 @@ public static Microsoft.Rest.Azure.IPage List(this ISubscriptionsO /// /// The cancellation token. /// - public static async Task> ListAsync(this ISubscriptionsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this ISubscriptionsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -132,9 +138,9 @@ public static Microsoft.Rest.Azure.IPage List(this ISubscriptionsO /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this ISubscriptionsOperations operations, string nextPageLink) + public static IPage ListNext(this ISubscriptionsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISubscriptionsOperations)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(); } /// @@ -149,7 +155,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this ISubscripti /// /// The cancellation token. /// - public static async Task> ListNextAsync(this ISubscriptionsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this ISubscriptionsOperations 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/TagsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/TagsOperations.cs index 61d39e40c691..dbb540f712d9 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/TagsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/TagsOperations.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; /// /// TagsOperations operations. /// - internal partial class TagsOperations : Microsoft.Rest.IServiceOperations, ITagsOperations + internal partial class TagsOperations : IServiceOperations, ITagsOperations { /// /// Initializes a new instance of the TagsOperations class. @@ -29,11 +38,11 @@ internal partial class TagsOperations : Microsoft.Rest.IServiceOperations internal TagsOperations(ResourceManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -56,78 +65,83 @@ internal TagsOperations(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 DeleteValueWithHttpMessagesAsync(string tagName, string tagValue, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteValueWithHttpMessagesAsync(string tagName, string tagValue, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (tagName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "tagName"); + throw new ValidationException(ValidationRules.CannotBeNull, "tagName"); } if (tagValue == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "tagValue"); + throw new ValidationException(ValidationRules.CannotBeNull, "tagValue"); } - 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("tagName", tagName); tracingParameters.Add("tagValue", tagValue); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DeleteValue", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DeleteValue", 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}/tagNames/{tagName}/tagValues/{tagValue}").ToString(); _url = _url.Replace("{tagName}", System.Uri.EscapeDataString(tagName)); _url = _url.Replace("{tagValue}", System.Uri.EscapeDataString(tagValue)); - _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) @@ -143,43 +157,51 @@ internal TagsOperations(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 && (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) @@ -189,7 +211,7 @@ internal TagsOperations(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")) @@ -198,7 +220,7 @@ internal TagsOperations(ResourceManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -218,81 +240,86 @@ internal TagsOperations(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> CreateOrUpdateValueWithHttpMessagesAsync(string tagName, string tagValue, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateValueWithHttpMessagesAsync(string tagName, string tagValue, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (tagName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "tagName"); + throw new ValidationException(ValidationRules.CannotBeNull, "tagName"); } if (tagValue == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "tagValue"); + throw new ValidationException(ValidationRules.CannotBeNull, "tagValue"); } - 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("tagName", tagName); tracingParameters.Add("tagValue", tagValue); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateValue", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdateValue", 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}/tagNames/{tagName}/tagValues/{tagValue}").ToString(); _url = _url.Replace("{tagName}", System.Uri.EscapeDataString(tagName)); _url = _url.Replace("{tagValue}", System.Uri.EscapeDataString(tagValue)); - _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) @@ -308,51 +335,51 @@ internal TagsOperations(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 && (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) @@ -362,7 +389,7 @@ internal TagsOperations(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")) @@ -375,16 +402,16 @@ internal TagsOperations(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 @@ -393,21 +420,21 @@ internal TagsOperations(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; } @@ -429,75 +456,80 @@ internal TagsOperations(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> CreateOrUpdateWithHttpMessagesAsync(string tagName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string tagName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (tagName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "tagName"); + throw new ValidationException(ValidationRules.CannotBeNull, "tagName"); } - 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("tagName", tagName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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}/tagNames/{tagName}").ToString(); _url = _url.Replace("{tagName}", System.Uri.EscapeDataString(tagName)); - _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) @@ -513,51 +545,51 @@ internal TagsOperations(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 && (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) @@ -567,7 +599,7 @@ internal TagsOperations(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")) @@ -580,16 +612,16 @@ internal TagsOperations(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 @@ -598,21 +630,21 @@ internal TagsOperations(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; } @@ -632,72 +664,77 @@ internal TagsOperations(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 DeleteWithHttpMessagesAsync(string tagName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string tagName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (tagName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "tagName"); + throw new ValidationException(ValidationRules.CannotBeNull, "tagName"); } - 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("tagName", tagName); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Delete", 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}/tagNames/{tagName}").ToString(); _url = _url.Replace("{tagName}", System.Uri.EscapeDataString(tagName)); - _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) @@ -713,43 +750,51 @@ internal TagsOperations(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 && (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) @@ -759,7 +804,7 @@ internal TagsOperations(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")) @@ -768,7 +813,7 @@ internal TagsOperations(ResourceManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -783,69 +828,74 @@ internal TagsOperations(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(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(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, "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}/tagNames").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) @@ -861,51 +911,51 @@ internal TagsOperations(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) @@ -915,7 +965,7 @@ internal TagsOperations(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")) @@ -928,21 +978,21 @@ internal TagsOperations(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; } @@ -960,61 +1010,66 @@ internal TagsOperations(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) @@ -1030,51 +1085,51 @@ internal TagsOperations(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) @@ -1084,7 +1139,7 @@ internal TagsOperations(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")) @@ -1097,21 +1152,21 @@ internal TagsOperations(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/TagsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/TagsOperationsExtensions.cs index 1246cc7056d3..636adf9a242b 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/TagsOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/TagsOperationsExtensions.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 TagsOperations. @@ -31,7 +35,7 @@ public static partial class TagsOperationsExtensions /// public static void DeleteValue(this ITagsOperations operations, string tagName, string tagValue) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((ITagsOperations)s).DeleteValueAsync(tagName, tagValue), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteValueAsync(tagName, tagValue).GetAwaiter().GetResult(); } /// @@ -49,9 +53,9 @@ public static void DeleteValue(this ITagsOperations operations, string tagName, /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteValueAsync(this ITagsOperations operations, string tagName, string tagValue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteValueAsync(this ITagsOperations operations, string tagName, string tagValue, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteValueWithHttpMessagesAsync(tagName, tagValue, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteValueWithHttpMessagesAsync(tagName, tagValue, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -68,7 +72,7 @@ public static void DeleteValue(this ITagsOperations operations, string tagName, /// public static TagValue CreateOrUpdateValue(this ITagsOperations operations, string tagName, string tagValue) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ITagsOperations)s).CreateOrUpdateValueAsync(tagName, tagValue), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateValueAsync(tagName, tagValue).GetAwaiter().GetResult(); } /// @@ -86,7 +90,7 @@ public static TagValue CreateOrUpdateValue(this ITagsOperations operations, stri /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateValueAsync(this ITagsOperations operations, string tagName, string tagValue, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateValueAsync(this ITagsOperations operations, string tagName, string tagValue, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateValueWithHttpMessagesAsync(tagName, tagValue, null, cancellationToken).ConfigureAwait(false)) { @@ -110,7 +114,7 @@ public static TagValue CreateOrUpdateValue(this ITagsOperations operations, stri /// public static TagDetails CreateOrUpdate(this ITagsOperations operations, string tagName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ITagsOperations)s).CreateOrUpdateAsync(tagName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(tagName).GetAwaiter().GetResult(); } /// @@ -130,7 +134,7 @@ public static TagDetails CreateOrUpdate(this ITagsOperations operations, string /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ITagsOperations operations, string tagName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this ITagsOperations operations, string tagName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(tagName, null, cancellationToken).ConfigureAwait(false)) { @@ -152,7 +156,7 @@ public static TagDetails CreateOrUpdate(this ITagsOperations operations, string /// public static void Delete(this ITagsOperations operations, string tagName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((ITagsOperations)s).DeleteAsync(tagName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(tagName).GetAwaiter().GetResult(); } /// @@ -170,9 +174,9 @@ public static void Delete(this ITagsOperations operations, string tagName) /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this ITagsOperations operations, string tagName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this ITagsOperations operations, string tagName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(tagName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(tagName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -182,9 +186,9 @@ public static void Delete(this ITagsOperations operations, string tagName) /// /// The operations group for this extension method. /// - public static Microsoft.Rest.Azure.IPage List(this ITagsOperations operations) + public static IPage List(this ITagsOperations operations) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ITagsOperations)s).ListAsync(), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync().GetAwaiter().GetResult(); } /// @@ -197,7 +201,7 @@ public static Microsoft.Rest.Azure.IPage List(this ITagsOperations o /// /// The cancellation token. /// - public static async Task> ListAsync(this ITagsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this ITagsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -215,9 +219,9 @@ public static Microsoft.Rest.Azure.IPage List(this ITagsOperations o /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this ITagsOperations operations, string nextPageLink) + public static IPage ListNext(this ITagsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ITagsOperations)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(); } /// @@ -233,7 +237,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this ITagsOperatio /// /// The cancellation token. /// - public static async Task> ListNextAsync(this ITagsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this ITagsOperations 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/TenantsOperations.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/TenantsOperations.cs index 94b6e67f9e43..6b51901f1317 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/TenantsOperations.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/TenantsOperations.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; /// /// TenantsOperations operations. /// - internal partial class TenantsOperations : Microsoft.Rest.IServiceOperations, ITenantsOperations + internal partial class TenantsOperations : IServiceOperations, ITenantsOperations { /// /// Initializes a new instance of the TenantsOperations class. @@ -29,11 +38,11 @@ internal partial class TenantsOperations : Microsoft.Rest.IServiceOperations internal TenantsOperations(SubscriptionClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -50,64 +59,69 @@ internal TenantsOperations(SubscriptionClient 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(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListWithHttpMessagesAsync(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"); } // 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, "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("/") ? "" : "/")), "tenants").ToString(); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (this.Client.ApiVersion != null) + 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) @@ -123,51 +137,51 @@ internal TenantsOperations(SubscriptionClient 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) @@ -177,7 +191,7 @@ internal TenantsOperations(SubscriptionClient 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")) @@ -190,21 +204,21 @@ internal TenantsOperations(SubscriptionClient 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; } @@ -221,61 +235,66 @@ internal TenantsOperations(SubscriptionClient 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) @@ -291,51 +310,51 @@ internal TenantsOperations(SubscriptionClient 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) @@ -345,7 +364,7 @@ internal TenantsOperations(SubscriptionClient 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")) @@ -358,21 +377,21 @@ internal TenantsOperations(SubscriptionClient 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/TenantsOperationsExtensions.cs b/src/SDKs/Resource/Management.ResourceManager/Generated/TenantsOperationsExtensions.cs index d41b2ee16a9c..906ef49e3c30 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Generated/TenantsOperationsExtensions.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Generated/TenantsOperationsExtensions.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 TenantsOperations. @@ -23,9 +27,9 @@ public static partial class TenantsOperationsExtensions /// /// The operations group for this extension method. /// - public static Microsoft.Rest.Azure.IPage List(this ITenantsOperations operations) + public static IPage List(this ITenantsOperations operations) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ITenantsOperations)s).ListAsync(), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync().GetAwaiter().GetResult(); } /// @@ -37,7 +41,7 @@ public static Microsoft.Rest.Azure.IPage List(this ITenants /// /// The cancellation token. /// - public static async Task> ListAsync(this ITenantsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this ITenantsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -54,9 +58,9 @@ public static Microsoft.Rest.Azure.IPage List(this ITenants /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListNext(this ITenantsOperations operations, string nextPageLink) + public static IPage ListNext(this ITenantsOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ITenantsOperations)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(); } /// @@ -71,7 +75,7 @@ public static Microsoft.Rest.Azure.IPage ListNext(this ITen /// /// The cancellation token. /// - public static async Task> ListNextAsync(this ITenantsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListNextAsync(this ITenantsOperations 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/Microsoft.Azure.Management.ResourceManager.csproj b/src/SDKs/Resource/Management.ResourceManager/Microsoft.Azure.Management.ResourceManager.csproj index a362f0aa8664..f71a5460017e 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Microsoft.Azure.Management.ResourceManager.csproj +++ b/src/SDKs/Resource/Management.ResourceManager/Microsoft.Azure.Management.ResourceManager.csproj @@ -4,7 +4,7 @@ Microsoft.Azure.Management.ResourceManager Provides resource group and resource management capabilities for Microsoft Azure. Microsoft.Azure.Management.ResourceManager - 1.6.0-preview + 1.7.0-preview Microsoft Azure resource management;resource management;resource groups diff --git a/src/SDKs/Resource/Management.ResourceManager/Properties/AssemblyInfo.cs b/src/SDKs/Resource/Management.ResourceManager/Properties/AssemblyInfo.cs index 3542de7225a6..fc9c1ec6b7cd 100644 --- a/src/SDKs/Resource/Management.ResourceManager/Properties/AssemblyInfo.cs +++ b/src/SDKs/Resource/Management.ResourceManager/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ [assembly: AssemblyDescription("Provides Microsoft Azure resource management operations including Resource Groups.")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.7.0.0")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Azure .NET SDK")] diff --git a/src/SDKs/Resource/Resource.Tests/ScenarioTests/PolicyTests.ScenarioTests.cs b/src/SDKs/Resource/Resource.Tests/ScenarioTests/PolicyTests.ScenarioTests.cs new file mode 100644 index 000000000000..d7245ea937fa --- /dev/null +++ b/src/SDKs/Resource/Resource.Tests/ScenarioTests/PolicyTests.ScenarioTests.cs @@ -0,0 +1,585 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +using Microsoft.Azure.Management.ResourceManager; +using Microsoft.Azure.Management.ResourceManager.Models; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using Newtonsoft.Json.Linq; +using System.Linq; +using Xunit; + +namespace Policy.Tests +{ + using System; + using System.Diagnostics; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + + public class LivePolicyTests : TestBase + { + [Fact] + public void CanCrudPolicyDefinition() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + var client = context.GetServiceClient(); + + // First, create with minimal properties + var policyName = TestUtilities.GenerateName(); + var policyDefinition = new PolicyDefinition + { + DisplayName = "CanCrudPolicyDefinition Policy", + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + var result = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: policyName, parameters: policyDefinition); + Assert.NotNull(result); + + var getResult = client.PolicyDefinitions.Get(policyName); + Assert.Equal(policyName, getResult.Name); + Assert.Equal(policyDefinition.DisplayName, getResult.DisplayName); + Assert.Equal(policyDefinition.PolicyRule, getResult.PolicyRule); + Assert.Equal("Custom", getResult.PolicyType); + Assert.Null(getResult.Mode); + Assert.Null(getResult.Description); + Assert.Null(getResult.Metadata); + Assert.Null(getResult.Parameters); + + var listResult = client.PolicyDefinitions.List(); + Assert.NotEmpty(listResult); + var policyInList = listResult.FirstOrDefault(p => p.Name.Equals(policyName)); + Assert.NotNull(policyInList); + Assert.Equal(policyDefinition.DisplayName, policyInList.DisplayName); + Assert.Equal(policyDefinition.PolicyRule, policyInList.PolicyRule); + + // Update with all properties + policyDefinition.Description = "Description text"; + policyDefinition.Metadata = JToken.Parse(@"{ 'category': 'sdk test' }"); + policyDefinition.Mode = "All"; + policyDefinition.DisplayName = "Updated CanCrudPolicyDefinition Policy"; + + result = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: policyName, parameters: policyDefinition); + Assert.NotNull(result); + + getResult = client.PolicyDefinitions.Get(policyName); + Assert.Equal(policyName, getResult.Name); + Assert.Equal(policyDefinition.DisplayName, getResult.DisplayName); + Assert.Equal(policyDefinition.PolicyRule, getResult.PolicyRule); + Assert.Equal("Custom", getResult.PolicyType); + Assert.Equal("All", getResult.Mode); + Assert.Equal(policyDefinition.Description, getResult.Description); + Assert.Equal(policyDefinition.Metadata, getResult.Metadata); + Assert.Null(getResult.Parameters); + + // Delete + client.PolicyDefinitions.Delete(policyName); + Assert.Throws(() => client.PolicyDefinitions.Get(policyName)); + listResult = client.PolicyDefinitions.List(); + Assert.Equal(0, listResult.Count(p => p.Name.Equals(policyName))); + + // Add one with parameters + policyDefinition.Parameters = JToken.Parse(@"{ 'foo': { 'type': 'String' } }"); + policyDefinition.PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""[parameters('foo')]"" + }, + ""then"": { + ""effect"": ""deny"" + } + }"); + + result = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: policyName, parameters: policyDefinition); + Assert.NotNull(result); + + getResult = client.PolicyDefinitions.Get(policyName); + Assert.Equal(policyName, getResult.Name); + Assert.Equal(policyDefinition.Parameters.ToString(), getResult.Parameters.ToString()); + + // Delete + client.PolicyDefinitions.Delete(policyName); + Assert.Throws(() => client.PolicyDefinitions.Get(policyName)); + listResult = client.PolicyDefinitions.List(); + Assert.Equal(0, listResult.Count(p => p.Name.Equals(policyName))); + } + } + + [Fact] + public void CanCrudPolicySetDefinition() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + var client = context.GetServiceClient(); + + // Add a definition that can be referenced + var definitionName = TestUtilities.GenerateName(); + var policyDefinition = new PolicyDefinition + { + DisplayName = "CanCrudPolicySetDefinition Policy Definition", + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + var definitionResult = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: definitionName, parameters: policyDefinition); + Assert.NotNull(definitionResult); + + // First, create with minimal properties + var setName = TestUtilities.GenerateName(); + var policySet = new PolicySetDefinition + { + DisplayName = "CanCrudPolicySetDefinition Policy Set Definition", + PolicyDefinitions = new [] { new PolicyDefinitionReference(policyDefinitionId: definitionResult.Id) } + }; + + var result = client.PolicySetDefinitions.CreateOrUpdate(setName, policySet); + Assert.NotNull(result); + + var getResult = client.PolicySetDefinitions.Get(setName); + Assert.Equal(setName, getResult.Name); + Assert.Equal(policySet.DisplayName, getResult.DisplayName); + Assert.Equal(1, getResult.PolicyDefinitions.Count); + Assert.Single(getResult.PolicyDefinitions, policyRef => policyRef.PolicyDefinitionId.Equals(definitionResult.Id)); + Assert.Null(getResult.Description); + Assert.Null(getResult.Metadata); + Assert.Null(getResult.Parameters); + Assert.Equal("Custom", getResult.PolicyType); + + var listResult = client.PolicySetDefinitions.List(); + Assert.NotEmpty(listResult); + var policyInList = listResult.FirstOrDefault(p => p.Name.Equals(setName)); + Assert.NotNull(policyInList); + Assert.Equal(policySet.DisplayName, policyInList.DisplayName); + Assert.Equal(1, getResult.PolicyDefinitions.Count); + Assert.Single(policyInList.PolicyDefinitions, policyRef => policyRef.PolicyDefinitionId.Equals(definitionResult.Id)); + + // Update with all properties + policySet.Description = "Description text"; + policySet.Metadata = JToken.Parse(@"{ 'category': 'sdk test' }"); + policySet.DisplayName = "Updated CanCrudPolicySetDefinition Policy Set Definition"; + policySet.PolicyDefinitions = new[] + { + new PolicyDefinitionReference(policyDefinitionId: definitionResult.Id), + new PolicyDefinitionReference(policyDefinitionId: definitionResult.Id) + }; + + result = client.PolicySetDefinitions.CreateOrUpdate(setName, policySet); + Assert.NotNull(result); + + getResult = client.PolicySetDefinitions.Get(setName); + Assert.Equal(setName, getResult.Name); + Assert.Equal(policySet.DisplayName, getResult.DisplayName); + Assert.Equal(2, getResult.PolicyDefinitions.Count); + Assert.True(getResult.PolicyDefinitions.All(policyRef => policyRef.PolicyDefinitionId.Equals(definitionResult.Id))); + Assert.Equal(policySet.Description, getResult.Description); + Assert.Equal(policySet.Metadata, getResult.Metadata); + Assert.Null(getResult.Parameters); + Assert.Equal("Custom", getResult.PolicyType); + + // Delete + client.PolicySetDefinitions.Delete(setName); + Assert.Throws(() => client.PolicySetDefinitions.Get(setName)); + listResult = client.PolicySetDefinitions.List(); + Assert.Equal(0, listResult.Count(p => p.Name.Equals(setName))); + + // Add one with parameters + policyDefinition.Parameters = JToken.Parse(@"{ 'foo': { 'type': 'String' } }"); + policyDefinition.PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""[parameters('foo')]"" + }, + ""then"": { + ""effect"": ""deny"" + } + }"); + + client.PolicyDefinitions.Delete(definitionName); + definitionResult = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: definitionName, parameters: policyDefinition); + Assert.NotNull(definitionResult); + + policySet = new PolicySetDefinition + { + DisplayName = "CanCrudPolicySetDefinition Policy Set Definition", + PolicyDefinitions = new[] + { + new PolicyDefinitionReference(policyDefinitionId: definitionResult.Id, parameters: JToken.Parse(@"{ 'foo': { 'value': ""[parameters('fooSet')]"" }}")) + }, + Parameters = JToken.Parse(@"{ 'fooSet': { 'type': 'String' } }") + }; + + result = client.PolicySetDefinitions.CreateOrUpdate(setName, policySet); + Assert.NotNull(result); + + getResult = client.PolicySetDefinitions.Get(setName); + Assert.Equal(policySet.Parameters.ToString(), getResult.Parameters.ToString()); + Assert.Equal(1, getResult.PolicyDefinitions.Count); + Assert.Single(policyInList.PolicyDefinitions, policyRef => policyRef.PolicyDefinitionId.Equals(definitionResult.Id)); + Assert.Equal(policySet.PolicyDefinitions[0].Parameters.ToString(), getResult.PolicyDefinitions[0].Parameters.ToString()); + + // Delete + client.PolicySetDefinitions.Delete(setName); + Assert.Throws(() => client.PolicySetDefinitions.Get(setName)); + listResult = client.PolicySetDefinitions.List(); + Assert.Equal(0, listResult.Count(p => p.Name.Equals(setName))); + client.PolicyDefinitions.Delete(definitionName); + } + } + + [Fact] + public void CanCrudPolicyAssignment() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + var client = context.GetServiceClient(); + + // Add a definition that can be assigned + var definitionName = TestUtilities.GenerateName(); + var policyDefinition = new PolicyDefinition + { + DisplayName = "CanCrudPolicyDefinition Policy Definition", + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + var definitionResult = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: definitionName, parameters: policyDefinition); + Assert.NotNull(definitionResult); + + // First, create with minimal properties + var assignmentName = TestUtilities.GenerateName(); + var assignmentScope = "/subscriptions/" + client.SubscriptionId; + var policyAssignment = new PolicyAssignment + { + DisplayName = "CanCrudPolicyDefinition Policy Assignment", + PolicyDefinitionId = definitionResult.Id, + Sku = new PolicySku("A0", "Free") + }; + + var result = client.PolicyAssignments.Create(assignmentScope, assignmentName, policyAssignment); + Assert.NotNull(result); + + var getResult = client.PolicyAssignments.Get(assignmentScope, assignmentName); + Assert.Equal(assignmentName, getResult.Name); + Assert.Equal(policyAssignment.DisplayName, getResult.DisplayName); + Assert.Equal(policyAssignment.PolicyDefinitionId, getResult.PolicyDefinitionId); + Assert.Equal(assignmentScope, getResult.Scope); + Assert.Equal(policyAssignment.Sku.Name, getResult.Sku.Name); + Assert.Equal(policyAssignment.Sku.Tier, getResult.Sku.Tier); + Assert.Null(getResult.NotScopes); + Assert.Null(getResult.Description); + Assert.Null(getResult.Metadata); + Assert.Null(getResult.Parameters); + + var listResult = client.PolicyAssignments.List(); + Assert.NotEmpty(listResult); + var policyInList = listResult.FirstOrDefault(p => p.Name.Equals(assignmentName)); + Assert.NotNull(policyInList); + Assert.Equal(policyAssignment.DisplayName, policyInList.DisplayName); + Assert.Equal(policyAssignment.PolicyDefinitionId, policyInList.PolicyDefinitionId); + + // Update with all properties + policyAssignment.Description = "Description text"; + policyAssignment.Metadata = JToken.Parse(@"{ 'category': 'sdk test' }"); + policyAssignment.DisplayName = "Updated CanCrudPolicyDefinition Policy Assignment"; + policyAssignment.Sku = new PolicySku("A1", "Standard"); + + result = client.PolicyAssignments.Create(assignmentScope, assignmentName, policyAssignment); + Assert.NotNull(result); + + getResult = client.PolicyAssignments.GetById(result.Id); + Assert.Equal(assignmentName, getResult.Name); + Assert.Equal(policyAssignment.DisplayName, getResult.DisplayName); + Assert.Equal(policyAssignment.PolicyDefinitionId, getResult.PolicyDefinitionId); + Assert.Equal(assignmentScope, getResult.Scope); + Assert.Equal(policyAssignment.Sku.Name, getResult.Sku.Name); + Assert.Equal(policyAssignment.Sku.Tier, getResult.Sku.Tier); + Assert.Equal(policyAssignment.Description, getResult.Description); + Assert.Equal(policyAssignment.Metadata, getResult.Metadata); + + // Delete + client.PolicyAssignments.Delete(assignmentScope, assignmentName); + Assert.Throws(() => client.PolicyAssignments.Get(assignmentScope, assignmentName)); + listResult = client.PolicyAssignments.List(); + Assert.Equal(0, listResult.Count(p => p.Name.Equals(assignmentName))); + client.PolicyDefinitions.Delete(definitionName); + } + } + + [Fact] + public void ValidatePolicyAssignmentErrorHandling() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + var client = context.GetServiceClient(); + + // Add a definition that can be assigned + var definitionName = TestUtilities.GenerateName(); + var policyDefinition = new PolicyDefinition + { + DisplayName = "CanCrudPolicyDefinition Policy Definition", + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + var definitionResult = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: definitionName, parameters: policyDefinition); + Assert.NotNull(definitionResult); + + // Missing policy definition id + var assignmentName = TestUtilities.GenerateName(); + var assignmentScope = "/subscriptions/" + client.SubscriptionId; + var policyAssignment = new PolicyAssignment + { + DisplayName = "Invalid Assignment", + Sku = new PolicySku("A0", "Free") + }; + + + var exception = this.CatchAndReturn(() => client.PolicyAssignments.Create(assignmentScope, assignmentName, policyAssignment)); + Assert.Contains("InvalidRequestContent", exception.Response.Content); + + // Invalid policy definition id + policyAssignment = new PolicyAssignment + { + DisplayName = "Invalid Assignment", + Sku = new PolicySku("A0", "Free"), + PolicyDefinitionId = definitionResult.Id.Replace(definitionName, TestUtilities.GenerateName()) + }; + + + exception = this.CatchAndReturn(() => client.PolicyAssignments.Create(assignmentScope, assignmentName, policyAssignment)); + Assert.Contains("PolicyDefinitionNotFound", exception.Response.Content); + + // Invalid SKU + policyAssignment = new PolicyAssignment + { + DisplayName = "Invalid Assignment", + Sku = new PolicySku("A2", "Free"), + PolicyDefinitionId = definitionResult.Id + }; + + + exception = this.CatchAndReturn(() => client.PolicyAssignments.Create(assignmentScope, assignmentName, policyAssignment)); + Assert.Contains("InvalidPolicySku", exception.Response.Content); + + // Delete + client.PolicyDefinitions.Delete(definitionName); + } + } + + [Fact] + public void ValidatePolicyDefinitionErrorHandling() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + var client = context.GetServiceClient(); + + // Missing rule + var definitionName = TestUtilities.GenerateName(); + var policyDefinition = new PolicyDefinition + { + DisplayName = "Invalid Definition" + }; + + + var exception = this.CatchAndReturn(() => client.PolicyDefinitions.CreateOrUpdate(definitionName, policyDefinition)); + Assert.Contains("InvalidRequestContent", exception.Response.Content); + + // Invalid Mode + policyDefinition = new PolicyDefinition + { + DisplayName = "Invalid Definition", + Mode = "Foo", + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + + exception = this.CatchAndReturn(() => client.PolicyDefinitions.CreateOrUpdate(definitionName, policyDefinition)); + Assert.Contains("InvalidRequestContent", exception.Response.Content); + + // Unused parameter + policyDefinition = new PolicyDefinition + { + DisplayName = "Invalid Definition", + Parameters = JToken.Parse(@"{ 'foo': { 'type': 'String' } }"), + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + + exception = this.CatchAndReturn(() => client.PolicyDefinitions.CreateOrUpdate(definitionName, policyDefinition)); + Assert.Contains("UnusedPolicyParameters", exception.Response.Content); + + // Missing parameter + policyDefinition = new PolicyDefinition + { + DisplayName = "Invalid Definition", + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""[parameters('foo')]"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + + exception = this.CatchAndReturn(() => client.PolicyDefinitions.CreateOrUpdate(definitionName, policyDefinition)); + Assert.Contains("InvalidPolicyParameters", exception.Response.Content); + } + } + + [Fact] + public void ValidatePolicySetDefinitionErrorHandling() + { + using (MockContext context = MockContext.Start(this.GetType().FullName)) + { + var client = context.GetServiceClient(); + + // Add a definition that can be assigned + var definitionName = TestUtilities.GenerateName(); + var policyDefinition = new PolicyDefinition + { + DisplayName = "Test Policy Definition", + PolicyRule = JToken.Parse( + @"{ + ""if"": { + ""source"": ""action"", + ""equals"": ""ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write"" + }, + ""then"": { + ""effect"": ""deny"" + } + }") + }; + + var definitionResult = client.PolicyDefinitions.CreateOrUpdate(policyDefinitionName: definitionName, parameters: policyDefinition); + Assert.NotNull(definitionResult); + + // Missing definition references + var setName = TestUtilities.GenerateName(); + var policySetDefinition = new PolicySetDefinition + { + DisplayName = "Invalid Set Definition" + }; + + + var validationException = this.CatchAndReturn(() => client.PolicySetDefinitions.CreateOrUpdate(setName, policySetDefinition)); + Assert.Contains("PolicyDefinitions", validationException.Target); + + // Invalid definition reference + policySetDefinition = new PolicySetDefinition + { + DisplayName = "Invalid Set Definition", + PolicyDefinitions = new[] + { + new PolicyDefinitionReference(policyDefinitionId: definitionResult.Id.Replace(definitionName, TestUtilities.GenerateName())) + } + }; + + + var exception = this.CatchAndReturn(() => client.PolicySetDefinitions.CreateOrUpdate(setName, policySetDefinition)); + Assert.Contains("PolicyDefinitionNotFound", exception.Response.Content); + + // Unused parameter + policySetDefinition = new PolicySetDefinition + { + DisplayName = "Invalid Set Definition", + Parameters = JToken.Parse(@"{ 'foo': { 'type': 'String' } }"), + PolicyDefinitions = new[] + { + new PolicyDefinitionReference(policyDefinitionId: definitionResult.Id) + } + }; + + + exception = this.CatchAndReturn(() => client.PolicySetDefinitions.CreateOrUpdate(setName, policySetDefinition)); + Assert.Contains("UnusedPolicyParameters", exception.Response.Content); + + // Invalid reference parameters + policySetDefinition = new PolicySetDefinition + { + DisplayName = "Invalid Set Definition", + PolicyDefinitions = new[] + { + new PolicyDefinitionReference(policyDefinitionId: definitionResult.Id, parameters: JToken.Parse(@"{ 'foo': { 'value': 'abc' } }")) + } + }; + + + exception = this.CatchAndReturn(() => client.PolicySetDefinitions.CreateOrUpdate(setName, policySetDefinition)); + Assert.Contains("UndefinedPolicyParameter", exception.Response.Content); + + client.PolicyDefinitions.Delete(definitionName); + } + } + + private T CatchAndReturn(Action testCode) where T : Exception + { + try + { + testCode(); + } + catch (T ex) + { + return ex; + } + + Assert.True(false, "Exception should have been thrown"); + return null; + } + } +} diff --git a/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicyAssignment.json b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicyAssignment.json new file mode 100644 index 000000000000..7becab0e2b41 --- /dev/null +++ b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicyAssignment.json @@ -0,0 +1,605 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet6918?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0NjkxOD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "322" + ], + "x-ms-client-request-id": [ + "425c6660-b349-404e-85bc-3d6e3dbb03ed" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6918\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "441" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:22 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:0342e542-1c2e-4eda-be0d-2db59f28144b" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1182" + ], + "x-ms-correlation-request-id": [ + "8aed513d-5d4a-4dab-84b7-f30528bf5ac1" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200423Z:8aed513d-5d4a-4dab-84b7-f30528bf5ac1" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDQ2NjM/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\"\r\n },\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "295" + ], + "x-ms-client-request-id": [ + "8c6a62a3-6081-40e4-91c0-250566b4c826" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4663\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "504" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:ce7dbd5b-3929-4ce6-8399-149ff8957c34" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-correlation-request-id": [ + "f61c70b9-d9c2-49c7-8753-566f3ef07bed" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200423Z:f61c70b9-d9c2-49c7-8753-566f3ef07bed" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDQ2NjM/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n }\r\n },\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "404" + ], + "x-ms-client-request-id": [ + "5750e456-2f24-4a61-bfb5-36f5eea66db6" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4663\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "584" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:19952e69-3c95-4f3d-80bf-a6e8f66d97c9" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1180" + ], + "x-ms-correlation-request-id": [ + "7136bd1a-849e-4ebf-858e-2d0a4dfc4e49" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200424Z:7136bd1a-849e-4ebf-858e-2d0a4dfc4e49" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDQ2NjM/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "9c8bfe83-224b-48c5-950d-13c22e29bf3f" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4663\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:96f55553-fa03-49b7-9376-76d2f2213e34" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14990" + ], + "x-ms-correlation-request-id": [ + "39f13640-6a7b-491b-b366-c6ad9108ad98" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200423Z:39f13640-6a7b-491b-b366-c6ad9108ad98" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDQ2NjM/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d742f421-636f-435e-81f6-7ea6cbe91e53" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4663\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:5ff15949-9a59-4174-9fba-750fcb5f4974" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14988" + ], + "x-ms-correlation-request-id": [ + "0b0a4f99-fa40-46a1-b2d6-32f38d9bb022" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200424Z:0b0a4f99-fa40-46a1-b2d6-32f38d9bb022" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDQ2NjM/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2476f372-18a8-490d-a767-f6e490ad9084" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"PolicyAssignmentNotFound\",\r\n \"message\": \"The policy assignment 'azsmnet4663' is not found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "107" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:8901e29b-562b-4bec-84e2-5c6410086486" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14987" + ], + "x-ms-correlation-request-id": [ + "26947ca6-157c-45c9-836a-ad74640509a5" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200424Z:26947ca6-157c-45c9-836a-ad74640509a5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lBc3NpZ25tZW50cz9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b75d5dfa-035d-4c10-b22b-9ef594c3cbd1" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"US only policy assignment on the subscription \",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/983211ba-f348-4758-983b-21fa29294869\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"description\": \"Resources can only be provisioned in West US regions\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/akifassignment\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"akifassignment\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4663\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2040\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4739\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4739\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"Security for Express Route subscriptions\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/expressRouteRGSecurity\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"notScopes\": [\r\n \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/resourceGroups/GovIntPolicyDemo\"\r\n ],\r\n \"description\": \"Ensures that the Express Route subscriptions meets security requirements.\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/expressRoute\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"expressRoute\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"west US only policy assignment on the subscription \",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/gokmenhPolicyDefinition\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"description\": \"Resources can only be provisioned in West US region\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/gokmenhPolicyAssignment\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"gokmenhPolicyAssignment\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"robgaRGassignment\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/686b65fa-af26-4f41-8bd2-4cc9824a7339\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/resourceGroups/xizha\",\r\n \"notScopes\": [],\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"test\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"test\"\r\n }\r\n },\r\n \"metadata\": {\r\n \"assignedBy\": \"Robert Gao\"\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/resourceGroups/xizha/providers/Microsoft.Authorization/policyAssignments/de847ad5e5944fe8b4e8dab0\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"de847ad5e5944fe8b4e8dab0\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:4f0a7841-a34c-4cea-aad5-5be089dfd2f0" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14989" + ], + "x-ms-correlation-request-id": [ + "025ac23b-f3ec-4a92-b465-0324a53b24a4" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200424Z:025ac23b-f3ec-4a92-b465-0324a53b24a4" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lBc3NpZ25tZW50cz9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "4411bda8-ce4d-4a13-ae1b-d8df0f318257" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"US only policy assignment on the subscription \",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/983211ba-f348-4758-983b-21fa29294869\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"description\": \"Resources can only be provisioned in West US regions\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/akifassignment\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"akifassignment\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2040\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4739\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4739\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"Security for Express Route subscriptions\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/expressRouteRGSecurity\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"notScopes\": [\r\n \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/resourceGroups/GovIntPolicyDemo\"\r\n ],\r\n \"description\": \"Ensures that the Express Route subscriptions meets security requirements.\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/expressRoute\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"expressRoute\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"west US only policy assignment on the subscription \",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/gokmenhPolicyDefinition\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"description\": \"Resources can only be provisioned in West US region\"\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/gokmenhPolicyAssignment\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"gokmenhPolicyAssignment\"\r\n },\r\n {\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"robgaRGassignment\",\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policySetDefinitions/686b65fa-af26-4f41-8bd2-4cc9824a7339\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/resourceGroups/xizha\",\r\n \"notScopes\": [],\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"test\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"test\"\r\n }\r\n },\r\n \"metadata\": {\r\n \"assignedBy\": \"Robert Gao\"\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/resourceGroups/xizha/providers/Microsoft.Authorization/policyAssignments/de847ad5e5944fe8b4e8dab0\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"de847ad5e5944fe8b4e8dab0\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:c9b83623-4ffa-41fc-bb6f-1a6ddcba5b39" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14986" + ], + "x-ms-correlation-request-id": [ + "e72f9ee7-a5c9-4f14-b823-7e2ef9d7a3d7" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200424Z:e72f9ee7-a5c9-4f14-b823-7e2ef9d7a3d7" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDQ2NjM/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f7c52e86-b410-42f2-bce7-52623077f8c2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"sku\": {\r\n \"name\": \"A1\",\r\n \"tier\": \"Standard\"\r\n },\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"scope\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet4663\",\r\n \"type\": \"Microsoft.Authorization/policyAssignments\",\r\n \"name\": \"azsmnet4663\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:e2232bda-c0ab-44e2-a1cf-105a0c76bd77" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1179" + ], + "x-ms-correlation-request-id": [ + "30a1492f-77fd-4f7a-9b37-bf2fef68cadc" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200424Z:30a1492f-77fd-4f7a-9b37-bf2fef68cadc" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet6918?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0NjkxOD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "2590b6e5-321e-4d27-8ce1-6b873d1db57f" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6918\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6918\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:23 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:55a86c55-65e4-49cd-b470-92ebdde6d6a5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1178" + ], + "x-ms-correlation-request-id": [ + "831f42fe-9e4b-47c7-9ea9-4718cebd8128" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200424Z:831f42fe-9e4b-47c7-9ea9-4718cebd8128" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "CanCrudPolicyAssignment": [ + "azsmnet6918", + "azsmnet4663" + ] + }, + "Variables": { + "SubscriptionId": "0c82cadf-f711-4825-bcaf-44189e8baa9f" + } +} \ No newline at end of file diff --git a/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicyDefinition.json b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicyDefinition.json new file mode 100644 index 000000000000..f8fb2e332b92 --- /dev/null +++ b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicyDefinition.json @@ -0,0 +1,777 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "311" + ], + "x-ms-client-request-id": [ + "bce5bb24-5c95-4a65-8380-5e9ec69fda50" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "430" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:e6b197c6-06fe-4d9b-be90-c5df06597db1" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-correlation-request-id": [ + "6ce5d7d4-a499-409b-badc-3bf1dd77bcd2" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200401Z:6ce5d7d4-a499-409b-badc-3bf1dd77bcd2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"mode\": \"All\",\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"description\": \"Description text\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "436" + ], + "x-ms-client-request-id": [ + "be92622b-e9b8-4fa4-a4ea-799ae9116901" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "519" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:bf1f80aa-b207-45b4-9616-649c16bef804" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1196" + ], + "x-ms-correlation-request-id": [ + "3b01582f-8236-48ad-8f03-0ebafeba037d" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200402Z:3b01582f-8236-48ad-8f03-0ebafeba037d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"mode\": \"All\",\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"description\": \"Description text\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "462" + ], + "x-ms-client-request-id": [ + "9a8da93c-510d-4b92-a449-70b2522812f0" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "504" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:02 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:e9f4f251-0c79-4438-a397-0327cd77a17c" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1194" + ], + "x-ms-correlation-request-id": [ + "8acebf35-f284-4f92-8342-624d4ae73e27" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200403Z:8acebf35-f284-4f92-8342-624d4ae73e27" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "8f215174-7efb-45a9-96f6-2434c30f19d1" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:54873fbd-6ff1-415c-bc44-221786430fdd" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14999" + ], + "x-ms-correlation-request-id": [ + "1b7e9009-85ac-4205-b4e4-c882f8c1c78a" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200401Z:1b7e9009-85ac-4205-b4e4-c882f8c1c78a" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0303bbda-e5f4-4a12-a61f-0dec7ce73055" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:b2422949-e342-4504-8f91-b0134abe0d42" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14997" + ], + "x-ms-correlation-request-id": [ + "d45e9342-7e84-4c10-b264-adb0d1614178" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200402Z:d45e9342-7e84-4c10-b264-adb0d1614178" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "96686c10-5999-4393-80af-c5422c1ba9ca" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"PolicyDefinitionNotFound\",\r\n \"message\": \"The policy definition 'azsmnet9498' could not be found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "113" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:6d4f6910-7537-4e01-bcb0-c37c415b0fc5" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14996" + ], + "x-ms-correlation-request-id": [ + "1ec25fa7-4f40-40da-a9fd-5ca2ad411826" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200402Z:1ec25fa7-4f40-40da-a9fd-5ca2ad411826" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "be9ec81a-4fed-4c44-b76f-2c25da357504" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:02 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:c25f6eca-fd96-47ad-856d-414d5bb9f96b" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14994" + ], + "x-ms-correlation-request-id": [ + "b44e65f9-7edb-4934-9c1a-98a9c5fe07cf" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200403Z:b44e65f9-7edb-4934-9c1a-98a9c5fe07cf" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "47469427-8fc0-4484-978d-3f7a1db08b62" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"PolicyDefinitionNotFound\",\r\n \"message\": \"The policy definition 'azsmnet9498' could not be found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "113" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:02 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:89216389-0ba6-4345-95e9-f883492b4b53" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14993" + ], + "x-ms-correlation-request-id": [ + "b9dfa321-9a19-4963-95b9-8292e3effe65" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200403Z:b9dfa321-9a19-4963-95b9-8292e3effe65" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucz9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "82d9eab1-15ec-4ef9-8528-f3f162eba295" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Enforce tag exists\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Enforces a required tag.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"[parameters('tagName')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"1e30110a-5ceb-460c-a204-c1c3969c6d62\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Apply tag and its default value\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Applies a required tag and its default value if it is not specified by the user.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Value of the tag, such as headquarter\",\r\n \"strongType\": \"tagValue\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"[concat('tags.',parameters('tagName'))]\",\r\n \"exists\": \"false\"\r\n },\r\n \"then\": {\r\n \"effect\": \"append\",\r\n \"details\": [\r\n {\r\n \"field\": \"[concat('tags.',parameters('tagName'))]\",\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"2a0e14a6-b0a6-4fab-991a-187a4f81c498\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Prohibited resource types\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy enables you to specify the resource types that your organization cannot deploy.\",\r\n \"parameters\": {\r\n \"listOfResourceTypesNotAllowed\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array containing resource types that are not permitted.\",\r\n \"displayName\": \"Not allowed resource types\",\r\n \"strongType\": \"resourceTypes\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"in\": \"[parameters('listOfResourceTypesNotAllowed')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/6c112d4e-5bc7-47ae-a041-ea2d9dccd749\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"6c112d4e-5bc7-47ae-a041-ea2d9dccd749\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Restricted Service Catalog\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role blocking access to specified services\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"anyOf\": [\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicCompute/*\"\r\n },\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicStorage/*\"\r\n },\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicNetwork/*\"\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/6fdb9205-3462-4cfc-87d8-16c7860b53f4\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"6fdb9205-3462-4cfc-87d8-16c7860b53f4\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"ASC Ultimate POC\",\r\n \"policyType\": \"BuiltIn\",\r\n \"mode\": \"NotSpecified\",\r\n \"description\": \"ASC toggle\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Sql/servers\"\r\n },\r\n \"then\": {\r\n \"effect\": \"AuditIfNotExists\",\r\n \"details\": {\r\n \"type\": \"Microsoft.Security/complianceResults\",\r\n \"name\": \"patches\",\r\n \"existenceCondition\": {\r\n \"field\": \"Microsoft.Security/complianceResults/resourceStatus\",\r\n \"equals\": \"Compliant\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/76c2d4dc-4e5b-4c78-9da2-7d6ac5aaeb99\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"76c2d4dc-4e5b-4c78-9da2-7d6ac5aaeb99\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Europe Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in Europe region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"northeurope\",\r\n \"westeurope\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/94c19f19-8192-48cd-a11b-e37099d3e36b\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"94c19f19-8192-48cd-a11b-e37099d3e36b\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager US Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in US region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"westus\",\r\n \"eastus\",\r\n \"eastus2\",\r\n \"centralus\",\r\n \"northcentralus\",\r\n \"southcentralus\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/983211ba-f348-4758-983b-21fa29294869\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"983211ba-f348-4758-983b-21fa29294869\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Tags Value\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management with environment tag value only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags.environment\",\r\n \"in\": [\r\n \"production\",\r\n \"dev\",\r\n \"test\",\r\n \"staging\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/ac7e5fc0-c029-4b12-91d4-a8500ce697f9\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ac7e5fc0-c029-4b12-91d4-a8500ce697f9\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Virtual Machine SKU policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify a set of virtual machine SKUs that your organization can deploy.\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for virtual machines.\",\r\n \"displayName\": \"Permitted SKUs\",\r\n \"strongType\": \"VMSKUs\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Compute/virtualMachines\"\r\n },\r\n {\r\n \"not\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"Microsoft.Compute/virtualMachines/sku.name\",\r\n \"in\": \"[parameters('listOfAllowedSKUs')]\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy2\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy2\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Storage account SKUs policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify a set of storage account SKUs that your organization can deploy.\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for storage accounts.\",\r\n \"displayName\": \"Permitted SKUs\",\r\n \"strongType\": \"StorageSKUs\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Storage/storageAccounts\"\r\n },\r\n {\r\n \"not\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"Microsoft.Storage/storageAccounts/sku.name\",\r\n \"in\": \"[parameters('listOfAllowedSKUs')]\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy3\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy3\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Not allowed resource types policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify the resource types that your organization cannot deploy.\",\r\n \"parameters\": {\r\n \"listOfResourceTypesNotAllowed\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array containing resource types that are not permitted.\",\r\n \"displayName\": \"Not permitted resource types\",\r\n \"strongType\": \"resourceTypes\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"in\": \"[parameters('listOfResourceTypesNotAllowed')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy4\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy4\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"BuiltInPolicyAllowCentralUSOnly\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy that allows resource creation in central US only\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"equals\": \"central us\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/BuiltInPolicyAllowCentralUSOnly\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"BuiltInPolicyAllowCentralUSOnly\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Tags Key\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management with tag key only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"department\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/cd8dc879-a2ae-43c3-8211-1877c5755064\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cd8dc879-a2ae-43c3-8211-1877c5755064\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Japan Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in Japan region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"japaneast\",\r\n \"japanwest\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/e01598e8-6538-41ed-95e8-8b29746cd697\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"e01598e8-6538-41ed-95e8-8b29746cd697\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Geo-compliance policy template\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy enables you to restrict the locations your organization can specify when deploying resources. Use to enforce your geo-compliance requirements.\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/testbuiltinpolicy1\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testbuiltinpolicy1\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"testDefinition\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"created by Tian for test\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/testDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Web socket must be disabled on App Services\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Ensures web sockets are disabled on App Services.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"location\",\r\n \"equals\": \"foo\"\r\n },\r\n \"then\": {\r\n \"effect\": \"audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/AppServiceWebSockets\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"AppServiceWebSockets\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1308\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1308\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1646\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1646\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet170\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet170\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1741\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1741\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1918\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1918\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2040\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2040\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2588\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2588\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2687\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2687\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2713\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2713\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2991\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2991\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3061\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3061\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3271\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3271\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3309\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3309\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3317\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3317\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet344\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet344\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3590\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3590\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet370\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet370\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3774\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3774\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4038\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4038\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4142\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4142\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4634\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4634\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4720\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4720\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4798\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4798\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4927\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4927\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4967\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4967\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5040\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5040\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5058\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5058\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5231\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5231\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5504\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5504\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5555\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5555\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5584\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5584\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5775\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5775\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5805\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5805\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5963\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5963\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6531\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6531\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6633\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6633\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6730\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6730\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6802\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6802\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet695\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet695\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7021\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7021\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7387\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7387\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7537\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7537\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8288\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8288\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8293\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8293\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8526\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8526\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8663\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8663\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8948\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8948\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9017\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9017\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9044\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9044\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9255\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9255\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9304\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9304\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9375\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9375\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Allowed locations\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy enables you to restrict the locations your organization can specify when deploying resources.\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"eastus\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"Allowed locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('allowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/carolynPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"carolynPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Append tag if not exist\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy appends a tag to all resources.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"cheggTag\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"append\",\r\n \"details\": [\r\n {\r\n \"field\": \"tags.cheggTag\",\r\n \"value\": \"defaultValue\"\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggTagDefault\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure specific tag exists\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy restricts resource that don't have a certain tag.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"[parameters('tagKey')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggTagExists\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Restrict to 4 types (cheggert)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy restricts allowed resourcetypes to the big 4.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"anyOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Resources/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Compute/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Storage/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Network/*\"\r\n }\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggtype\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggtype\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager US Only Policy\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Policy Role auditing non westus resources\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"westus\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/gokmenhPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"gokmenhPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Audit allowed locations\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy enables you to audit your location.\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"The list of locations that can be specified when deploying resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"Allowed locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/LocationAudit\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"LocationAudit\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Audit if network watcher does not exist\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy audits if a network watcher resource does not exist in the same resource group as new VNets.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.KeyVault/vaults\"\r\n },\r\n \"then\": {\r\n \"effect\": \"auditIfNotExists\",\r\n \"details\": {\r\n \"type\": \"Microsoft.Network/networkWatchers\"\r\n }\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/networkWatcherExists\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"networkWatcherExists\"\r\n },\r\n {\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Policy to allow resource creation only in certain regions\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('allowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/regionPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"regionPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Enforce transparentDataEncryption enabled\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"This policy denies creation/updates of network interface cards if a specific NSG is not included.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Sql/servers/databases/transparentDataEncryption\"\r\n },\r\n {\r\n \"field\": \"Microsoft.Sql/transparentDataEncryption.status\",\r\n \"notequals\": \"Enabled\"\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/sqlEncryption\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"sqlEncryption\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:adf5c9f4-44b2-401a-b481-422e19b15d9d" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14998" + ], + "x-ms-correlation-request-id": [ + "45d6b1b7-37ae-4fe0-98cb-b9ef3be8b6a9" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200402Z:45d6b1b7-37ae-4fe0-98cb-b9ef3be8b6a9" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucz9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "cfc23463-969e-4d84-aaa6-8269df2b3b25" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Enforce tag exists\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Enforces a required tag.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"[parameters('tagName')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"1e30110a-5ceb-460c-a204-c1c3969c6d62\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Apply tag and its default value\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Applies a required tag and its default value if it is not specified by the user.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Value of the tag, such as headquarter\",\r\n \"strongType\": \"tagValue\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"[concat('tags.',parameters('tagName'))]\",\r\n \"exists\": \"false\"\r\n },\r\n \"then\": {\r\n \"effect\": \"append\",\r\n \"details\": [\r\n {\r\n \"field\": \"[concat('tags.',parameters('tagName'))]\",\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"2a0e14a6-b0a6-4fab-991a-187a4f81c498\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Prohibited resource types\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy enables you to specify the resource types that your organization cannot deploy.\",\r\n \"parameters\": {\r\n \"listOfResourceTypesNotAllowed\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array containing resource types that are not permitted.\",\r\n \"displayName\": \"Not allowed resource types\",\r\n \"strongType\": \"resourceTypes\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"in\": \"[parameters('listOfResourceTypesNotAllowed')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/6c112d4e-5bc7-47ae-a041-ea2d9dccd749\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"6c112d4e-5bc7-47ae-a041-ea2d9dccd749\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Restricted Service Catalog\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role blocking access to specified services\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"anyOf\": [\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicCompute/*\"\r\n },\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicStorage/*\"\r\n },\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicNetwork/*\"\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/6fdb9205-3462-4cfc-87d8-16c7860b53f4\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"6fdb9205-3462-4cfc-87d8-16c7860b53f4\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"ASC Ultimate POC\",\r\n \"policyType\": \"BuiltIn\",\r\n \"mode\": \"NotSpecified\",\r\n \"description\": \"ASC toggle\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Sql/servers\"\r\n },\r\n \"then\": {\r\n \"effect\": \"AuditIfNotExists\",\r\n \"details\": {\r\n \"type\": \"Microsoft.Security/complianceResults\",\r\n \"name\": \"patches\",\r\n \"existenceCondition\": {\r\n \"field\": \"Microsoft.Security/complianceResults/resourceStatus\",\r\n \"equals\": \"Compliant\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/76c2d4dc-4e5b-4c78-9da2-7d6ac5aaeb99\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"76c2d4dc-4e5b-4c78-9da2-7d6ac5aaeb99\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Europe Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in Europe region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"northeurope\",\r\n \"westeurope\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/94c19f19-8192-48cd-a11b-e37099d3e36b\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"94c19f19-8192-48cd-a11b-e37099d3e36b\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager US Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in US region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"westus\",\r\n \"eastus\",\r\n \"eastus2\",\r\n \"centralus\",\r\n \"northcentralus\",\r\n \"southcentralus\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/983211ba-f348-4758-983b-21fa29294869\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"983211ba-f348-4758-983b-21fa29294869\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Tags Value\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management with environment tag value only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags.environment\",\r\n \"in\": [\r\n \"production\",\r\n \"dev\",\r\n \"test\",\r\n \"staging\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/ac7e5fc0-c029-4b12-91d4-a8500ce697f9\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ac7e5fc0-c029-4b12-91d4-a8500ce697f9\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Virtual Machine SKU policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify a set of virtual machine SKUs that your organization can deploy.\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for virtual machines.\",\r\n \"displayName\": \"Permitted SKUs\",\r\n \"strongType\": \"VMSKUs\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Compute/virtualMachines\"\r\n },\r\n {\r\n \"not\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"Microsoft.Compute/virtualMachines/sku.name\",\r\n \"in\": \"[parameters('listOfAllowedSKUs')]\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy2\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy2\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Storage account SKUs policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify a set of storage account SKUs that your organization can deploy.\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for storage accounts.\",\r\n \"displayName\": \"Permitted SKUs\",\r\n \"strongType\": \"StorageSKUs\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Storage/storageAccounts\"\r\n },\r\n {\r\n \"not\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"Microsoft.Storage/storageAccounts/sku.name\",\r\n \"in\": \"[parameters('listOfAllowedSKUs')]\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy3\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy3\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Not allowed resource types policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify the resource types that your organization cannot deploy.\",\r\n \"parameters\": {\r\n \"listOfResourceTypesNotAllowed\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array containing resource types that are not permitted.\",\r\n \"displayName\": \"Not permitted resource types\",\r\n \"strongType\": \"resourceTypes\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"in\": \"[parameters('listOfResourceTypesNotAllowed')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy4\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy4\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"BuiltInPolicyAllowCentralUSOnly\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy that allows resource creation in central US only\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"equals\": \"central us\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/BuiltInPolicyAllowCentralUSOnly\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"BuiltInPolicyAllowCentralUSOnly\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Tags Key\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management with tag key only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"department\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/cd8dc879-a2ae-43c3-8211-1877c5755064\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cd8dc879-a2ae-43c3-8211-1877c5755064\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Japan Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in Japan region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"japaneast\",\r\n \"japanwest\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/e01598e8-6538-41ed-95e8-8b29746cd697\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"e01598e8-6538-41ed-95e8-8b29746cd697\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Geo-compliance policy template\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy enables you to restrict the locations your organization can specify when deploying resources. Use to enforce your geo-compliance requirements.\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/testbuiltinpolicy1\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testbuiltinpolicy1\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"testDefinition\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"created by Tian for test\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/testDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Web socket must be disabled on App Services\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Ensures web sockets are disabled on App Services.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"location\",\r\n \"equals\": \"foo\"\r\n },\r\n \"then\": {\r\n \"effect\": \"audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/AppServiceWebSockets\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"AppServiceWebSockets\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1308\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1308\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1646\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1646\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet170\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet170\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1741\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1741\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1918\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1918\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2040\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2040\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2588\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2588\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2687\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2687\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2713\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2713\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2991\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2991\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3061\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3061\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3271\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3271\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3309\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3309\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3317\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3317\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet344\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet344\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3590\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3590\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet370\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet370\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3774\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3774\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4038\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4038\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4142\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4142\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4634\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4634\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4720\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4720\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4798\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4798\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4927\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4927\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4967\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4967\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5040\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5040\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5058\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5058\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5231\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5231\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5504\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5504\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5555\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5555\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5584\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5584\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5775\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5775\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5805\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5805\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5963\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5963\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6531\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6531\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6633\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6633\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6730\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6730\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6802\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6802\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet695\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet695\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7021\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7021\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7387\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7387\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7537\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7537\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8288\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8288\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8293\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8293\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8526\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8526\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8663\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8663\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8948\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8948\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9017\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9017\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9044\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9044\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9255\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9255\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9304\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9304\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9375\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9375\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Allowed locations\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy enables you to restrict the locations your organization can specify when deploying resources.\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"eastus\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"Allowed locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('allowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/carolynPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"carolynPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Append tag if not exist\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy appends a tag to all resources.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"cheggTag\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"append\",\r\n \"details\": [\r\n {\r\n \"field\": \"tags.cheggTag\",\r\n \"value\": \"defaultValue\"\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggTagDefault\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure specific tag exists\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy restricts resource that don't have a certain tag.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"[parameters('tagKey')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggTagExists\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Restrict to 4 types (cheggert)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy restricts allowed resourcetypes to the big 4.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"anyOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Resources/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Compute/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Storage/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Network/*\"\r\n }\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggtype\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggtype\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager US Only Policy\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Policy Role auditing non westus resources\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"westus\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/gokmenhPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"gokmenhPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Audit allowed locations\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy enables you to audit your location.\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"The list of locations that can be specified when deploying resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"Allowed locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/LocationAudit\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"LocationAudit\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Audit if network watcher does not exist\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy audits if a network watcher resource does not exist in the same resource group as new VNets.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.KeyVault/vaults\"\r\n },\r\n \"then\": {\r\n \"effect\": \"auditIfNotExists\",\r\n \"details\": {\r\n \"type\": \"Microsoft.Network/networkWatchers\"\r\n }\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/networkWatcherExists\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"networkWatcherExists\"\r\n },\r\n {\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Policy to allow resource creation only in certain regions\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('allowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/regionPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"regionPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Enforce transparentDataEncryption enabled\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"This policy denies creation/updates of network interface cards if a specific NSG is not included.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Sql/servers/databases/transparentDataEncryption\"\r\n },\r\n {\r\n \"field\": \"Microsoft.Sql/transparentDataEncryption.status\",\r\n \"notequals\": \"Enabled\"\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/sqlEncryption\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"sqlEncryption\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:02 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:1f3296e5-792a-4bec-8a73-c93ae9777c91" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14995" + ], + "x-ms-correlation-request-id": [ + "863a7d39-3095-4661-818a-627d91c04aba" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200402Z:863a7d39-3095-4661-818a-627d91c04aba" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucz9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "03197f51-7933-4db8-94f9-cef8e3e3cd75" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Enforce tag exists\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Enforces a required tag.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"[parameters('tagName')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"1e30110a-5ceb-460c-a204-c1c3969c6d62\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Apply tag and its default value\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Applies a required tag and its default value if it is not specified by the user.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Value of the tag, such as headquarter\",\r\n \"strongType\": \"tagValue\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"[concat('tags.',parameters('tagName'))]\",\r\n \"exists\": \"false\"\r\n },\r\n \"then\": {\r\n \"effect\": \"append\",\r\n \"details\": [\r\n {\r\n \"field\": \"[concat('tags.',parameters('tagName'))]\",\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"2a0e14a6-b0a6-4fab-991a-187a4f81c498\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Prohibited resource types\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy enables you to specify the resource types that your organization cannot deploy.\",\r\n \"parameters\": {\r\n \"listOfResourceTypesNotAllowed\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array containing resource types that are not permitted.\",\r\n \"displayName\": \"Not allowed resource types\",\r\n \"strongType\": \"resourceTypes\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"in\": \"[parameters('listOfResourceTypesNotAllowed')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/6c112d4e-5bc7-47ae-a041-ea2d9dccd749\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"6c112d4e-5bc7-47ae-a041-ea2d9dccd749\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Restricted Service Catalog\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role blocking access to specified services\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"anyOf\": [\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicCompute/*\"\r\n },\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicStorage/*\"\r\n },\r\n {\r\n \"source\": \"action\",\r\n \"like\": \"Microsoft.ClassicNetwork/*\"\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/6fdb9205-3462-4cfc-87d8-16c7860b53f4\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"6fdb9205-3462-4cfc-87d8-16c7860b53f4\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"ASC Ultimate POC\",\r\n \"policyType\": \"BuiltIn\",\r\n \"mode\": \"NotSpecified\",\r\n \"description\": \"ASC toggle\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Sql/servers\"\r\n },\r\n \"then\": {\r\n \"effect\": \"AuditIfNotExists\",\r\n \"details\": {\r\n \"type\": \"Microsoft.Security/complianceResults\",\r\n \"name\": \"patches\",\r\n \"existenceCondition\": {\r\n \"field\": \"Microsoft.Security/complianceResults/resourceStatus\",\r\n \"equals\": \"Compliant\"\r\n }\r\n }\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/76c2d4dc-4e5b-4c78-9da2-7d6ac5aaeb99\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"76c2d4dc-4e5b-4c78-9da2-7d6ac5aaeb99\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Europe Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in Europe region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"northeurope\",\r\n \"westeurope\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/94c19f19-8192-48cd-a11b-e37099d3e36b\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"94c19f19-8192-48cd-a11b-e37099d3e36b\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager US Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in US region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"westus\",\r\n \"eastus\",\r\n \"eastus2\",\r\n \"centralus\",\r\n \"northcentralus\",\r\n \"southcentralus\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/983211ba-f348-4758-983b-21fa29294869\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"983211ba-f348-4758-983b-21fa29294869\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Tags Value\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management with environment tag value only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags.environment\",\r\n \"in\": [\r\n \"production\",\r\n \"dev\",\r\n \"test\",\r\n \"staging\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/ac7e5fc0-c029-4b12-91d4-a8500ce697f9\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"ac7e5fc0-c029-4b12-91d4-a8500ce697f9\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Virtual Machine SKU policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify a set of virtual machine SKUs that your organization can deploy.\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for virtual machines.\",\r\n \"displayName\": \"Permitted SKUs\",\r\n \"strongType\": \"VMSKUs\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Compute/virtualMachines\"\r\n },\r\n {\r\n \"not\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"Microsoft.Compute/virtualMachines/sku.name\",\r\n \"in\": \"[parameters('listOfAllowedSKUs')]\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy2\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy2\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Storage account SKUs policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify a set of storage account SKUs that your organization can deploy.\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for storage accounts.\",\r\n \"displayName\": \"Permitted SKUs\",\r\n \"strongType\": \"StorageSKUs\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Storage/storageAccounts\"\r\n },\r\n {\r\n \"not\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"Microsoft.Storage/storageAccounts/sku.name\",\r\n \"in\": \"[parameters('listOfAllowedSKUs')]\"\r\n }\r\n ]\r\n }\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy3\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy3\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Not allowed resource types policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This template enables you to specify the resource types that your organization cannot deploy.\",\r\n \"parameters\": {\r\n \"listOfResourceTypesNotAllowed\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array containing resource types that are not permitted.\",\r\n \"displayName\": \"Not permitted resource types\",\r\n \"strongType\": \"resourceTypes\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"in\": \"[parameters('listOfResourceTypesNotAllowed')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy4\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"builtinpolicy4\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"BuiltInPolicyAllowCentralUSOnly\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy that allows resource creation in central US only\",\r\n \"parameters\": {},\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"equals\": \"central us\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/BuiltInPolicyAllowCentralUSOnly\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"BuiltInPolicyAllowCentralUSOnly\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Tags Key\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management with tag key only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"department\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/cd8dc879-a2ae-43c3-8211-1877c5755064\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cd8dc879-a2ae-43c3-8211-1877c5755064\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager Japan Only Policy\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Policy Role allowing resource management in Japan region only\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"japaneast\",\r\n \"japanwest\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/e01598e8-6538-41ed-95e8-8b29746cd697\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"e01598e8-6538-41ed-95e8-8b29746cd697\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Geo-compliance policy template\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy enables you to restrict the locations your organization can specify when deploying resources. Use to enforce your geo-compliance requirements.\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/testbuiltinpolicy1\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testbuiltinpolicy1\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"testDefinition\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"created by Tian for test\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"Microsoft.Resources/Subscriptions/ResourceGroups/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"Deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policyDefinitions/testDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"testDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Web socket must be disabled on App Services\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Ensures web sockets are disabled on App Services.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"location\",\r\n \"equals\": \"foo\"\r\n },\r\n \"then\": {\r\n \"effect\": \"audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/AppServiceWebSockets\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"AppServiceWebSockets\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1308\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1308\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1646\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1646\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet170\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet170\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1741\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1741\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet1918\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet1918\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2040\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2040\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2588\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2588\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2687\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2687\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2713\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2713\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2991\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2991\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3061\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3061\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3271\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3271\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3309\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3309\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3317\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3317\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet344\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet344\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3590\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3590\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet370\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet370\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3774\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3774\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4038\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4038\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4142\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4142\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4634\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4634\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4720\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4720\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4798\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4798\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4927\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4927\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet4967\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet4967\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5040\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5040\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5058\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5058\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5231\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5231\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5504\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5504\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5555\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5555\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5584\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5584\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5775\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5775\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5805\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5805\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5963\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet5963\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6531\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6531\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6633\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6633\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6730\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6730\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet6802\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet6802\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet695\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet695\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7021\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7021\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7387\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7387\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet7537\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet7537\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8288\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8288\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8293\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8293\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8526\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8526\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8663\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8663\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8948\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8948\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9017\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9017\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9044\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9044\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9255\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9255\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9304\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9304\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9375\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9375\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Allowed locations\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy enables you to restrict the locations your organization can specify when deploying resources.\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"eastus\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"Allowed locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('allowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/carolynPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"carolynPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Append tag if not exist\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy appends a tag to all resources.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"cheggTag\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"append\",\r\n \"details\": [\r\n {\r\n \"field\": \"tags.cheggTag\",\r\n \"value\": \"defaultValue\"\r\n }\r\n ]\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggTagDefault\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure specific tag exists\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy restricts resource that don't have a certain tag.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"tags\",\r\n \"containsKey\": \"[parameters('tagKey')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggTagExists\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Restrict to 4 types (cheggert)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy restricts allowed resourcetypes to the big 4.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"anyOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Resources/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Compute/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Storage/*\"\r\n },\r\n {\r\n \"field\": \"type\",\r\n \"like\": \"Microsoft.Network/*\"\r\n }\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggtype\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"cheggtype\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Azure Resource Manager US Only Policy\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Policy Role auditing non westus resources\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": [\r\n \"westus\"\r\n ]\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/gokmenhPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"gokmenhPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Audit allowed locations\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy enables you to audit your location.\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"The list of locations that can be specified when deploying resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"Allowed locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('listOfAllowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"Audit\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/LocationAudit\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"LocationAudit\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Audit if network watcher does not exist\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy audits if a network watcher resource does not exist in the same resource group as new VNets.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.KeyVault/vaults\"\r\n },\r\n \"then\": {\r\n \"effect\": \"auditIfNotExists\",\r\n \"details\": {\r\n \"type\": \"Microsoft.Network/networkWatchers\"\r\n }\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/networkWatcherExists\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"networkWatcherExists\"\r\n },\r\n {\r\n \"properties\": {\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Policy to allow resource creation only in certain regions\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted locations for resources.\",\r\n \"strongType\": \"location\",\r\n \"displayName\": \"List of locations\"\r\n }\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"not\": {\r\n \"field\": \"location\",\r\n \"in\": \"[parameters('allowedLocations')]\"\r\n }\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/regionPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"regionPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Enforce transparentDataEncryption enabled\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"This policy denies creation/updates of network interface cards if a specific NSG is not included.\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"allOf\": [\r\n {\r\n \"field\": \"type\",\r\n \"equals\": \"Microsoft.Sql/servers/databases/transparentDataEncryption\"\r\n },\r\n {\r\n \"field\": \"Microsoft.Sql/transparentDataEncryption.status\",\r\n \"notequals\": \"Enabled\"\r\n }\r\n ]\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/sqlEncryption\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"sqlEncryption\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:02 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:9f8200c7-9dae-4625-b621-ae19e681cd3d" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14992" + ], + "x-ms-correlation-request-id": [ + "fb6b6f4a-a23f-4254-ae64-95ba089a4d2d" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200403Z:fb6b6f4a-a23f-4254-ae64-95ba089a4d2d" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "672b2c02-d8c8-4df2-8263-e008ce3de56a" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:01 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:3a446dcc-cb57-4ba6-8c2b-e658a9f7d330" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1195" + ], + "x-ms-correlation-request-id": [ + "55caa74c-8853-4439-9d6d-64d4818de384" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200402Z:55caa74c-8853-4439-9d6d-64d4818de384" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet9498?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0OTQ5OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "cc3246e7-7d5c-4e9a-a2cb-db746c73b38b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicyDefinition Policy\",\r\n \"policyType\": \"Custom\",\r\n \"mode\": \"All\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9498\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet9498\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:02 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:83c91362-e455-45ca-895a-44e42a4bbed0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1193" + ], + "x-ms-correlation-request-id": [ + "4d39907e-9a59-4a66-9ad9-20c6e0211cb2" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200403Z:4d39907e-9a59-4a66-9ad9-20c6e0211cb2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "CanCrudPolicyDefinition": [ + "azsmnet9498" + ] + }, + "Variables": { + "SubscriptionId": "0c82cadf-f711-4825-bcaf-44189e8baa9f" + } +} \ No newline at end of file diff --git a/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicySetDefinition.json b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicySetDefinition.json new file mode 100644 index 000000000000..1e22781c73d2 --- /dev/null +++ b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/CanCrudPolicySetDefinition.json @@ -0,0 +1,1022 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3906?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzkwNj9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "325" + ], + "x-ms-client-request-id": [ + "f28862af-12c2-4155-93a0-29c1e54b7ee1" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3906\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "444" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:8ccbec8d-04a7-4fc9-a0bc-c34dbe3acafb" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1192" + ], + "x-ms-correlation-request-id": [ + "22d684a5-1bfb-4330-90a0-2fd8f9692faa" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200404Z:22d684a5-1bfb-4330-90a0-2fd8f9692faa" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3906?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzkwNj9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "351" + ], + "x-ms-client-request-id": [ + "ca969891-9f0c-42e1-a786-9fb0e99f737d" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3906\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "429" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:4e63f9c0-21a3-42e9-bab8-d6426c55f5d5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1187" + ], + "x-ms-correlation-request-id": [ + "34f49d4f-fa43-4c52-b274-81a936806bdf" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:34f49d4f-fa43-4c52-b274-81a936806bdf" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "302" + ], + "x-ms-client-request-id": [ + "df17579f-4f4c-41eb-8c74-d0603a7a6bca" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "465" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:66750be1-23bd-4859-a5c4-99b220277387" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1191" + ], + "x-ms-correlation-request-id": [ + "4350e682-f5b4-487b-874f-be1d8c81fbf9" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200404Z:4350e682-f5b4-487b-874f-be1d8c81fbf9" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "575" + ], + "x-ms-client-request-id": [ + "e2a78bf5-ae3d-4ae4-9528-74fec31014bb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:819560b2-d71b-4939-b519-30b939ebfdb1" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1190" + ], + "x-ms-correlation-request-id": [ + "fa4bd941-89e7-4184-80be-544d086950db" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200404Z:fa4bd941-89e7-4184-80be-544d086950db" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"parameters\": {\r\n \"fooSet\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"value\": \"[parameters('fooSet')]\"\r\n }\r\n }\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "502" + ], + "x-ms-client-request-id": [ + "4bd463eb-8a84-441b-8ec7-ec456f4f5cc1" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"fooSet\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"value\": \"[parameters('fooSet')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "563" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:ad18602b-1cf9-4b6b-8b46-0475fe342f53" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1186" + ], + "x-ms-correlation-request-id": [ + "22e7510f-338f-4585-a3cf-d4c44f200c4f" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:22e7510f-338f-4585-a3cf-d4c44f200c4f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ed0cd5e7-2dc4-4fa4-90c8-cd2c78a88804" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:a1b82707-6d15-4fe5-bcc3-68811e5b974b" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14991" + ], + "x-ms-correlation-request-id": [ + "354d4a4e-217f-4c70-ba64-b0ff29b07b87" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200404Z:354d4a4e-217f-4c70-ba64-b0ff29b07b87" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "a0abc05a-57d6-46f2-987a-89c1caed5a0f" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:6c5bec1f-8168-4c97-a52e-b90725f1ea20" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14989" + ], + "x-ms-correlation-request-id": [ + "2b35eb0a-d309-4cba-915f-773772d6b8d8" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200404Z:2b35eb0a-d309-4cba-915f-773772d6b8d8" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "d2c2f4d2-40a9-4178-a487-d7437cec5055" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"PolicySetDefinitionNotFound\",\r\n \"message\": \"The policy set definition 'azsmnet973' could not be found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "119" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:cfd4f998-06b4-44c4-9232-ea21955f4189" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14988" + ], + "x-ms-correlation-request-id": [ + "8dd05b50-2110-469b-b4df-b1493c427858" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:8dd05b50-2110-469b-b4df-b1493c427858" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "e2b9d30c-4d3b-4a0c-9e32-4d8411185f2f" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"fooSet\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"value\": \"[parameters('fooSet')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:b3ad9c0d-9230-44fe-b340-f7429a03eff7" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14986" + ], + "x-ms-correlation-request-id": [ + "7f0cc793-8521-4831-aa6c-8808345e689c" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:7f0cc793-8521-4831-aa6c-8808345e689c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "543c2c5d-6482-45a5-82cf-0cd656d24b59" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"PolicySetDefinitionNotFound\",\r\n \"message\": \"The policy set definition 'azsmnet973' could not be found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "119" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:a14781d5-f445-4335-8e21-56048c110b50" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14985" + ], + "x-ms-correlation-request-id": [ + "1cdff72b-4cf4-4853-8f01-f69c4ca7b621" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200406Z:1cdff72b-4cf4-4853-8f01-f69c4ca7b621" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 404 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucz9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "f22319b2-c245-476d-ae85-5204431a9d1e" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag exists\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy ensures that a specific tag is set, providing a default value if it is not.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Value of the tag, such as headquarter\",\r\n \"strongType\": \"tagValue\"\r\n }\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policySetDefinitions/686b65fa-af26-4f41-8bd2-4cc9824a7339\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"686b65fa-af26-4f41-8bd2-4cc9824a7339\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Restrict sku choices\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Restricts sku choices for popular resource types\",\r\n \"metadata\": {\r\n \"category\": \"Cost Management\"\r\n },\r\n \"parameters\": {\r\n \"allowedVMSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for virtual machines.\",\r\n \"displayName\": \"Permitted VM SKUs\",\r\n \"strongType\": \"VMSKUs\"\r\n }\r\n },\r\n \"allowedStorageSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for storage accounts.\",\r\n \"displayName\": \"Permitted Storage SKUs\",\r\n \"strongType\": \"StorageSKUs\"\r\n }\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy2\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"value\": \"[parameters('allowedVMSKUs')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy3\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"value\": \"[parameters('allowedStorageSKUs')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policySetDefinitions/e3edee14-9e91-424f-bd6e-6600c84759a3\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"e3edee14-9e91-424f-bd6e-6600c84759a3\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9375\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet1259\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet1259\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2991\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet3760\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet3760\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5584\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet5820\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet5820\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (carolynz)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"[parameters('tagKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/carolynPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"carolynPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (cheggert)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {},\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"cheggTag\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/cheggTag\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"cheggTag\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (Fer)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"[parameters('tagKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/Ensure tag value (t-feruil)\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"Ensure tag value (t-feruil)\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Security for Express Route Subscriptions\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Ensures Express Route subscriptions meet security requirements.\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/AppServiceWebSockets\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/expressRouteRGSecurity\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"expressRouteRGSecurity\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Allowed locations initiative\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This initiative enables you to restrict the locations of deploying resources .\",\r\n \"parameters\": {\r\n \"locationsListKey\": {\r\n \"type\": \"Array\",\r\n \"allowedValues\": [\r\n \"East Asia\",\r\n \"Southeast Asia\",\r\n \"Central US\",\r\n \"East US\",\r\n \"East US 2\",\r\n \"West US\",\r\n \"North Central US\",\r\n \"South Central US\",\r\n \"North Europe\",\r\n \"West Europe\",\r\n \"Japan West\",\r\n \"Japan East\",\r\n \"Brazil South\",\r\n \"Australia East\",\r\n \"Australia Southeast\"\r\n ]\r\n },\r\n \"tagName\": {\r\n \"type\": \"String\"\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\"\r\n },\r\n \"listOfAuditLocations\": {\r\n \"type\": \"Array\",\r\n \"allowedValues\": [\r\n \"East Asia\",\r\n \"Southeast Asia\",\r\n \"Central US\",\r\n \"East US\",\r\n \"East US 2\",\r\n \"West US\",\r\n \"North Central US\",\r\n \"South Central US\",\r\n \"North Europe\",\r\n \"West Europe\",\r\n \"Japan West\",\r\n \"Japan East\",\r\n \"Brazil South\",\r\n \"Australia East\",\r\n \"Australia Southeast\"\r\n ]\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/regionPolicyDefinition\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"value\": \"[parameters('locationsListKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/LocationAudit\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": \"[parameters('listOfAuditLocations')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/LocationInitiative\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"LocationInitiative\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:c2169b9e-79fa-49e2-a2d0-8255cc68c560" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14990" + ], + "x-ms-correlation-request-id": [ + "ae6ceb06-2ae7-4108-b155-6f59f234c0e6" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200404Z:ae6ceb06-2ae7-4108-b155-6f59f234c0e6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucz9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "46c746ac-4226-4359-8c70-492b879c56d8" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag exists\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy ensures that a specific tag is set, providing a default value if it is not.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Value of the tag, such as headquarter\",\r\n \"strongType\": \"tagValue\"\r\n }\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policySetDefinitions/686b65fa-af26-4f41-8bd2-4cc9824a7339\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"686b65fa-af26-4f41-8bd2-4cc9824a7339\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Restrict sku choices\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Restricts sku choices for popular resource types\",\r\n \"metadata\": {\r\n \"category\": \"Cost Management\"\r\n },\r\n \"parameters\": {\r\n \"allowedVMSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for virtual machines.\",\r\n \"displayName\": \"Permitted VM SKUs\",\r\n \"strongType\": \"VMSKUs\"\r\n }\r\n },\r\n \"allowedStorageSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for storage accounts.\",\r\n \"displayName\": \"Permitted Storage SKUs\",\r\n \"strongType\": \"StorageSKUs\"\r\n }\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy2\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"value\": \"[parameters('allowedVMSKUs')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy3\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"value\": \"[parameters('allowedStorageSKUs')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policySetDefinitions/e3edee14-9e91-424f-bd6e-6600c84759a3\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"e3edee14-9e91-424f-bd6e-6600c84759a3\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9375\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet1259\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet1259\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2991\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet3760\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet3760\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5584\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet5820\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet5820\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (carolynz)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"[parameters('tagKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/carolynPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"carolynPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (cheggert)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {},\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"cheggTag\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/cheggTag\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"cheggTag\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (Fer)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"[parameters('tagKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/Ensure tag value (t-feruil)\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"Ensure tag value (t-feruil)\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Security for Express Route Subscriptions\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Ensures Express Route subscriptions meet security requirements.\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/AppServiceWebSockets\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/expressRouteRGSecurity\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"expressRouteRGSecurity\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Allowed locations initiative\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This initiative enables you to restrict the locations of deploying resources .\",\r\n \"parameters\": {\r\n \"locationsListKey\": {\r\n \"type\": \"Array\",\r\n \"allowedValues\": [\r\n \"East Asia\",\r\n \"Southeast Asia\",\r\n \"Central US\",\r\n \"East US\",\r\n \"East US 2\",\r\n \"West US\",\r\n \"North Central US\",\r\n \"South Central US\",\r\n \"North Europe\",\r\n \"West Europe\",\r\n \"Japan West\",\r\n \"Japan East\",\r\n \"Brazil South\",\r\n \"Australia East\",\r\n \"Australia Southeast\"\r\n ]\r\n },\r\n \"tagName\": {\r\n \"type\": \"String\"\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\"\r\n },\r\n \"listOfAuditLocations\": {\r\n \"type\": \"Array\",\r\n \"allowedValues\": [\r\n \"East Asia\",\r\n \"Southeast Asia\",\r\n \"Central US\",\r\n \"East US\",\r\n \"East US 2\",\r\n \"West US\",\r\n \"North Central US\",\r\n \"South Central US\",\r\n \"North Europe\",\r\n \"West Europe\",\r\n \"Japan West\",\r\n \"Japan East\",\r\n \"Brazil South\",\r\n \"Australia East\",\r\n \"Australia Southeast\"\r\n ]\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/regionPolicyDefinition\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"value\": \"[parameters('locationsListKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/LocationAudit\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": \"[parameters('listOfAuditLocations')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/LocationInitiative\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"LocationInitiative\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:7bafdb18-90da-4c0b-a55b-30efd9f5b0e6" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14987" + ], + "x-ms-correlation-request-id": [ + "68e3d6c7-9e89-4c67-af29-ef2077daa32e" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:68e3d6c7-9e89-4c67-af29-ef2077daa32e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucz9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "35111c28-a1f8-476d-818e-5ad322383022" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag exists\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"This policy ensures that a specific tag is set, providing a default value if it is not.\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Name of the tag, such as costCenter\",\r\n \"strongType\": \"tagName\"\r\n }\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\",\r\n \"metadata\": {\r\n \"description\": \"Value of the tag, such as headquarter\",\r\n \"strongType\": \"tagValue\"\r\n }\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/1e30110a-5ceb-460c-a204-c1c3969c6d62\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policySetDefinitions/686b65fa-af26-4f41-8bd2-4cc9824a7339\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"686b65fa-af26-4f41-8bd2-4cc9824a7339\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Restrict sku choices\",\r\n \"policyType\": \"BuiltIn\",\r\n \"description\": \"Restricts sku choices for popular resource types\",\r\n \"metadata\": {\r\n \"category\": \"Cost Management\"\r\n },\r\n \"parameters\": {\r\n \"allowedVMSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for virtual machines.\",\r\n \"displayName\": \"Permitted VM SKUs\",\r\n \"strongType\": \"VMSKUs\"\r\n }\r\n },\r\n \"allowedStorageSKUs\": {\r\n \"type\": \"Array\",\r\n \"metadata\": {\r\n \"description\": \"An array of permitted SKUs for storage accounts.\",\r\n \"displayName\": \"Permitted Storage SKUs\",\r\n \"strongType\": \"StorageSKUs\"\r\n }\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy2\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"value\": \"[parameters('allowedVMSKUs')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/builtinpolicy3\",\r\n \"parameters\": {\r\n \"listOfAllowedSKUs\": {\r\n \"value\": \"[parameters('allowedStorageSKUs')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/providers/Microsoft.Authorization/policySetDefinitions/e3edee14-9e91-424f-bd6e-6600c84759a3\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"e3edee14-9e91-424f-bd6e-6600c84759a3\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet9375\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet1259\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet1259\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2991\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet3760\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet3760\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5584\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet5820\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet5820\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (carolynz)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"[parameters('tagKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/carolynPolicyDefinition\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"carolynPolicyDefinition\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (cheggert)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {},\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"cheggTag\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/cheggTag\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"cheggTag\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Ensure tag value (Fer)\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This policy ensures that a specific tag is set with a set of pre-defined values.\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagExists\",\r\n \"parameters\": {\r\n \"tagKey\": {\r\n \"value\": \"[parameters('tagKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/cheggTagDefault\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/Ensure tag value (t-feruil)\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"Ensure tag value (t-feruil)\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Security for Express Route Subscriptions\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Ensures Express Route subscriptions meet security requirements.\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/AppServiceWebSockets\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/expressRouteRGSecurity\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"expressRouteRGSecurity\"\r\n },\r\n {\r\n \"properties\": {\r\n \"displayName\": \"Allowed locations initiative\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"This initiative enables you to restrict the locations of deploying resources .\",\r\n \"parameters\": {\r\n \"locationsListKey\": {\r\n \"type\": \"Array\",\r\n \"allowedValues\": [\r\n \"East Asia\",\r\n \"Southeast Asia\",\r\n \"Central US\",\r\n \"East US\",\r\n \"East US 2\",\r\n \"West US\",\r\n \"North Central US\",\r\n \"South Central US\",\r\n \"North Europe\",\r\n \"West Europe\",\r\n \"Japan West\",\r\n \"Japan East\",\r\n \"Brazil South\",\r\n \"Australia East\",\r\n \"Australia Southeast\"\r\n ]\r\n },\r\n \"tagName\": {\r\n \"type\": \"String\"\r\n },\r\n \"tagValue\": {\r\n \"type\": \"String\"\r\n },\r\n \"listOfAuditLocations\": {\r\n \"type\": \"Array\",\r\n \"allowedValues\": [\r\n \"East Asia\",\r\n \"Southeast Asia\",\r\n \"Central US\",\r\n \"East US\",\r\n \"East US 2\",\r\n \"West US\",\r\n \"North Central US\",\r\n \"South Central US\",\r\n \"North Europe\",\r\n \"West Europe\",\r\n \"Japan West\",\r\n \"Japan East\",\r\n \"Brazil South\",\r\n \"Australia East\",\r\n \"Australia Southeast\"\r\n ]\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/regionPolicyDefinition\",\r\n \"parameters\": {\r\n \"allowedLocations\": {\r\n \"value\": \"[parameters('locationsListKey')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/providers/Microsoft.Authorization/policyDefinitions/2a0e14a6-b0a6-4fab-991a-187a4f81c498\",\r\n \"parameters\": {\r\n \"tagName\": {\r\n \"value\": \"[parameters('tagName')]\"\r\n },\r\n \"tagValue\": {\r\n \"value\": \"[parameters('tagValue')]\"\r\n }\r\n }\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/LocationAudit\",\r\n \"parameters\": {\r\n \"listOfAllowedLocations\": {\r\n \"value\": \"[parameters('listOfAuditLocations')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/LocationInitiative\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"LocationInitiative\"\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:0cc70b15-fe5e-429f-9bf9-c983809c3fb4" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14984" + ], + "x-ms-correlation-request-id": [ + "427cad1c-5c28-403d-9bc2-d4babfd1e84c" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200406Z:427cad1c-5c28-403d-9bc2-d4babfd1e84c" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "24ad6b93-26f0-437a-8822-f6e2a2ee489c" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Updated CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"description\": \"Description text\",\r\n \"metadata\": {\r\n \"category\": \"sdk test\"\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n },\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\"\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:c8b79930-8a6d-4c82-b7d3-a5257754e8b6" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1189" + ], + "x-ms-correlation-request-id": [ + "52f58ef0-ce3f-458d-8a54-92eefdce9886" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:52f58ef0-ce3f-458d-8a54-92eefdce9886" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet973?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0OTczP2FwaS12ZXJzaW9uPTIwMTctMDYtMDEtcHJldmlldw==", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "0bbb535c-8b75-4ac1-ae19-c4d2015e0878" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Set Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"fooSet\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"value\": \"[parameters('fooSet')]\"\r\n }\r\n }\r\n }\r\n ]\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policySetDefinitions/azsmnet973\",\r\n \"type\": \"Microsoft.Authorization/policySetDefinitions\",\r\n \"name\": \"azsmnet973\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:1e7ea80b-e614-4dfe-9f3b-687ca74ac7d0" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1185" + ], + "x-ms-correlation-request-id": [ + "a4160cb9-94e9-4631-969d-32ce14bd310e" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:a4160cb9-94e9-4631-969d-32ce14bd310e" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3906?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzkwNj9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "857bd4bc-2e30-4893-8ce8-f3acc1a6199f" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3906\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:05 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:782f4927-c47d-4f8e-b59a-9d050362fc00" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1188" + ], + "x-ms-correlation-request-id": [ + "d747b192-f377-4ff2-97de-2fe6c57bc8a9" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200405Z:d747b192-f377-4ff2-97de-2fe6c57bc8a9" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3906?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzkwNj9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "ad012531-3dc0-457f-8dc4-1dd8857a619f" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicySetDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3906\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet3906\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:06 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:0e40c03a-0085-400a-b8f1-f2134656c70a" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1184" + ], + "x-ms-correlation-request-id": [ + "83916e39-9fa5-4a21-b830-613c932c3033" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200406Z:83916e39-9fa5-4a21-b830-613c932c3033" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "CanCrudPolicySetDefinition": [ + "azsmnet3906", + "azsmnet973" + ] + }, + "Variables": { + "SubscriptionId": "0c82cadf-f711-4825-bcaf-44189e8baa9f" + } +} \ No newline at end of file diff --git a/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicyAssignmentErrorHandling.json b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicyAssignmentErrorHandling.json new file mode 100644 index 000000000000..deddfbb798d1 --- /dev/null +++ b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicyAssignmentErrorHandling.json @@ -0,0 +1,317 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet8448?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0ODQ0OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "322" + ], + "x-ms-client-request-id": [ + "91370a2d-e965-48e6-9baf-5597c9788b5a" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8448\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8448\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "441" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:22 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:557518cb-91af-4b13-b2dd-76b4c915fbfa" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1181" + ], + "x-ms-correlation-request-id": [ + "707b0c6a-95bb-42f8-a1ce-d15fdc1ed149" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200422Z:707b0c6a-95bb-42f8-a1ce-d15fdc1ed149" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet6699?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDY2OTk/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Assignment\"\r\n },\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "126" + ], + "x-ms-client-request-id": [ + "c52d0bac-87d2-4f7a-830b-27ba5dbed415" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"InvalidRequestContent\",\r\n \"message\": \"The request content was invalid and could not be deserialized: 'Required property 'policyDefinitionId' not found in JSON. Path 'properties', line 4, position 4.'.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "217" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:22 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:6e34fd6a-5b7b-4c85-8040-c58f17adc5e5" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1180" + ], + "x-ms-correlation-request-id": [ + "8a9d2ce1-9d5a-4032-85e6-201a83a78826" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200422Z:8a9d2ce1-9d5a-4032-85e6-201a83a78826" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet6699?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDY2OTk/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5964\"\r\n },\r\n \"sku\": {\r\n \"name\": \"A0\",\r\n \"tier\": \"Free\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "272" + ], + "x-ms-client-request-id": [ + "55aed54e-eea5-4dfd-b6df-7cc5da4c8cc6" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"PolicyDefinitionNotFound\",\r\n \"message\": \"The policy assignment create request is invalid. The policy definition '/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet5964' could not be found.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "266" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:22 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:98135e1a-3249-4887-93fe-9a1a912ddcb8" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1179" + ], + "x-ms-correlation-request-id": [ + "60aa319b-f934-4143-9fea-c19957513ff3" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200422Z:60aa319b-f934-4143-9fea-c19957513ff3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "//subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyAssignments/azsmnet6699?api-version=2017-06-01-preview", + "EncodedRequestUri": "Ly9zdWJzY3JpcHRpb25zLzBjODJjYWRmLWY3MTEtNDgyNS1iY2FmLTQ0MTg5ZThiYWE5Zi9wcm92aWRlcnMvTWljcm9zb2Z0LkF1dGhvcml6YXRpb24vcG9saWN5QXNzaWdubWVudHMvYXpzbW5ldDY2OTk/YXBpLXZlcnNpb249MjAxNy0wNi0wMS1wcmV2aWV3", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Assignment\",\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8448\"\r\n },\r\n \"sku\": {\r\n \"name\": \"A2\",\r\n \"tier\": \"Free\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "272" + ], + "x-ms-client-request-id": [ + "34ec629f-9c41-43f5-baf7-b9e474f45210" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"InvalidPolicySku\",\r\n \"message\": \"The policy assignment 'azsmnet6699' request is invalid. The supported SKUs are '[{\\\"name\\\":\\\"A0\\\",\\\"tier\\\":\\\"Free\\\"},{\\\"name\\\":\\\"A1\\\",\\\"tier\\\":\\\"Standard\\\"}]'.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "209" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:22 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:56210b11-bde2-44e0-9d6d-09ca53bd37be" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1178" + ], + "x-ms-correlation-request-id": [ + "7069dc68-c9bb-4dc7-985b-98911fe4ee0f" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200422Z:7069dc68-c9bb-4dc7-985b-98911fe4ee0f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet8448?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0ODQ0OD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "99a23eb4-8489-4555-ba61-56519be7befa" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"CanCrudPolicyDefinition Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet8448\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet8448\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:22 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:b96db5c7-193f-4f50-8a82-7b33f67f3c61" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1177" + ], + "x-ms-correlation-request-id": [ + "37b315e9-6aed-45b8-920f-b3703c5508a3" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200422Z:37b315e9-6aed-45b8-920f-b3703c5508a3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "ValidatePolicyAssignmentErrorHandling": [ + "azsmnet8448", + "azsmnet6699", + "azsmnet5964" + ] + }, + "Variables": { + "SubscriptionId": "0c82cadf-f711-4825-bcaf-44189e8baa9f" + } +} \ No newline at end of file diff --git a/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicyDefinitionErrorHandling.json b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicyDefinitionErrorHandling.json new file mode 100644 index 000000000000..5fa6727183b3 --- /dev/null +++ b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicyDefinitionErrorHandling.json @@ -0,0 +1,256 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3383?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzM4Mz9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Definition\"\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "69" + ], + "x-ms-client-request-id": [ + "77efa088-ff70-4921-b1b3-5b4e3a520bff" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"InvalidRequestContent\",\r\n \"message\": \"The request content was invalid and could not be deserialized: 'Required property 'policyRule' not found in JSON. Path 'properties', line 4, position 4.'.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "209" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:06 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:cc88f307-0c3f-4cbb-ba5d-1e4a675ba208" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1186" + ], + "x-ms-correlation-request-id": [ + "d25fb297-6a32-423c-a845-737e13ea1156" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200407Z:d25fb297-6a32-423c-a845-737e13ea1156" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3383?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzM4Mz9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"mode\": \"Foo\",\r\n \"displayName\": \"Invalid Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "319" + ], + "x-ms-client-request-id": [ + "eac96ccd-b198-4cf5-9db3-0b2ed7197a25" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"InvalidRequestContent\",\r\n \"message\": \"The request content was invalid and could not be deserialized: 'Error converting value \\\"Foo\\\" to type 'System.Nullable`1[Microsoft.WindowsAzure.ResourceStack.Providers.Authorization.Data.Entities.PolicyMode]'. Path 'properties.mode', line 3, position 18.'.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "312" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:06 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:27baccea-bc57-4a48-85f5-de13e53cc6ff" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1185" + ], + "x-ms-correlation-request-id": [ + "f9d3736a-5998-4645-80f1-f2c4e9006da3" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200407Z:f9d3736a-5998-4645-80f1-f2c4e9006da3" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3383?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzM4Mz9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n },\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "379" + ], + "x-ms-client-request-id": [ + "d33822af-015d-4936-a526-b50b51c9f951" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"UnusedPolicyParameters\",\r\n \"message\": \"The policy 'azsmnet3383' has defined parameters 'foo' which are not used in the policy rule. Please either remove these parameters from the definition or ensure that they are used in the policy rule.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "255" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:07 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:76afa29c-7328-4778-9248-2439131ac52d" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1184" + ], + "x-ms-correlation-request-id": [ + "604e8a9f-1a07-455c-8c3c-d693e5c7d0d5" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200407Z:604e8a9f-1a07-455c-8c3c-d693e5c7d0d5" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet3383?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0MzM4Mz9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"[parameters('foo')]\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "245" + ], + "x-ms-client-request-id": [ + "22763920-bd22-440f-8dc2-9c4a0bf5f0a2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"InvalidPolicyParameters\",\r\n \"message\": \"The policy 'azsmnet3383' could not be parameterized because of validation errors. Please check if policy parameters are properly defined. The inner exception 'The policy 'azsmnet3383' has undefined parameter 'foo' which is used in the policy rule. Please either define it in policy definition or remove the reference in policy rule.'.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "392" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:07 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:0d297807-c8ca-4e03-8c32-45f4792ceeca" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1183" + ], + "x-ms-correlation-request-id": [ + "b084469a-8203-4561-812a-260d896406df" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200407Z:b084469a-8203-4561-812a-260d896406df" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + } + ], + "Names": { + "ValidatePolicyDefinitionErrorHandling": [ + "azsmnet3383" + ] + }, + "Variables": { + "SubscriptionId": "0c82cadf-f711-4825-bcaf-44189e8baa9f" + } +} \ No newline at end of file diff --git a/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicySetDefinitionErrorHandling.json b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicySetDefinitionErrorHandling.json new file mode 100644 index 000000000000..c8f1a72459d3 --- /dev/null +++ b/src/SDKs/Resource/Resource.Tests/SessionRecords/Policy.Tests.LivePolicyTests/ValidatePolicySetDefinitionErrorHandling.json @@ -0,0 +1,317 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet2840?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0Mjg0MD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "303" + ], + "x-ms-client-request-id": [ + "ee47a34f-99b3-41d5-837e-d54a8f19175b" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2840\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2840\"\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "422" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:13 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:a080a9df-8fef-4e1c-8e17-54e5852babba" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1186" + ], + "x-ms-correlation-request-id": [ + "0dc137f9-5194-4373-9081-bb1555bd0024" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200414Z:0dc137f9-5194-4373-9081-bb1555bd0024" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet5671?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0NTY3MT9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Set Definition\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3773\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "276" + ], + "x-ms-client-request-id": [ + "9e6378a6-e07b-403f-a7d0-3ee95ca32614" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"PolicyDefinitionNotFound\",\r\n \"message\": \"The policy set definition 'azsmnet5671' request is invalid. The following policy definitions could not be found: '/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet3773'.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "289" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:18 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:f133d34f-3f6e-4c93-93ed-ad77fd88c2a7" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1185" + ], + "x-ms-correlation-request-id": [ + "3e204ca2-dbbe-403d-ac2c-23ea177fe98f" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200418Z:3e204ca2-dbbe-403d-ac2c-23ea177fe98f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet5671?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0NTY3MT9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Set Definition\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"type\": \"String\"\r\n }\r\n },\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2840\"\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "356" + ], + "x-ms-client-request-id": [ + "6f011b4c-e541-4cc1-8e02-a92567316b35" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"UnusedPolicyParameters\",\r\n \"message\": \"The policy set 'azsmnet5671' has defined parameters 'foo' which are not used in referenced policy definitions. Please either remove these parameters from the definition or ensure that they are used.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "254" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:18 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:e65fea69-3616-449d-b805-94c40bf94c66" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1184" + ], + "x-ms-correlation-request-id": [ + "30f66102-6200-4fa4-a215-355e0998de48" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200418Z:30f66102-6200-4fa4-a215-355e0998de48" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policysetdefinitions/azsmnet5671?api-version=2017-06-01-preview", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lzZXRkZWZpbml0aW9ucy9henNtbmV0NTY3MT9hcGktdmVyc2lvbj0yMDE3LTA2LTAxLXByZXZpZXc=", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Invalid Set Definition\",\r\n \"policyDefinitions\": [\r\n {\r\n \"policyDefinitionId\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2840\",\r\n \"parameters\": {\r\n \"foo\": {\r\n \"value\": \"abc\"\r\n }\r\n }\r\n }\r\n ]\r\n }\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "374" + ], + "x-ms-client-request-id": [ + "e34d3f6a-d4ea-433e-9c83-b61b83b59be6" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"UndefinedPolicyParameter\",\r\n \"message\": \"The policy set definition 'azsmnet5671' is attempting to assign the parameter(s) 'foo' which are not defined in the policy definition 'azsmnet2840'.\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "206" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "centralus:e5e4d994-0a89-4b9a-9734-c18e0b89a72e" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1183" + ], + "x-ms-correlation-request-id": [ + "c949f8f2-69df-4bd0-b24c-05246f514af6" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200421Z:c949f8f2-69df-4bd0-b24c-05246f514af6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 400 + }, + { + "RequestUri": "/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policydefinitions/azsmnet2840?api-version=2016-12-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvMGM4MmNhZGYtZjcxMS00ODI1LWJjYWYtNDQxODllOGJhYTlmL3Byb3ZpZGVycy9NaWNyb3NvZnQuQXV0aG9yaXphdGlvbi9wb2xpY3lkZWZpbml0aW9ucy9henNtbmV0Mjg0MD9hcGktdmVyc2lvbj0yMDE2LTEyLTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "b1678088-2a41-41d9-99d8-30e43aba6013" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.25211.01", + "Microsoft.Azure.Management.ResourceManager.PolicyClient/1.7.0.0" + ] + }, + "ResponseBody": "{\r\n \"properties\": {\r\n \"displayName\": \"Test Policy Definition\",\r\n \"policyType\": \"Custom\",\r\n \"policyRule\": {\r\n \"if\": {\r\n \"source\": \"action\",\r\n \"equals\": \"ResourceProviderTestHost/TestResourceType/TestResourceTypeNestedOne/write\"\r\n },\r\n \"then\": {\r\n \"effect\": \"deny\"\r\n }\r\n }\r\n },\r\n \"id\": \"/subscriptions/0c82cadf-f711-4825-bcaf-44189e8baa9f/providers/Microsoft.Authorization/policyDefinitions/azsmnet2840\",\r\n \"type\": \"Microsoft.Authorization/policyDefinitions\",\r\n \"name\": \"azsmnet2840\"\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Thu, 05 Oct 2017 20:04:21 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Vary": [ + "Accept-Encoding", + "Accept-Encoding" + ], + "x-ms-request-id": [ + "centralus:20284a11-1be1-4c04-95ee-37ec97bbc163" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1182" + ], + "x-ms-correlation-request-id": [ + "8ed37f6f-a942-41f6-89c4-81c6e577927f" + ], + "x-ms-routing-request-id": [ + "CENTRALUS:20171005T200421Z:8ed37f6f-a942-41f6-89c4-81c6e577927f" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 200 + } + ], + "Names": { + "ValidatePolicySetDefinitionErrorHandling": [ + "azsmnet2840", + "azsmnet5671", + "azsmnet3773" + ] + }, + "Variables": { + "SubscriptionId": "0c82cadf-f711-4825-bcaf-44189e8baa9f" + } +} \ No newline at end of file diff --git a/src/SDKs/Resource/Resource.Tests/SpecTestSupport.Resources/ResourcesManagementTestUtilities.cs b/src/SDKs/Resource/Resource.Tests/SpecTestSupport.Resources/ResourcesManagementTestUtilities.cs index 7e396c2cf738..5a706336c41c 100644 --- a/src/SDKs/Resource/Resource.Tests/SpecTestSupport.Resources/ResourcesManagementTestUtilities.cs +++ b/src/SDKs/Resource/Resource.Tests/SpecTestSupport.Resources/ResourcesManagementTestUtilities.cs @@ -10,8 +10,6 @@ namespace Microsoft.Azure.Test { - - public static class ResourcesManagementTestUtilities { /// @@ -60,6 +58,17 @@ public static SubscriptionClient GetSubscriptionClientWithHandler(this TestBase return client; } + /// + /// Default constructor for management clients, using the TestSupport Infrastructure + /// + /// the test class + /// A policy client, created from the current context (environment variables) + public static PolicyClient GetPolicyClientWithHandler(this TestBase testBase, MockContext context, RecordedDelegatingHandler handler) + { + handler.IsPassThrough = true; + return context.GetServiceClient(handlers: handler); + } + /// /// Get a default resource location for a given resource type /// diff --git a/src/SDKs/_metadata/resources_resource-manager.txt b/src/SDKs/_metadata/resources_resource-manager.txt new file mode 100644 index 000000000000..02abd90f6bf9 --- /dev/null +++ b/src/SDKs/_metadata/resources_resource-manager.txt @@ -0,0 +1,10 @@ +2017-10-05 22:43:25 UTC + +1) azure-rest-api-specs repository information +GitHub user: Azure +Branch: 75926b97fa6ea2c49e751d80c35aa916c6e5523a + +2) AutoRest information +Requested version: latest +Bootstrapper version: C:\Users\cheggert\AppData\Roaming\npm `-- autorest@2.0.4147 +Latest installed version: 2.0.4147