diff --git a/src/SDKs/OperationalInsights/Management/AzSdk.RP.props b/src/SDKs/OperationalInsights/Management/AzSdk.RP.props index 39645fa6dc05..84c383eb498a 100644 --- a/src/SDKs/OperationalInsights/Management/AzSdk.RP.props +++ b/src/SDKs/OperationalInsights/Management/AzSdk.RP.props @@ -1,7 +1,7 @@ - + OperationalInsights_2015-11-01-preview; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperations.cs index 144df1f97ff1..9e683fe44c10 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperations.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperations.cs @@ -1,18 +1,32 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { - 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; /// /// DataSourcesOperations operations. /// - internal partial class DataSourcesOperations : Microsoft.Rest.IServiceOperations, IDataSourcesOperations + internal partial class DataSourcesOperations : IServiceOperations, IDataSourcesOperations { /// /// Initializes a new instance of the DataSourcesOperations class. @@ -25,11 +39,11 @@ internal partial class DataSourcesOperations : Microsoft.Rest.IServiceOperations /// internal DataSourcesOperations(OperationalInsightsManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -58,109 +72,116 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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, string workspaceName, string dataSourceName, DataSource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, DataSource 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (dataSourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dataSourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "dataSourceName"); } 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.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("dataSourceName", dataSourceName); 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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{dataSourceName}", System.Uri.EscapeDataString(dataSourceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -177,56 +198,56 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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) @@ -236,7 +257,7 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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")) @@ -249,16 +270,16 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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 @@ -267,21 +288,21 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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; } @@ -304,97 +325,104 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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 resourceGroupName, string workspaceName, string dataSourceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (dataSourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dataSourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "dataSourceName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("dataSourceName", dataSourceName); - 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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{dataSourceName}", System.Uri.EscapeDataString(dataSourceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -410,43 +438,51 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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) @@ -456,7 +492,7 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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")) @@ -465,7 +501,7 @@ internal DataSourcesOperations(OperationalInsightsManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -488,100 +524,107 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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 workspaceName, string dataSourceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (dataSourceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dataSourceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "dataSourceName"); } - if (this.Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("dataSourceName", dataSourceName); - 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/dataSources/{dataSourceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{dataSourceName}", System.Uri.EscapeDataString(dataSourceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -597,51 +640,51 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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) @@ -651,7 +694,7 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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")) @@ -664,21 +707,21 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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; } @@ -705,78 +748,83 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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>> ListByWorkspaceWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListByWorkspaceWithHttpMessagesAsync(ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (odataQuery == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "odataQuery"); + throw new ValidationException(ValidationRules.CannotBeNull, "odataQuery"); } 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("skiptoken", skiptoken); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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.OperationalInsights/workspaces/{workspaceName}/dataSources").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _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); } @@ -785,32 +833,34 @@ internal DataSourcesOperations(OperationalInsightsManagementClient client) { _queryParameters.Add(string.Format("$skiptoken={0}", System.Uri.EscapeDataString(skiptoken))); } - if (apiVersion != null) + if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(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) @@ -826,51 +876,51 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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) @@ -880,7 +930,7 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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")) @@ -893,21 +943,21 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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; } @@ -925,61 +975,66 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListByWorkspaceNextWithHttpMessagesAsync(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, "ListByWorkspaceNext", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspaceNext", 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) @@ -995,51 +1050,51 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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) @@ -1049,7 +1104,7 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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")) @@ -1062,21 +1117,21 @@ internal DataSourcesOperations(OperationalInsightsManagementClient 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/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperationsExtensions.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperationsExtensions.cs index 8529e825c30a..73117368c4e5 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperationsExtensions.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/DataSourcesOperationsExtensions.cs @@ -1,12 +1,21 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { + 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 DataSourcesOperations. @@ -33,7 +42,7 @@ public static partial class DataSourcesOperationsExtensions /// public static DataSource CreateOrUpdate(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName, DataSource parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDataSourcesOperations)s).CreateOrUpdateAsync(resourceGroupName, workspaceName, dataSourceName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, dataSourceName, parameters).GetAwaiter().GetResult(); } /// @@ -57,7 +66,7 @@ public static DataSource CreateOrUpdate(this IDataSourcesOperations operations, /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName, DataSource parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName, DataSource parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, dataSourceName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -82,7 +91,7 @@ public static DataSource CreateOrUpdate(this IDataSourcesOperations operations, /// public static void Delete(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IDataSourcesOperations)s).DeleteAsync(resourceGroupName, workspaceName, dataSourceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, workspaceName, dataSourceName).GetAwaiter().GetResult(); } /// @@ -103,9 +112,9 @@ public static void Delete(this IDataSourcesOperations operations, string resourc /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, dataSourceName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, dataSourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -125,7 +134,7 @@ public static void Delete(this IDataSourcesOperations operations, string resourc /// public static DataSource Get(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDataSourcesOperations)s).GetAsync(resourceGroupName, workspaceName, dataSourceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, workspaceName, dataSourceName).GetAwaiter().GetResult(); } /// @@ -146,7 +155,7 @@ public static DataSource Get(this IDataSourcesOperations operations, string reso /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IDataSourcesOperations operations, string resourceGroupName, string workspaceName, string dataSourceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, dataSourceName, null, cancellationToken).ConfigureAwait(false)) { @@ -173,9 +182,9 @@ public static DataSource Get(this IDataSourcesOperations operations, string reso /// /// Starting point of the collection of data source instances. /// - public static Microsoft.Rest.Azure.IPage ListByWorkspace(this IDataSourcesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string)) + public static IPage ListByWorkspace(this IDataSourcesOperations operations, ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string)) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDataSourcesOperations)s).ListByWorkspaceAsync(odataQuery, resourceGroupName, workspaceName, skiptoken), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListByWorkspaceAsync(odataQuery, resourceGroupName, workspaceName, skiptoken).GetAwaiter().GetResult(); } /// @@ -200,7 +209,7 @@ public static DataSource Get(this IDataSourcesOperations operations, string reso /// /// The cancellation token. /// - public static async Task> ListByWorkspaceAsync(this IDataSourcesOperations operations, Microsoft.Rest.Azure.OData.ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListByWorkspaceAsync(this IDataSourcesOperations operations, ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(odataQuery, resourceGroupName, workspaceName, skiptoken, null, cancellationToken).ConfigureAwait(false)) { @@ -218,9 +227,9 @@ public static DataSource Get(this IDataSourcesOperations operations, string reso /// /// The NextLink from the previous successful call to List operation. /// - public static Microsoft.Rest.Azure.IPage ListByWorkspaceNext(this IDataSourcesOperations operations, string nextPageLink) + public static IPage ListByWorkspaceNext(this IDataSourcesOperations operations, string nextPageLink) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IDataSourcesOperations)s).ListByWorkspaceNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListByWorkspaceNextAsync(nextPageLink).GetAwaiter().GetResult(); } /// @@ -236,7 +245,7 @@ public static Microsoft.Rest.Azure.IPage ListByWorkspaceNext(this ID /// /// The cancellation token. /// - public static async Task> ListByWorkspaceNextAsync(this IDataSourcesOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListByWorkspaceNextAsync(this IDataSourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByWorkspaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) { diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IDataSourcesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IDataSourcesOperations.cs index 36ea4c59e104..1f66c06b3f25 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IDataSourcesOperations.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IDataSourcesOperations.cs @@ -1,11 +1,23 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { + 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; /// /// DataSourcesOperations operations. @@ -44,7 +56,7 @@ public partial interface IDataSourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, DataSource parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, DataSource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a data source instance. /// @@ -70,7 +82,7 @@ public partial interface IDataSourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a datasource instance. /// @@ -99,7 +111,7 @@ public partial interface IDataSourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string dataSourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the first page of data source instances in a workspace with /// the link to the next page. @@ -132,7 +144,7 @@ public partial interface IDataSourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListByWorkspaceWithHttpMessagesAsync(Microsoft.Rest.Azure.OData.ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListByWorkspaceWithHttpMessagesAsync(ODataQuery odataQuery, string resourceGroupName, string workspaceName, string skiptoken = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the first page of data source instances in a workspace with /// the link to the next page. @@ -155,6 +167,6 @@ public partial interface IDataSourcesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/ILinkedServicesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/ILinkedServicesOperations.cs index 4053ca9f79f5..b2af04003c52 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/ILinkedServicesOperations.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/ILinkedServicesOperations.cs @@ -1,11 +1,22 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { + using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// LinkedServicesOperations operations. @@ -44,7 +55,7 @@ public partial interface ILinkedServicesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, LinkedService parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, LinkedService parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a linked service instance. /// @@ -71,7 +82,7 @@ public partial interface ILinkedServicesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a linked service instance. /// @@ -101,7 +112,7 @@ public partial interface ILinkedServicesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the linked services instances in a workspace. /// @@ -128,6 +139,6 @@ public partial interface ILinkedServicesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IOperationalInsightsManagementClient.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IOperationalInsightsManagementClient.cs index edfb5569dc15..54bab35badaf 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IOperationalInsightsManagementClient.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IOperationalInsightsManagementClient.cs @@ -1,15 +1,22 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using Newtonsoft.Json; /// - /// .Net client wrapper for the REST API for Azure Operational Insights + /// Operational Insights Client /// public partial interface IOperationalInsightsManagementClient : System.IDisposable { @@ -21,17 +28,17 @@ public partial interface IOperationalInsightsManagementClient : System.IDisposab /// /// 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; } /// /// Gets subscription credentials which uniquely identify Microsoft @@ -41,19 +48,25 @@ public partial interface IOperationalInsightsManagementClient : System.IDisposab string SubscriptionId { get; set; } /// - /// Gets or sets the preferred language for the response. + /// Client Api Version. + /// + string ApiVersion { get; } + + /// + /// The preferred language for the response. /// string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running - /// Operations. Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default + /// value is 30. /// 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. + /// Whether a unique x-ms-client-request-id should be generated. 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; } @@ -74,14 +87,9 @@ public partial interface IOperationalInsightsManagementClient : System.IDisposab IWorkspacesOperations Workspaces { get; } /// - /// Gets the IStorageInsightsOperations. - /// - IStorageInsightsOperations StorageInsights { get; } - - /// - /// Gets the ISavedSearchesOperations. + /// Gets the IOperations. /// - ISavedSearchesOperations SavedSearches { get; } + IOperations Operations { get; } } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IOperations.cs new file mode 100644 index 000000000000..2c207f8464f1 --- /dev/null +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IOperations.cs @@ -0,0 +1,68 @@ +// +// 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.OperationalInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// 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)); + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// 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/OperationalInsights/Management/Management.OperationalInsights/Generated/ISavedSearchesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/ISavedSearchesOperations.cs deleted file mode 100644 index 8dd6ced8ad30..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/ISavedSearchesOperations.cs +++ /dev/null @@ -1,158 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights -{ - using Microsoft.Rest.Azure; - using Models; - - /// - /// SavedSearchesOperations operations. - /// - public partial interface ISavedSearchesOperations - { - /// - /// Deletes the specified saved search in a given workspace. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// Name of the saved search. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Creates or updates a saved search for a given workspace. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - /// - /// The parameters required to save a search. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, SavedSearch parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Gets the specified saved search for a given workspace. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Gets the saved searches for a given Log Analytics Workspace - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Gets the results from a saved search for a given workspace. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The name of the saved search. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> GetResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IStorageInsightsOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IStorageInsightsOperations.cs deleted file mode 100644 index 4edbf7a8c93d..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IStorageInsightsOperations.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights -{ - using Microsoft.Rest.Azure; - using Models; - - /// - /// StorageInsightsOperations operations. - /// - public partial interface IStorageInsightsOperations - { - /// - /// Create or update a storage insight. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the - /// storageInsightsConfigs resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// The parameters required to create or update a storage insight. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string storageInsightName, StorageInsight parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Gets a storage insight instance. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics Workspace name that contains the - /// storageInsightsConfigs resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string storageInsightName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Deletes a storageInsightsConfigs resource - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics Workspace name that contains the - /// storageInsightsConfigs resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// 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 - /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string storageInsightName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the - /// storageInsightsConfigs resource - /// - /// - /// 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 - /// - System.Threading.Tasks.Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// 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 - /// - System.Threading.Tasks.Task>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IWorkspacesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IWorkspacesOperations.cs index 6b063acde6af..88f0edeb4812 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IWorkspacesOperations.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/IWorkspacesOperations.cs @@ -1,11 +1,22 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { + using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// WorkspacesOperations operations. @@ -37,7 +48,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DisableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DisableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Enables an intelligence pack for a given workspace. /// @@ -63,7 +74,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task EnableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task EnableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Lists all the intelligence packs possible and whether they are /// enabled or disabled for a given workspace. @@ -90,7 +101,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListIntelligencePacksWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListIntelligencePacksWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the shared keys for a workspace. /// @@ -116,7 +127,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetSharedKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetSharedKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of usage metrics for a workspace. /// @@ -142,7 +153,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListUsagesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListUsagesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a list of management groups connected to a workspace. /// @@ -168,7 +179,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListManagementGroupsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListManagementGroupsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets workspaces in a resource group. /// @@ -191,7 +202,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets the workspaces in a subscription. /// @@ -210,7 +221,7 @@ public partial interface IWorkspacesOperations /// /// 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)); /// /// Create or update a workspace. /// @@ -238,7 +249,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Deletes a workspace instance. /// @@ -260,7 +271,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Gets a workspace instance. /// @@ -285,69 +296,18 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get a list of workspaces which the current user has administrator - /// privileges and are not associated with an Azure Subscription. The - /// subscriptionId parameter in the Url is ignored. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task>> ListLinkTargetsWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Gets the schema for a given workspace. + /// Updates a workspace. /// /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> GetSchemaWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Submit a search for a given workspace. The response will contain an - /// id to track the search. User can use the id to poll the search - /// status and get the full search result later if the search takes - /// long time to finish. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. + /// The resource group name of the workspace. /// /// - /// Log Analytics workspace name + /// The name of the workspace. /// /// - /// The parameters required to execute a search query. + /// The parameters required to patch a workspace. /// /// /// The headers that will be added to request. @@ -364,37 +324,7 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> GetSearchResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, SearchParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Gets updated search results for a given search query. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the search that will have results updated. You can get - /// the id from the response of the GetResults call. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> UpdateSearchResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string id, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Create or update a workspace. /// @@ -422,38 +352,6 @@ public partial interface IWorkspacesOperations /// /// Thrown when a required parameter is null /// - System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); - /// - /// Submit a search for a given workspace. The response will contain an - /// id to track the search. User can use the id to poll the search - /// status and get the full search result later if the search takes - /// long time to finish. - /// - /// - /// The name of the resource group to get. The name is case - /// insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The parameters required to execute a search query. - /// - /// - /// 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 - /// - System.Threading.Tasks.Task> BeginGetSearchResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, SearchParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperations.cs index 30b3e59bca49..44d7e291d30f 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperations.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperations.cs @@ -1,18 +1,31 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { - 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; /// /// LinkedServicesOperations operations. /// - internal partial class LinkedServicesOperations : Microsoft.Rest.IServiceOperations, ILinkedServicesOperations + internal partial class LinkedServicesOperations : IServiceOperations, ILinkedServicesOperations { /// /// Initializes a new instance of the LinkedServicesOperations class. @@ -25,11 +38,11 @@ internal partial class LinkedServicesOperations : Microsoft.Rest.IServiceOperati /// internal LinkedServicesOperations(OperationalInsightsManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -59,109 +72,116 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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, string workspaceName, string linkedServiceName, LinkedService parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, LinkedService 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (linkedServiceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "linkedServiceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "linkedServiceName"); } 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"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("linkedServiceName", linkedServiceName); 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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{linkedServiceName}", System.Uri.EscapeDataString(linkedServiceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -178,56 +198,56 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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) @@ -237,7 +257,7 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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")) @@ -250,16 +270,16 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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 @@ -268,21 +288,21 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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; } @@ -306,97 +326,104 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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 resourceGroupName, string workspaceName, string linkedServiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (linkedServiceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "linkedServiceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "linkedServiceName"); } - if (this.Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("linkedServiceName", linkedServiceName); - 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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{linkedServiceName}", System.Uri.EscapeDataString(linkedServiceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -412,43 +439,51 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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) @@ -458,7 +493,7 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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")) @@ -467,7 +502,7 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -491,100 +526,107 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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 workspaceName, string linkedServiceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string linkedServiceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (linkedServiceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "linkedServiceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "linkedServiceName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("linkedServiceName", linkedServiceName); - 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/linkedServices/{linkedServiceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{linkedServiceName}", System.Uri.EscapeDataString(linkedServiceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -600,51 +642,51 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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) @@ -654,7 +696,7 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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")) @@ -667,21 +709,21 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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; } @@ -701,94 +743,101 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } - if (this.Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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.OperationalInsights/workspaces/{workspaceName}/linkedServices").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -804,51 +853,51 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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) @@ -858,7 +907,7 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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")) @@ -871,21 +920,21 @@ internal LinkedServicesOperations(OperationalInsightsManagementClient 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/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperationsExtensions.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperationsExtensions.cs index 0a3b54275778..5c1703525374 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperationsExtensions.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/LinkedServicesOperationsExtensions.cs @@ -1,12 +1,22 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { + 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 LinkedServicesOperations. @@ -34,7 +44,7 @@ public static partial class LinkedServicesOperationsExtensions /// public static LinkedService CreateOrUpdate(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName, LinkedService parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILinkedServicesOperations)s).CreateOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, linkedServiceName, parameters).GetAwaiter().GetResult(); } /// @@ -59,7 +69,7 @@ public static LinkedService CreateOrUpdate(this ILinkedServicesOperations operat /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName, LinkedService parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName, LinkedService parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, linkedServiceName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -85,7 +95,7 @@ public static LinkedService CreateOrUpdate(this ILinkedServicesOperations operat /// public static void Delete(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((ILinkedServicesOperations)s).DeleteAsync(resourceGroupName, workspaceName, linkedServiceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, workspaceName, linkedServiceName).GetAwaiter().GetResult(); } /// @@ -107,9 +117,9 @@ public static void Delete(this ILinkedServicesOperations operations, string reso /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, linkedServiceName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, linkedServiceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -130,7 +140,7 @@ public static void Delete(this ILinkedServicesOperations operations, string reso /// public static LinkedService Get(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILinkedServicesOperations)s).GetAsync(resourceGroupName, workspaceName, linkedServiceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, workspaceName, linkedServiceName).GetAwaiter().GetResult(); } /// @@ -152,7 +162,7 @@ public static LinkedService Get(this ILinkedServicesOperations operations, strin /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, string linkedServiceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, linkedServiceName, null, cancellationToken).ConfigureAwait(false)) { @@ -172,9 +182,9 @@ public static LinkedService Get(this ILinkedServicesOperations operations, strin /// /// Name of the Log Analytics Workspace that contains the linked services. /// - public static System.Collections.Generic.IEnumerable ListByWorkspace(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName) + public static IEnumerable ListByWorkspace(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ILinkedServicesOperations)s).ListByWorkspaceAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListByWorkspaceAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); } /// @@ -192,7 +202,7 @@ public static System.Collections.Generic.IEnumerable ListByWorksp /// /// The cancellation token. /// - public static async Task> ListByWorkspaceAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListByWorkspaceAsync(this ILinkedServicesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) { diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/CoreSummary.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/CoreSummary.cs deleted file mode 100644 index ac8cf0b99216..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/CoreSummary.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// The core summary of a search. - /// - public partial class CoreSummary - { - /// - /// Initializes a new instance of the CoreSummary class. - /// - public CoreSummary() { } - - /// - /// Initializes a new instance of the CoreSummary class. - /// - /// The number of documents of a core - /// summary. - /// The status of a core summary. - public CoreSummary(long numberOfDocuments, string status = default(string)) - { - Status = status; - NumberOfDocuments = numberOfDocuments; - } - - /// - /// Gets or sets the status of a core summary. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "Status")] - public string Status { get; set; } - - /// - /// Gets or sets the number of documents of a core summary. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "NumberOfDocuments")] - public long NumberOfDocuments { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSource.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSource.cs index fca989a55b09..0d94f40e24f9 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSource.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSource.cs @@ -1,20 +1,32 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; using System.Linq; /// /// Datasources under OMS Workspace. /// - public partial class DataSource : ProxyResource + public partial class DataSource : IResource { /// /// Initializes a new instance of the DataSource class. /// - public DataSource() { } + public DataSource() + { + CustomInit(); + } /// /// Initializes a new instance of the DataSource class. @@ -28,30 +40,31 @@ public DataSource() { } /// 'LinuxPerformanceObject', 'LinuxPerformanceCollection', /// 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', /// 'WindowsPerformanceCounter' - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource tags /// The ETag of the data source. - public DataSource(object properties, string kind, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string eTag = default(string)) - : base(id, name, type, tags) + public DataSource(object properties, string kind, string eTag = default(string)) { Properties = properties; ETag = eTag; Kind = kind; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the data source properties in raw json format, each /// kind of data source have it's own schema. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + [JsonProperty(PropertyName = "properties")] public object Properties { get; set; } /// /// Gets or sets the ETag of the data source. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "eTag")] + [JsonProperty(PropertyName = "eTag")] public string ETag { get; set; } /// @@ -63,24 +76,24 @@ public DataSource() { } /// 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', /// 'WindowsPerformanceCounter' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + [JsonProperty(PropertyName = "kind")] public string Kind { 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 (Kind == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Kind"); + throw new ValidationException(ValidationRules.CannotBeNull, "Kind"); } } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceFilter.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceFilter.cs index 1c189ca899cf..a1bf4373e45a 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceFilter.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceFilter.cs @@ -1,9 +1,16 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -14,7 +21,10 @@ public partial class DataSourceFilter /// /// Initializes a new instance of the DataSourceFilter class. /// - public DataSourceFilter() { } + public DataSourceFilter() + { + CustomInit(); + } /// /// Initializes a new instance of the DataSourceFilter class. @@ -29,8 +39,14 @@ public DataSourceFilter() { } public DataSourceFilter(string kind = default(string)) { Kind = kind; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets possible values include: 'AzureActivityLog', /// 'ChangeTrackingPath', 'ChangeTrackingDefaultPath', @@ -40,7 +56,7 @@ public DataSourceFilter() { } /// 'LinuxSyslog', 'LinuxSyslogCollection', 'WindowsEvent', /// 'WindowsPerformanceCounter' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "kind")] + [JsonProperty(PropertyName = "kind")] public string Kind { get; set; } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceKind.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceKind.cs index 3a597fa4c516..9107fc5187eb 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceKind.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/DataSourceKind.cs @@ -1,6 +1,12 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/EntityStatus.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/EntityStatus.cs index 197b729a6bc0..dc5670799282 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/EntityStatus.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/EntityStatus.cs @@ -1,6 +1,12 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/IntelligencePack.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/IntelligencePack.cs index 726e7f0ade4d..fe3dfa4f2d26 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/IntelligencePack.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/IntelligencePack.cs @@ -1,9 +1,16 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -15,7 +22,10 @@ public partial class IntelligencePack /// /// Initializes a new instance of the IntelligencePack class. /// - public IntelligencePack() { } + public IntelligencePack() + { + CustomInit(); + } /// /// Initializes a new instance of the IntelligencePack class. @@ -23,23 +33,38 @@ public IntelligencePack() { } /// The name of the intelligence pack. /// The enabled boolean for the intelligence /// pack. - public IntelligencePack(string name = default(string), bool? enabled = default(bool?)) + /// The display name of the intelligence + /// pack. + public IntelligencePack(string name = default(string), bool? enabled = default(bool?), string displayName = default(string)) { Name = name; Enabled = enabled; + DisplayName = displayName; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the name of the intelligence pack. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public string Name { get; set; } /// /// Gets or sets the enabled boolean for the intelligence pack. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "enabled")] + [JsonProperty(PropertyName = "enabled")] public bool? Enabled { get; set; } + /// + /// Gets or sets the display name of the intelligence pack. + /// + [JsonProperty(PropertyName = "displayName")] + public string DisplayName { get; set; } + } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/LinkTarget.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/LinkTarget.cs deleted file mode 100644 index 4137b169654f..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/LinkTarget.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Metadata for a workspace that isn't linked to an Azure subscription. - /// - public partial class LinkTarget - { - /// - /// Initializes a new instance of the LinkTarget class. - /// - public LinkTarget() { } - - /// - /// Initializes a new instance of the LinkTarget class. - /// - /// The GUID that uniquely identifies the - /// workspace. - /// The display name of the - /// workspace. - /// The DNS valid workspace name. - /// The location of the workspace. - public LinkTarget(string customerId = default(string), string displayName = default(string), string workspaceName = default(string), string location = default(string)) - { - CustomerId = customerId; - DisplayName = displayName; - WorkspaceName = workspaceName; - Location = location; - } - - /// - /// Gets or sets the GUID that uniquely identifies the workspace. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "customerId")] - public string CustomerId { get; set; } - - /// - /// Gets or sets the display name of the workspace. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "accountName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the DNS valid workspace name. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "workspaceName")] - public string WorkspaceName { get; set; } - - /// - /// Gets or sets the location of the workspace. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/LinkedService.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/LinkedService.cs index 03a2a4cf8b2c..8cbf54186aec 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/LinkedService.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/LinkedService.cs @@ -1,55 +1,69 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; using System.Linq; /// /// The top level Linked service resource container. /// - [Microsoft.Rest.Serialization.JsonTransformation] - public partial class LinkedService : ProxyResource + [Rest.Serialization.JsonTransformation] + public partial class LinkedService : IResource { /// /// Initializes a new instance of the LinkedService class. /// - public LinkedService() { } + public LinkedService() + { + CustomInit(); + } /// /// Initializes a new instance of the LinkedService class. /// /// The resource id of the resource that will /// be linked to the workspace. - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource tags - public LinkedService(string resourceId, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) - : base(id, name, type, tags) + public LinkedService(string resourceId) { ResourceId = resourceId; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the resource id of the resource that will be linked to /// the workspace. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.resourceId")] + [JsonProperty(PropertyName = "properties.resourceId")] public string ResourceId { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// public virtual void Validate() { if (ResourceId == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ResourceId"); + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); } } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ManagementGroup.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ManagementGroup.cs index 0ae2e1929f03..a99a5f036cf0 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ManagementGroup.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ManagementGroup.cs @@ -1,21 +1,33 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; using System.Linq; /// /// A management group that is connected to a workspace /// - [Microsoft.Rest.Serialization.JsonTransformation] + [Rest.Serialization.JsonTransformation] public partial class ManagementGroup { /// /// Initializes a new instance of the ManagementGroup class. /// - public ManagementGroup() { } + public ManagementGroup() + { + CustomInit(); + } /// /// Initializes a new instance of the ManagementGroup class. @@ -44,59 +56,65 @@ public ManagementGroup() { } DataReceived = dataReceived; Version = version; Sku = sku; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the number of servers connected to the management /// group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.serverCount")] + [JsonProperty(PropertyName = "properties.serverCount")] public int? ServerCount { get; set; } /// /// Gets or sets a value indicating whether the management group is a /// gateway. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.isGateway")] + [JsonProperty(PropertyName = "properties.isGateway")] public bool? IsGateway { get; set; } /// /// Gets or sets the name of the management group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.name")] + [JsonProperty(PropertyName = "properties.name")] public string Name { get; set; } /// /// Gets or sets the unique ID of the management group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.id")] + [JsonProperty(PropertyName = "properties.id")] public string Id { get; set; } /// /// Gets or sets the datetime that the management group was created. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.created")] + [JsonProperty(PropertyName = "properties.created")] public System.DateTime? Created { get; set; } /// /// Gets or sets the last datetime that the management group received /// data. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.dataReceived")] + [JsonProperty(PropertyName = "properties.dataReceived")] public System.DateTime? DataReceived { get; set; } /// /// Gets or sets the version of System Center that is managing the /// management group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.version")] + [JsonProperty(PropertyName = "properties.version")] public string Version { get; set; } /// /// Gets or sets the SKU of System Center that is managing the /// management group. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sku")] + [JsonProperty(PropertyName = "properties.sku")] public string Sku { get; set; } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/MetricName.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/MetricName.cs index dd86f2f6fdb3..bdea65678730 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/MetricName.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/MetricName.cs @@ -1,9 +1,16 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -14,7 +21,10 @@ public partial class MetricName /// /// Initializes a new instance of the MetricName class. /// - public MetricName() { } + public MetricName() + { + CustomInit(); + } /// /// Initializes a new instance of the MetricName class. @@ -26,18 +36,24 @@ public MetricName() { } { Value = value; LocalizedValue = localizedValue; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the system name of the metric. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + [JsonProperty(PropertyName = "value")] public string Value { get; set; } /// /// Gets or sets the localized name of the metric. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "localizedValue")] + [JsonProperty(PropertyName = "localizedValue")] public string LocalizedValue { get; set; } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Operation.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Operation.cs new file mode 100644 index 000000000000..a42143ed3968 --- /dev/null +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Operation.cs @@ -0,0 +1,61 @@ +// +// 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.OperationalInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Supported operation of OperationalInsights resource provider. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + /// Operation name: + /// {provider}/{resource}/{operation} + /// Display metadata associated with the + /// operation. + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + { + Name = name; + Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets operation name: {provider}/{resource}/{operation} + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets display metadata associated with the operation. + /// + [JsonProperty(PropertyName = "display")] + public OperationDisplay Display { get; set; } + + } +} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/OperationDisplay.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..84a772a172e8 --- /dev/null +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/OperationDisplay.cs @@ -0,0 +1,70 @@ +// +// 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.OperationalInsights.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Display metadata associated with the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + /// Service provider: Microsoft + /// OperationsManagement. + /// Resource on which the operation is performed + /// etc. + /// Type of operation: get, read, delete, + /// etc. + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + { + Provider = provider; + Resource = resource; + Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets service provider: Microsoft OperationsManagement. + /// + [JsonProperty(PropertyName = "provider")] + public string Provider { get; set; } + + /// + /// Gets or sets resource on which the operation is performed etc. + /// + [JsonProperty(PropertyName = "resource")] + public string Resource { get; set; } + + /// + /// Gets or sets type of operation: get, read, delete, etc. + /// + [JsonProperty(PropertyName = "operation")] + public string Operation { get; set; } + + } +} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page.cs index fa78486561a6..35074c8d3dca 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page.cs @@ -1,40 +1,51 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.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("")] - public System.String NextPageLink { get; private set; } + [JsonProperty("")] + 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/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page1.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page1.cs index f73371e2004f..fa22cb49d324 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page1.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page1.cs @@ -1,40 +1,51 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.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 Page1 : Microsoft.Rest.Azure.IPage + [JsonObject] + public class Page1 : 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/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page2.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page2.cs deleted file mode 100644 index 5e8213a57784..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Page2.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - - /// - /// Defines a page in Azure responses. - /// - /// Type of the page content items - [Newtonsoft.Json.JsonObject] - public class Page2 : Microsoft.Rest.Azure.IPage - { - /// - /// Gets the link to the next page. - /// - [Newtonsoft.Json.JsonProperty("@odata.nextLink")] - public System.String NextPageLink { get; private set; } - - [Newtonsoft.Json.JsonProperty("value")] - private System.Collections.Generic.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() - { - 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() - { - return GetEnumerator(); - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ProxyResource.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ProxyResource.cs index dba759bb0141..1db6676f64c8 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ProxyResource.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/ProxyResource.cs @@ -1,9 +1,18 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -14,7 +23,10 @@ public partial class ProxyResource /// /// Initializes a new instance of the ProxyResource class. /// - public ProxyResource() { } + public ProxyResource() + { + CustomInit(); + } /// /// Initializes a new instance of the ProxyResource class. @@ -23,37 +35,43 @@ public ProxyResource() { } /// Resource name. /// Resource type. /// Resource tags - public ProxyResource(string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) { Id = id; Name = name; Type = type; 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 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/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Resource.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Resource.cs index b95265397972..7ea74406ff24 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Resource.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Resource.cs @@ -1,80 +1,87 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// /// The resource definition. /// - 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. /// - /// Resource location /// Resource Id /// Resource name /// Resource type + /// Resource location /// Resource tags - public Resource(string location, string id = default(string), string name = default(string), string type = 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; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); - } - } } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SavedSearch.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SavedSearch.cs deleted file mode 100644 index 6763fb062e3d..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SavedSearch.cs +++ /dev/null @@ -1,132 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Value object for saved search results. - /// - [Microsoft.Rest.Serialization.JsonTransformation] - public partial class SavedSearch - { - /// - /// Initializes a new instance of the SavedSearch class. - /// - public SavedSearch() { } - - /// - /// Initializes a new instance of the SavedSearch class. - /// - /// The category of the saved search. This helps - /// the user to find a saved search faster. - /// Saved search display name. - /// The query expression for the saved search. - /// Please see - /// https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-search-reference - /// for reference. - /// The version number of the query lanuage. Only - /// verion 1 is allowed here. - /// The id of the saved search. - /// The etag of the saved search. - /// The tags attached to the saved search. - public SavedSearch(string category, string displayName, string query, long version, string id = default(string), string etag = default(string), System.Collections.Generic.IList tags = default(System.Collections.Generic.IList)) - { - Id = id; - Etag = etag; - Category = category; - DisplayName = displayName; - Query = query; - Version = version; - Tags = tags; - } - - /// - /// Gets the id of the saved search. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets or sets the etag of the saved search. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "etag")] - public string Etag { get; set; } - - /// - /// Gets or sets the category of the saved search. This helps the user - /// to find a saved search faster. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.Category")] - public string Category { get; set; } - - /// - /// Gets or sets saved search display name. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.DisplayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the query expression for the saved search. Please see - /// https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-search-reference - /// for reference. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.Query")] - public string Query { get; set; } - - /// - /// Gets or sets the version number of the query lanuage. Only verion 1 - /// is allowed here. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.Version")] - public long Version { get; set; } - - /// - /// Gets or sets the tags attached to the saved search. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.Tags")] - public System.Collections.Generic.IList Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Category == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Category"); - } - if (DisplayName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "DisplayName"); - } - if (Query == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Query"); - } - if (this.Version > 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "Version", 1); - } - if (this.Version < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "Version", 1); - } - if (this.Tags != null) - { - foreach (var element in this.Tags) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SavedSearchesListResult.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SavedSearchesListResult.cs deleted file mode 100644 index e117aff14d31..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SavedSearchesListResult.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// The saved search operation response. - /// - public partial class SavedSearchesListResult - { - /// - /// Initializes a new instance of the SavedSearchesListResult class. - /// - public SavedSearchesListResult() { } - - /// - /// Initializes a new instance of the SavedSearchesListResult class. - /// - /// The metadata from search results. - /// The array of result values. - public SavedSearchesListResult(SearchMetadata metadata = default(SearchMetadata), System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) - { - Metadata = metadata; - Value = value; - } - - /// - /// Gets or sets the metadata from search results. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "__metadata")] - public SearchMetadata Metadata { get; set; } - - /// - /// Gets or sets the array of result values. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "value")] - public System.Collections.Generic.IList Value { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchError.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchError.cs deleted file mode 100644 index f6e9b41ddf6e..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchError.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Details for a search error. - /// - public partial class SearchError - { - /// - /// Initializes a new instance of the SearchError class. - /// - public SearchError() { } - - /// - /// Initializes a new instance of the SearchError class. - /// - /// The error type. - /// The error message. - public SearchError(string type = default(string), string message = default(string)) - { - Type = type; - Message = message; - } - - /// - /// Gets or sets the error type. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the error message. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchGetSchemaResponse.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchGetSchemaResponse.cs deleted file mode 100644 index aa61cf6f899a..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchGetSchemaResponse.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// The get schema operation response. - /// - public partial class SearchGetSchemaResponse - { - /// - /// Initializes a new instance of the SearchGetSchemaResponse class. - /// - public SearchGetSchemaResponse() { } - - /// - /// Initializes a new instance of the SearchGetSchemaResponse class. - /// - /// The metadata from search results. - /// The array of result values. - public SearchGetSchemaResponse(SearchMetadata metadata = default(SearchMetadata), System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) - { - Metadata = metadata; - Value = value; - } - - /// - /// Gets or sets the metadata from search results. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "__metadata")] - public SearchMetadata Metadata { get; set; } - - /// - /// Gets or sets the array of result values. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "value")] - public System.Collections.Generic.IList Value { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchHighlight.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchHighlight.cs deleted file mode 100644 index e25ec891cbc9..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchHighlight.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Highlight details. - /// - public partial class SearchHighlight - { - /// - /// Initializes a new instance of the SearchHighlight class. - /// - public SearchHighlight() { } - - /// - /// Initializes a new instance of the SearchHighlight class. - /// - /// The string that is put before a matched - /// result. - /// The string that is put after a matched - /// result. - public SearchHighlight(string pre = default(string), string post = default(string)) - { - Pre = pre; - Post = post; - } - - /// - /// Gets or sets the string that is put before a matched result. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "pre")] - public string Pre { get; set; } - - /// - /// Gets or sets the string that is put after a matched result. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "post")] - public string Post { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchMetadata.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchMetadata.cs deleted file mode 100644 index cc2e602e3d21..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchMetadata.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Metadata for search results. - /// - public partial class SearchMetadata - { - /// - /// Initializes a new instance of the SearchMetadata class. - /// - public SearchMetadata() { } - - /// - /// Initializes a new instance of the SearchMetadata class. - /// - /// The request id of the search. - /// The search result type. - /// The total number of search results. - /// The number of top search results. - /// The id of the search results request. - /// The core summaries. - /// The status of the search results. - /// The start time for the search. - /// The time of last update. - /// The ETag of the search results. - /// How the results are sorted. - /// The request time. - /// The aggregated value - /// field. - /// The aggregated grouping - /// fields. - /// The sum of all aggregates returned in the result - /// set. - /// The max of all aggregates returned in the result - /// set. - /// The schema. - public SearchMetadata(string searchId = default(string), string resultType = default(string), long? total = default(long?), long? top = default(long?), string id = default(string), System.Collections.Generic.IList coreSummaries = default(System.Collections.Generic.IList), string status = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? lastUpdated = default(System.DateTime?), string eTag = default(string), System.Collections.Generic.IList sort = default(System.Collections.Generic.IList), long? requestTime = default(long?), string aggregatedValueField = default(string), string aggregatedGroupingFields = default(string), long? sum = default(long?), long? max = default(long?), SearchMetadataSchema schema = default(SearchMetadataSchema)) - { - SearchId = searchId; - ResultType = resultType; - Total = total; - Top = top; - Id = id; - CoreSummaries = coreSummaries; - Status = status; - StartTime = startTime; - LastUpdated = lastUpdated; - ETag = eTag; - Sort = sort; - RequestTime = requestTime; - AggregatedValueField = aggregatedValueField; - AggregatedGroupingFields = aggregatedGroupingFields; - Sum = sum; - Max = max; - Schema = schema; - } - - /// - /// Gets or sets the request id of the search. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "RequestId")] - public string SearchId { get; set; } - - /// - /// Gets or sets the search result type. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "resultType")] - public string ResultType { get; set; } - - /// - /// Gets or sets the total number of search results. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "total")] - public long? Total { get; set; } - - /// - /// Gets or sets the number of top search results. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "top")] - public long? Top { get; set; } - - /// - /// Gets or sets the id of the search results request. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the core summaries. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "CoreSummaries")] - public System.Collections.Generic.IList CoreSummaries { get; set; } - - /// - /// Gets or sets the status of the search results. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "Status")] - public string Status { get; set; } - - /// - /// Gets or sets the start time for the search. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "StartTime")] - public System.DateTime? StartTime { get; set; } - - /// - /// Gets or sets the time of last update. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "LastUpdated")] - public System.DateTime? LastUpdated { get; set; } - - /// - /// Gets or sets the ETag of the search results. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "ETag")] - public string ETag { get; set; } - - /// - /// Gets or sets how the results are sorted. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "sort")] - public System.Collections.Generic.IList Sort { get; set; } - - /// - /// Gets or sets the request time. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "requestTime")] - public long? RequestTime { get; set; } - - /// - /// Gets or sets the aggregated value field. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "aggregatedValueField")] - public string AggregatedValueField { get; set; } - - /// - /// Gets or sets the aggregated grouping fields. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "aggregatedGroupingFields")] - public string AggregatedGroupingFields { get; set; } - - /// - /// Gets or sets the sum of all aggregates returned in the result set. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "sum")] - public long? Sum { get; set; } - - /// - /// Gets or sets the max of all aggregates returned in the result set. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "max")] - public long? Max { get; set; } - - /// - /// Gets or sets the schema. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "schema")] - public SearchMetadataSchema Schema { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchMetadataSchema.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchMetadataSchema.cs deleted file mode 100644 index 8ce9e2ac6953..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchMetadataSchema.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Schema metadata for search. - /// - public partial class SearchMetadataSchema - { - /// - /// Initializes a new instance of the SearchMetadataSchema class. - /// - public SearchMetadataSchema() { } - - /// - /// Initializes a new instance of the SearchMetadataSchema class. - /// - /// The name of the metadata schema. - /// The version of the metadata schema. - public SearchMetadataSchema(string name = default(string), int? version = default(int?)) - { - Name = name; - Version = version; - } - - /// - /// Gets or sets the name of the metadata schema. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the version of the metadata schema. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "version")] - public int? Version { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchParameters.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchParameters.cs deleted file mode 100644 index 2c5267e519cc..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchParameters.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Parameters specifying the search query and range. - /// - public partial class SearchParameters - { - /// - /// Initializes a new instance of the SearchParameters class. - /// - public SearchParameters() { } - - /// - /// Initializes a new instance of the SearchParameters class. - /// - /// The query to search. - /// The number to get from the top. - /// The highlight that looks for all occurences - /// of a string. - /// The start date filter, so the only query - /// results returned are after this date. - /// The end date filter, so the only query results - /// returned are before this date. - public SearchParameters(string query, long? top = default(long?), SearchHighlight highlight = default(SearchHighlight), System.DateTime? start = default(System.DateTime?), System.DateTime? end = default(System.DateTime?)) - { - Top = top; - Highlight = highlight; - Query = query; - Start = start; - End = end; - } - - /// - /// Gets or sets the number to get from the top. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "top")] - public long? Top { get; set; } - - /// - /// Gets or sets the highlight that looks for all occurences of a - /// string. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "highlight")] - public SearchHighlight Highlight { get; set; } - - /// - /// Gets or sets the query to search. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "query")] - public string Query { get; set; } - - /// - /// Gets or sets the start date filter, so the only query results - /// returned are after this date. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "start")] - public System.DateTime? Start { get; set; } - - /// - /// Gets or sets the end date filter, so the only query results - /// returned are before this date. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "end")] - public System.DateTime? End { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Query == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Query"); - } - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchResultsResponse.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchResultsResponse.cs deleted file mode 100644 index 0c670bacd9b1..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchResultsResponse.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// The get search result operation response. - /// - public partial class SearchResultsResponse - { - /// - /// Initializes a new instance of the SearchResultsResponse class. - /// - public SearchResultsResponse() { } - - /// - /// Initializes a new instance of the SearchResultsResponse class. - /// - /// The id of the search, which includes the full - /// url. - /// The metadata from search results. - /// The array of result values. - /// The error. - public SearchResultsResponse(string id = default(string), SearchMetadata metadata = default(SearchMetadata), System.Collections.Generic.IList value = default(System.Collections.Generic.IList), SearchError error = default(SearchError)) - { - Id = id; - Metadata = metadata; - Value = value; - Error = error; - } - - /// - /// Gets the id of the search, which includes the full url. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets or sets the metadata from search results. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "__metadata")] - public SearchMetadata Metadata { get; set; } - - /// - /// Gets or sets the array of result values. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "value")] - public System.Collections.Generic.IList Value { get; set; } - - /// - /// Gets or sets the error. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "error")] - public SearchError Error { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSchemaValue.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSchemaValue.cs deleted file mode 100644 index 1ebb04ce9df4..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSchemaValue.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Value object for schema results. - /// - public partial class SearchSchemaValue - { - /// - /// Initializes a new instance of the SearchSchemaValue class. - /// - public SearchSchemaValue() { } - - /// - /// Initializes a new instance of the SearchSchemaValue class. - /// - /// The boolean that indicates the field is - /// searchable as free text. - /// The boolean that indicates whether or not the - /// field is stored. - /// The boolean that indicates whether or not the - /// field is a facet. - /// The name of the schema. - /// The display name of the schema. - /// The type. - /// The array of workflows containing the - /// field. - public SearchSchemaValue(bool indexed, bool stored, bool facet, string name = default(string), string displayName = default(string), string type = default(string), System.Collections.Generic.IList ownerType = default(System.Collections.Generic.IList)) - { - Name = name; - DisplayName = displayName; - Type = type; - Indexed = indexed; - Stored = stored; - Facet = facet; - OwnerType = ownerType; - } - - /// - /// Gets or sets the name of the schema. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the display name of the schema. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "displayName")] - public string DisplayName { get; set; } - - /// - /// Gets or sets the type. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the boolean that indicates the field is searchable as - /// free text. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "indexed")] - public bool Indexed { get; set; } - - /// - /// Gets or sets the boolean that indicates whether or not the field is - /// stored. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "stored")] - public bool Stored { get; set; } - - /// - /// Gets or sets the boolean that indicates whether or not the field is - /// a facet. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "facet")] - public bool Facet { get; set; } - - /// - /// Gets or sets the array of workflows containing the field. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "ownerType")] - public System.Collections.Generic.IList OwnerType { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSort.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSort.cs deleted file mode 100644 index d34c10567f1e..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSort.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// The sort parameters for search. - /// - public partial class SearchSort - { - /// - /// Initializes a new instance of the SearchSort class. - /// - public SearchSort() { } - - /// - /// Initializes a new instance of the SearchSort class. - /// - /// The name of the field the search query is sorted - /// on. - /// The sort order of the search. Possible values - /// include: 'asc', 'desc' - public SearchSort(string name = default(string), string order = default(string)) - { - Name = name; - Order = order; - } - - /// - /// Gets or sets the name of the field the search query is sorted on. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the sort order of the search. Possible values include: - /// 'asc', 'desc' - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "order")] - public string Order { get; set; } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSortEnum.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSortEnum.cs deleted file mode 100644 index 03b73d4fd48e..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SearchSortEnum.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - - /// - /// Defines values for SearchSortEnum. - /// - public static class SearchSortEnum - { - public const string Asc = "asc"; - public const string Desc = "desc"; - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SharedKeys.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SharedKeys.cs index 0fd847a25fd8..089d88abde3b 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SharedKeys.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SharedKeys.cs @@ -1,9 +1,16 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -14,7 +21,10 @@ public partial class SharedKeys /// /// Initializes a new instance of the SharedKeys class. /// - public SharedKeys() { } + public SharedKeys() + { + CustomInit(); + } /// /// Initializes a new instance of the SharedKeys class. @@ -27,18 +37,24 @@ public SharedKeys() { } { PrimarySharedKey = primarySharedKey; SecondarySharedKey = secondarySharedKey; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the primary shared key of a workspace. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "primarySharedKey")] + [JsonProperty(PropertyName = "primarySharedKey")] public string PrimarySharedKey { get; set; } /// /// Gets or sets the secondary shared key of a workspace. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "secondarySharedKey")] + [JsonProperty(PropertyName = "secondarySharedKey")] public string SecondarySharedKey { get; set; } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Sku.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Sku.cs index 8761a1987806..11a915c31964 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Sku.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Sku.cs @@ -1,9 +1,17 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Microsoft.Rest; + using Newtonsoft.Json; using System.Linq; /// @@ -14,37 +22,46 @@ 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. /// /// The name of the SKU. Possible values include: - /// 'Free', 'Standard', 'Premium', 'Unlimited', 'PerNode', + /// 'Free', 'Standard', 'Premium', 'PerNode', 'PerGB2018', /// 'Standalone' public Sku(string name) { Name = name; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the name of the SKU. Possible values include: 'Free', - /// 'Standard', 'Premium', 'Unlimited', 'PerNode', 'Standalone' + /// 'Standard', 'Premium', 'PerNode', 'PerGB2018', 'Standalone' /// - [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 (Name == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); } } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SkuNameEnum.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SkuNameEnum.cs index f3f26f28f7a2..4fcc4898c114 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SkuNameEnum.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/SkuNameEnum.cs @@ -1,6 +1,12 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { @@ -13,8 +19,8 @@ public static class SkuNameEnum public const string Free = "Free"; public const string Standard = "Standard"; public const string Premium = "Premium"; - public const string Unlimited = "Unlimited"; public const string PerNode = "PerNode"; + public const string PerGB2018 = "PerGB2018"; public const string Standalone = "Standalone"; } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageAccount.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageAccount.cs deleted file mode 100644 index 2e1e53734b10..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageAccount.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// Describes a storage account connection. - /// - public partial class StorageAccount - { - /// - /// Initializes a new instance of the StorageAccount class. - /// - public StorageAccount() { } - - /// - /// Initializes a new instance of the StorageAccount class. - /// - /// The Azure Resource Manager ID of the storage - /// account resource. - /// The storage account key. - public StorageAccount(string id, string key) - { - Id = id; - Key = key; - } - - /// - /// Gets or sets the Azure Resource Manager ID of the storage account - /// resource. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the storage account key. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "key")] - public string Key { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Id"); - } - if (Key == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Key"); - } - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsight.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsight.cs deleted file mode 100644 index fefbc416bfd2..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsight.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// The top level storage insight resource container. - /// - [Microsoft.Rest.Serialization.JsonTransformation] - public partial class StorageInsight : ProxyResource - { - /// - /// Initializes a new instance of the StorageInsight class. - /// - public StorageInsight() { } - - /// - /// Initializes a new instance of the StorageInsight class. - /// - /// The storage account connection - /// details - /// Resource ID. - /// Resource name. - /// Resource type. - /// Resource tags - /// The names of the blob containers that the - /// workspace should read - /// The names of the Azure tables that the - /// workspace should read - /// The status of the storage insight - /// The ETag of the storage insight. - public StorageInsight(StorageAccount storageAccount, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), System.Collections.Generic.IList containers = default(System.Collections.Generic.IList), System.Collections.Generic.IList tables = default(System.Collections.Generic.IList), StorageInsightStatus status = default(StorageInsightStatus), string eTag = default(string)) - : base(id, name, type, tags) - { - Containers = containers; - Tables = tables; - StorageAccount = storageAccount; - Status = status; - ETag = eTag; - } - - /// - /// Gets or sets the names of the blob containers that the workspace - /// should read - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.containers")] - public System.Collections.Generic.IList Containers { get; set; } - - /// - /// Gets or sets the names of the Azure tables that the workspace - /// should read - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.tables")] - public System.Collections.Generic.IList Tables { get; set; } - - /// - /// Gets or sets the storage account connection details - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.storageAccount")] - public StorageAccount StorageAccount { get; set; } - - /// - /// Gets the status of the storage insight - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.status")] - public StorageInsightStatus Status { get; private set; } - - /// - /// Gets or sets the ETag of the storage insight. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "eTag")] - public string ETag { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (StorageAccount == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "StorageAccount"); - } - if (this.StorageAccount != null) - { - this.StorageAccount.Validate(); - } - if (this.Status != null) - { - this.Status.Validate(); - } - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsightState.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsightState.cs deleted file mode 100644 index bb268fcc54f5..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsightState.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - - /// - /// Defines values for StorageInsightState. - /// - public static class StorageInsightState - { - public const string OK = "OK"; - public const string ERROR = "ERROR"; - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsightStatus.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsightStatus.cs deleted file mode 100644 index 49bd02794860..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/StorageInsightStatus.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// The status of the storage insight. - /// - public partial class StorageInsightStatus - { - /// - /// Initializes a new instance of the StorageInsightStatus class. - /// - public StorageInsightStatus() { } - - /// - /// Initializes a new instance of the StorageInsightStatus class. - /// - /// The state of the storage insight connection to - /// the workspace. Possible values include: 'OK', 'ERROR' - /// Description of the state of the storage - /// insight. - public StorageInsightStatus(string state, string description = default(string)) - { - State = state; - Description = description; - } - - /// - /// Gets or sets the state of the storage insight connection to the - /// workspace. Possible values include: 'OK', 'ERROR' - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "state")] - public string State { get; set; } - - /// - /// Gets or sets description of the state of the storage insight. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (State == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "State"); - } - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Tag.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Tag.cs deleted file mode 100644 index 810d1fc2fe5b..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Tag.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights.Models -{ - using System.Linq; - - /// - /// A tag of a saved search. - /// - public partial class Tag - { - /// - /// Initializes a new instance of the Tag class. - /// - public Tag() { } - - /// - /// Initializes a new instance of the Tag class. - /// - /// The tag name. - /// The tag value. - public Tag(string name, string value) - { - Name = name; - Value = value; - } - - /// - /// Gets or sets the tag name. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "Name")] - public string Name { get; set; } - - /// - /// Gets or sets the tag value. - /// - [Newtonsoft.Json.JsonProperty(PropertyName = "Value")] - public string Value { 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"); - } - if (Value == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value"); - } - } - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/UsageMetric.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/UsageMetric.cs index 83d8b649c0a2..d7d330e90858 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/UsageMetric.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/UsageMetric.cs @@ -1,9 +1,16 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Newtonsoft.Json; using System.Linq; /// @@ -14,7 +21,10 @@ public partial class UsageMetric /// /// Initializes a new instance of the UsageMetric class. /// - public UsageMetric() { } + public UsageMetric() + { + CustomInit(); + } /// /// Initializes a new instance of the UsageMetric class. @@ -35,43 +45,49 @@ public UsageMetric() { } Limit = limit; NextResetTime = nextResetTime; QuotaPeriod = quotaPeriod; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the name of the metric. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + [JsonProperty(PropertyName = "name")] public MetricName Name { get; set; } /// /// Gets or sets the units used for the metric. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "unit")] + [JsonProperty(PropertyName = "unit")] public string Unit { get; set; } /// /// Gets or sets the current value of the metric. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "currentValue")] + [JsonProperty(PropertyName = "currentValue")] public double? CurrentValue { get; set; } /// /// Gets or sets the quota limit for the metric. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "limit")] + [JsonProperty(PropertyName = "limit")] public double? Limit { get; set; } /// /// Gets or sets the time that the metric's value will reset. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "nextResetTime")] + [JsonProperty(PropertyName = "nextResetTime")] public System.DateTime? NextResetTime { get; set; } /// /// Gets or sets the quota period that determines the length of time /// between value resets. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "quotaPeriod")] + [JsonProperty(PropertyName = "quotaPeriod")] public string QuotaPeriod { get; set; } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Workspace.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Workspace.cs index 12849af6be0d..091d4bf5445e 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Workspace.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Models/Workspace.cs @@ -1,30 +1,38 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights.Models { + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; using System.Linq; /// /// The top level Workspace resource container. /// - [Microsoft.Rest.Serialization.JsonTransformation] - public partial class Workspace : Resource + [Rest.Serialization.JsonTransformation] + public partial class Workspace : IResource { /// /// Initializes a new instance of the Workspace class. /// - public Workspace() { } + public Workspace() + { + CustomInit(); + } /// /// Initializes a new instance of the Workspace class. /// - /// Resource location - /// Resource Id - /// Resource name - /// Resource type - /// Resource tags /// The provisioning state of the /// workspace. Possible values include: 'Creating', 'Succeeded', /// 'Failed', 'Canceled', 'Deleting', 'ProvisioningAccount' @@ -33,7 +41,7 @@ public Workspace() { } /// Azure. 'External' implies it was created via the Operational /// Insights Portal. This value is set on the service side and /// read-only on the client side. - /// The ID associated with the workspace. + /// The ID associated with the workspace. /// Setting this value at creation time allows the workspace being /// created to be linked to an existing workspace. /// The URL of the Operational Insights portal @@ -44,8 +52,7 @@ public Workspace() { } /// -1 means Unlimited retention for the Unlimited Sku. 730 days is the /// maximum allowed for all other Skus. /// The ETag of the workspace. - public Workspace(string location, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string provisioningState = default(string), string source = default(string), string customerId = default(string), string portalUrl = default(string), Sku sku = default(Sku), int? retentionInDays = default(int?), string eTag = default(string)) - : base(location, id, name, type, tags) + public Workspace(string provisioningState = default(string), string source = default(string), string customerId = default(string), string portalUrl = default(string), Sku sku = default(Sku), int? retentionInDays = default(int?), string eTag = default(string)) { ProvisioningState = provisioningState; Source = source; @@ -54,24 +61,30 @@ public Workspace() { } Sku = sku; RetentionInDays = retentionInDays; ETag = eTag; + CustomInit(); } + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + /// /// Gets or sets the provisioning state of the workspace. Possible /// values include: 'Creating', 'Succeeded', 'Failed', 'Canceled', /// 'Deleting', 'ProvisioningAccount' /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + [JsonProperty(PropertyName = "properties.provisioningState")] public string ProvisioningState { get; set; } /// /// Gets or sets the source of the workspace. Source defines where the - /// workspace was created. 'Azure' implies it was created in Azure. + /// workspace was created. 'Azure' implies it was created in Azure. /// 'External' implies it was created via the Operational Insights /// Portal. This value is set on the service side and read-only on the /// client side. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.source")] + [JsonProperty(PropertyName = "properties.source")] public string Source { get; set; } /// @@ -79,7 +92,7 @@ public Workspace() { } /// value at creation time allows the workspace being created to be /// linked to an existing workspace. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.customerId")] + [JsonProperty(PropertyName = "properties.customerId")] public string CustomerId { get; set; } /// @@ -87,13 +100,13 @@ public Workspace() { } /// workspace. This value is set on the service side and read-only on /// the client side. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.portalUrl")] + [JsonProperty(PropertyName = "properties.portalUrl")] public string PortalUrl { get; set; } /// /// Gets or sets the SKU of the workspace. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.sku")] + [JsonProperty(PropertyName = "properties.sku")] public Sku Sku { get; set; } /// @@ -101,35 +114,34 @@ public Workspace() { } /// Unlimited retention for the Unlimited Sku. 730 days is the maximum /// allowed for all other Skus. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "properties.retentionInDays")] + [JsonProperty(PropertyName = "properties.retentionInDays")] public int? RetentionInDays { get; set; } /// /// Gets or sets the ETag of the workspace. /// - [Newtonsoft.Json.JsonProperty(PropertyName = "eTag")] + [JsonProperty(PropertyName = "eTag")] public string ETag { get; set; } /// /// Validate the object. /// - /// + /// /// Thrown if validation fails /// - public override void Validate() + public virtual void Validate() { - base.Validate(); - if (this.Sku != null) + if (Sku != null) { - this.Sku.Validate(); + Sku.Validate(); } - if (this.RetentionInDays > 730) + if (RetentionInDays > 730) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "RetentionInDays", 730); + throw new ValidationException(ValidationRules.InclusiveMaximum, "RetentionInDays", 730); } - if (this.RetentionInDays < -1) + if (RetentionInDays < -1) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "RetentionInDays", -1); + throw new ValidationException(ValidationRules.InclusiveMinimum, "RetentionInDays", -1); } } } diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/OperationalInsightsManagementClient.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/OperationalInsightsManagementClient.cs index c99b1c0240dc..f77a054bc722 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/OperationalInsightsManagementClient.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/OperationalInsightsManagementClient.cs @@ -1,18 +1,30 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { - 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; /// - /// .Net client wrapper for the REST API for Azure Operational Insights + /// Operational Insights Client /// - public partial class OperationalInsightsManagementClient : Microsoft.Rest.ServiceClient, IOperationalInsightsManagementClient, IAzureClient + public partial class OperationalInsightsManagementClient : ServiceClient, IOperationalInsightsManagementClient, IAzureClient { /// /// The base URI of the service. @@ -22,17 +34,17 @@ public partial class OperationalInsightsManagementClient : Microsoft.Rest.Servic /// /// 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; } /// /// Gets subscription credentials which uniquely identify Microsoft Azure @@ -42,19 +54,25 @@ public partial class OperationalInsightsManagementClient : Microsoft.Rest.Servic public string SubscriptionId { get; set; } /// - /// Gets or sets the preferred language for the response. + /// Client Api Version. + /// + public string ApiVersion { get; private set; } + + /// + /// The preferred language for the response. /// public string AcceptLanguage { get; set; } /// - /// Gets or sets the retry timeout in seconds for Long Running Operations. - /// Default value is 30. + /// The retry timeout in seconds for Long Running Operations. Default value is + /// 30. /// public 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. + /// Whether a unique x-ms-client-request-id should be generated. When set to + /// true a unique x-ms-client-request-id value is generated and included in + /// each request. Default is true. /// public bool? GenerateClientRequestId { get; set; } @@ -74,14 +92,22 @@ public partial class OperationalInsightsManagementClient : Microsoft.Rest.Servic public virtual IWorkspacesOperations Workspaces { get; private set; } /// - /// Gets the IStorageInsightsOperations. + /// Gets the IOperations. /// - public virtual IStorageInsightsOperations StorageInsights { get; private set; } + public virtual IOperations Operations { get; private set; } /// - /// Gets the ISavedSearchesOperations. + /// Initializes a new instance of the OperationalInsightsManagementClient class. /// - public virtual ISavedSearchesOperations SavedSearches { get; private set; } + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling OperationalInsightsManagementClient.Dispose(). False: will not dispose provided httpClient + protected OperationalInsightsManagementClient(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + Initialize(); + } /// /// Initializes a new instance of the OperationalInsightsManagementClient class. @@ -89,9 +115,9 @@ public partial class OperationalInsightsManagementClient : Microsoft.Rest.Servic /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected OperationalInsightsManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + protected OperationalInsightsManagementClient(params DelegatingHandler[] handlers) : base(handlers) { - this.Initialize(); + Initialize(); } /// @@ -103,9 +129,9 @@ protected OperationalInsightsManagementClient(params System.Net.Http.DelegatingH /// /// Optional. The delegating handlers to add to the http client pipeline. /// - protected OperationalInsightsManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + protected OperationalInsightsManagementClient(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers) { - this.Initialize(); + Initialize(); } /// @@ -120,13 +146,13 @@ protected OperationalInsightsManagementClient(System.Net.Http.HttpClientHandler /// /// Thrown when a required parameter is null /// - protected OperationalInsightsManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + protected OperationalInsightsManagementClient(System.Uri baseUri, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -144,13 +170,13 @@ protected OperationalInsightsManagementClient(System.Uri baseUri, params System. /// /// Thrown when a required parameter is null /// - protected OperationalInsightsManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + protected OperationalInsightsManagementClient(System.Uri baseUri, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { throw new System.ArgumentNullException("baseUri"); } - this.BaseUri = baseUri; + BaseUri = baseUri; } /// @@ -165,16 +191,43 @@ protected OperationalInsightsManagementClient(System.Uri baseUri, System.Net.Htt /// /// Thrown when a required parameter is null /// - public OperationalInsightsManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public OperationalInsightsManagementClient(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); + } + } + + /// + /// Initializes a new instance of the OperationalInsightsManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling OperationalInsightsManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public OperationalInsightsManagementClient(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + Credentials = credentials; + if (Credentials != null) + { + Credentials.InitializeServiceClient(this); } } @@ -193,16 +246,16 @@ public OperationalInsightsManagementClient(Microsoft.Rest.ServiceClientCredentia /// /// Thrown when a required parameter is null /// - public OperationalInsightsManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public OperationalInsightsManagementClient(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); } } @@ -221,7 +274,7 @@ public OperationalInsightsManagementClient(Microsoft.Rest.ServiceClientCredentia /// /// Thrown when a required parameter is null /// - public OperationalInsightsManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + public OperationalInsightsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers) { if (baseUri == null) { @@ -231,11 +284,11 @@ public OperationalInsightsManagementClient(System.Uri baseUri, Microsoft.Rest.Se { 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); } } @@ -257,7 +310,7 @@ public OperationalInsightsManagementClient(System.Uri baseUri, Microsoft.Rest.Se /// /// Thrown when a required parameter is null /// - public OperationalInsightsManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + public OperationalInsightsManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers) { if (baseUri == null) { @@ -267,11 +320,11 @@ public OperationalInsightsManagementClient(System.Uri baseUri, Microsoft.Rest.Se { 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); } } @@ -284,44 +337,44 @@ public OperationalInsightsManagementClient(System.Uri baseUri, Microsoft.Rest.Se /// private void Initialize() { - this.LinkedServices = new LinkedServicesOperations(this); - this.DataSources = new DataSourcesOperations(this); - this.Workspaces = new WorkspacesOperations(this); - this.StorageInsights = new StorageInsightsOperations(this); - this.SavedSearches = new SavedSearchesOperations(this); - this.BaseUri = new System.Uri("https://management.azure.com"); - this.AcceptLanguage = "en-US"; - this.LongRunningOperationRetryTimeout = 30; - this.GenerateClientRequestId = true; - SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + LinkedServices = new LinkedServicesOperations(this); + DataSources = new DataSourcesOperations(this); + Workspaces = new WorkspacesOperations(this); + Operations = new Operations(this); + BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2015-11-01-preview"; + 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/OperationalInsights/Management/Management.OperationalInsights/Generated/Operations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Operations.cs new file mode 100644 index 000000000000..aff90a29fcc5 --- /dev/null +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/Operations.cs @@ -0,0 +1,400 @@ +// +// 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.OperationalInsights +{ + 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; + + /// + /// Operations operations. + /// + internal partial class Operations : IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations(OperationalInsightsManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the OperationalInsightsManagementClient + /// + public OperationalInsightsManagementClient Client { get; private set; } + + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// 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.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + 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("/") ? "" : "/")), "providers/Microsoft.OperationalInsights/operations").ToString(); + 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("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 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(); + } + // 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; + } + + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// 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 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(); + } + // 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/OperationalInsights/Management/Management.OperationalInsights/Generated/OperationsExtensions.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..88b7fd3d4e71 --- /dev/null +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/OperationsExtensions.cs @@ -0,0 +1,87 @@ +// +// 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.OperationalInsights +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for Operations. + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// The operations group for this extension method. + /// + public static IPage List(this IOperations operations) + { + return operations.ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available OperationalInsights Rest API operations. + /// + /// + /// 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 IOperations 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/OperationalInsights/Management/Management.OperationalInsights/Generated/SavedSearchesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SavedSearchesOperations.cs deleted file mode 100644 index 6d846f39383c..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SavedSearchesOperations.cs +++ /dev/null @@ -1,1086 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights -{ - using System.Linq; - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - - /// - /// SavedSearchesOperations operations. - /// - internal partial class SavedSearchesOperations : Microsoft.Rest.IServiceOperations, ISavedSearchesOperations - { - /// - /// Initializes a new instance of the SavedSearchesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal SavedSearchesOperations(OperationalInsightsManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - this.Client = client; - } - - /// - /// Gets a reference to the OperationalInsightsManagementClient - /// - public OperationalInsightsManagementClient Client { get; private set; } - - /// - /// Deletes the specified saved search in a given workspace. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// Name of the saved search. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (savedSearchName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "savedSearchName"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("savedSearchName", savedSearchName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{savedSearchName}", System.Uri.EscapeDataString(savedSearchName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates or updates a saved search for a given workspace. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - /// - /// The parameters required to save a search. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, SavedSearch parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (savedSearchName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "savedSearchName"); - } - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("savedSearchName", savedSearchName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{savedSearchName}", System.Uri.EscapeDataString(savedSearchName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.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) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the specified saved search for a given workspace. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (savedSearchName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "savedSearchName"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("savedSearchName", savedSearchName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{savedSearchName}", System.Uri.EscapeDataString(savedSearchName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the saved searches for a given Log Analytics Workspace - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the results from a saved search for a given workspace. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The name of the saved search. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> GetResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string savedSearchName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (savedSearchName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "savedSearchName"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("savedSearchName", savedSearchName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetResults", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/savedSearches/{savedSearchName}/results").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{savedSearchName}", System.Uri.EscapeDataString(savedSearchName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SavedSearchesOperationsExtensions.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SavedSearchesOperationsExtensions.cs deleted file mode 100644 index 56171299ac9d..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SavedSearchesOperationsExtensions.cs +++ /dev/null @@ -1,244 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights -{ - using System.Threading.Tasks; - using Microsoft.Rest.Azure; - using Models; - - /// - /// Extension methods for SavedSearchesOperations. - /// - public static partial class SavedSearchesOperationsExtensions - { - /// - /// Deletes the specified saved search in a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// Name of the saved search. - /// - public static void Delete(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName) - { - System.Threading.Tasks.Task.Factory.StartNew(s => ((ISavedSearchesOperations)s).DeleteAsync(resourceGroupName, workspaceName, savedSearchName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Deletes the specified saved search in a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// Name of the saved search. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task DeleteAsync(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, savedSearchName, null, cancellationToken).ConfigureAwait(false); - } - - /// - /// Creates or updates a saved search for a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - /// - /// The parameters required to save a search. - /// - public static SavedSearch CreateOrUpdate(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName, SavedSearch parameters) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISavedSearchesOperations)s).CreateOrUpdateAsync(resourceGroupName, workspaceName, savedSearchName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a saved search for a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - /// - /// The parameters required to save a search. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName, SavedSearch parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, savedSearchName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the specified saved search for a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - public static SavedSearch Get(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISavedSearchesOperations)s).GetAsync(resourceGroupName, workspaceName, savedSearchName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Gets the specified saved search for a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the saved search. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task GetAsync(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, savedSearchName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the saved searches for a given Log Analytics Workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - public static SavedSearchesListResult ListByWorkspace(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISavedSearchesOperations)s).ListByWorkspaceAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Gets the saved searches for a given Log Analytics Workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task ListByWorkspaceAsync(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the results from a saved search for a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The name of the saved search. - /// - public static SearchResultsResponse GetResults(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((ISavedSearchesOperations)s).GetResultsAsync(resourceGroupName, workspaceName, savedSearchName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Gets the results from a saved search for a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The name of the saved search. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task GetResultsAsync(this ISavedSearchesOperations operations, string resourceGroupName, string workspaceName, string savedSearchName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.GetResultsWithHttpMessagesAsync(resourceGroupName, workspaceName, savedSearchName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SdkInfo_OperationalInsightsManagementClient.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SdkInfo_OperationalInsightsManagementClient.cs new file mode 100644 index 000000000000..1f1b7917d893 --- /dev/null +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/SdkInfo_OperationalInsightsManagementClient.cs @@ -0,0 +1,30 @@ + +// +// 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.OperationalInsights +{ + using System; + using System.Collections.Generic; + using System.Linq; + + internal static partial class SdkInfo + { + public static IEnumerable> ApiInfo_OperationalInsightsManagementClient + { + get + { + return new Tuple[] + { + new Tuple("OperationalInsights", "DataSources", "2015-11-01-preview"), + new Tuple("OperationalInsights", "LinkedServices", "2015-11-01-preview"), + new Tuple("OperationalInsights", "Operations", "2015-11-01-preview"), + new Tuple("OperationalInsights", "Workspaces", "2015-11-01-preview"), + }.AsEnumerable(); + } + } + } +} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/StorageInsightsOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/StorageInsightsOperations.cs deleted file mode 100644 index 1e8980b9eac7..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/StorageInsightsOperations.cs +++ /dev/null @@ -1,1063 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights -{ - using System.Linq; - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - - /// - /// StorageInsightsOperations operations. - /// - internal partial class StorageInsightsOperations : Microsoft.Rest.IServiceOperations, IStorageInsightsOperations - { - /// - /// Initializes a new instance of the StorageInsightsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal StorageInsightsOperations(OperationalInsightsManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - this.Client = client; - } - - /// - /// Gets a reference to the OperationalInsightsManagementClient - /// - public OperationalInsightsManagementClient Client { get; private set; } - - /// - /// Create or update a storage insight. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// The parameters required to create or update a storage insight. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string storageInsightName, StorageInsight parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (storageInsightName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "storageInsightName"); - } - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("storageInsightName", storageInsightName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{storageInsightName}", System.Uri.EscapeDataString(storageInsightName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.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) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a storage insight instance. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that contains the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string storageInsightName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (storageInsightName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "storageInsightName"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("storageInsightName", storageInsightName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{storageInsightName}", System.Uri.EscapeDataString(storageInsightName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a storageInsightsConfigs resource - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that contains the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string storageInsightName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (storageInsightName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "storageInsightName"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("storageInsightName", storageInsightName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.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("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs/{storageInsightName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{storageInsightName}", System.Uri.EscapeDataString(storageInsightName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the storageInsightsConfigs - /// resource - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task>> ListByWorkspaceWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspace", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/storageInsightConfigs").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task>> ListByWorkspaceNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (nextPageLink == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByWorkspaceNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/StorageInsightsOperationsExtensions.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/StorageInsightsOperationsExtensions.cs deleted file mode 100644 index e087d10a120d..000000000000 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/StorageInsightsOperationsExtensions.cs +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. - -namespace Microsoft.Azure.Management.OperationalInsights -{ - using System.Threading.Tasks; - using Microsoft.Rest.Azure; - using Models; - - /// - /// Extension methods for StorageInsightsOperations. - /// - public static partial class StorageInsightsOperationsExtensions - { - /// - /// Create or update a storage insight. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// The parameters required to create or update a storage insight. - /// - public static StorageInsight CreateOrUpdate(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName, string storageInsightName, StorageInsight parameters) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IStorageInsightsOperations)s).CreateOrUpdateAsync(resourceGroupName, workspaceName, storageInsightName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Create or update a storage insight. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// The parameters required to create or update a storage insight. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName, string storageInsightName, StorageInsight parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, storageInsightName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a storage insight instance. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that contains the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - public static StorageInsight Get(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName, string storageInsightName) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IStorageInsightsOperations)s).GetAsync(resourceGroupName, workspaceName, storageInsightName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Gets a storage insight instance. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that contains the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task GetAsync(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName, string storageInsightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, storageInsightName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a storageInsightsConfigs resource - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that contains the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - public static void Delete(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName, string storageInsightName) - { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IStorageInsightsOperations)s).DeleteAsync(resourceGroupName, workspaceName, storageInsightName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Deletes a storageInsightsConfigs resource - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that contains the storageInsightsConfigs - /// resource - /// - /// - /// Name of the storageInsightsConfigs resource - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task DeleteAsync(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName, string storageInsightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, storageInsightName, null, cancellationToken).ConfigureAwait(false); - } - - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the storageInsightsConfigs - /// resource - /// - public static Microsoft.Rest.Azure.IPage ListByWorkspace(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IStorageInsightsOperations)s).ListByWorkspaceAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics Workspace name that will contain the storageInsightsConfigs - /// resource - /// - /// - /// The cancellation token. - /// - public static async Task> ListByWorkspaceAsync(this IStorageInsightsOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.ListByWorkspaceWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static Microsoft.Rest.Azure.IPage ListByWorkspaceNext(this IStorageInsightsOperations operations, string nextPageLink) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IStorageInsightsOperations)s).ListByWorkspaceNextAsync(nextPageLink), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Lists the storage insight instances within a workspace - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByWorkspaceNextAsync(this IStorageInsightsOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.ListByWorkspaceNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperations.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperations.cs index 3921154f0327..c7d08abfc58d 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperations.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperations.cs @@ -1,18 +1,31 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { - 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; /// /// WorkspacesOperations operations. /// - internal partial class WorkspacesOperations : Microsoft.Rest.IServiceOperations, IWorkspacesOperations + internal partial class WorkspacesOperations : IServiceOperations, IWorkspacesOperations { /// /// Initializes a new instance of the WorkspacesOperations class. @@ -25,11 +38,11 @@ internal partial class WorkspacesOperations : Microsoft.Rest.IServiceOperations< /// internal WorkspacesOperations(OperationalInsightsManagementClient client) { - if (client == null) + if (client == null) { throw new System.ArgumentNullException("client"); } - this.Client = client; + Client = client; } /// @@ -55,97 +68,104 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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 DisableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DisableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (intelligencePackName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "intelligencePackName"); + throw new ValidationException(ValidationRules.CannotBeNull, "intelligencePackName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("intelligencePackName", intelligencePackName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "DisableIntelligencePack", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "DisableIntelligencePack", 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.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Disable").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{intelligencePackName}", System.Uri.EscapeDataString(intelligencePackName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -161,43 +181,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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)); - 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) @@ -207,7 +235,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -216,7 +244,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -239,97 +267,104 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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 EnableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task EnableIntelligencePackWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string intelligencePackName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } if (intelligencePackName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "intelligencePackName"); + throw new ValidationException(ValidationRules.CannotBeNull, "intelligencePackName"); } - if (this.Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); tracingParameters.Add("intelligencePackName", intelligencePackName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "EnableIntelligencePack", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "EnableIntelligencePack", 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.OperationalInsights/workspaces/{workspaceName}/intelligencePacks/{intelligencePackName}/Enable").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); _url = _url.Replace("{intelligencePackName}", System.Uri.EscapeDataString(intelligencePackName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -345,43 +380,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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)); - 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) @@ -391,7 +434,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -400,7 +443,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -421,94 +464,101 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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>> ListIntelligencePacksWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListIntelligencePacksWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListIntelligencePacks", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListIntelligencePacks", 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.OperationalInsights/workspaces/{workspaceName}/intelligencePacks").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -524,51 +574,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -578,7 +628,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -591,21 +641,21 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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; } @@ -625,94 +675,101 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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> GetSharedKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetSharedKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetSharedKeys", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "GetSharedKeys", 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.OperationalInsights/workspaces/{workspaceName}/sharedKeys").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -728,51 +785,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -782,7 +839,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -795,21 +852,21 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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; } @@ -829,94 +886,101 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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>> ListUsagesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListUsagesWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListUsages", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListUsages", 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.OperationalInsights/workspaces/{workspaceName}/usages").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -932,51 +996,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -986,7 +1050,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -999,21 +1063,21 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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; } @@ -1033,94 +1097,101 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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>> ListManagementGroupsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListManagementGroupsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } - if (this.Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListManagementGroups", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListManagementGroups", 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.OperationalInsights/workspaces/{workspaceName}/managementGroups").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -1136,51 +1207,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -1190,7 +1261,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -1203,21 +1274,21 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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; } @@ -1234,88 +1305,95 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(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.SubscriptionId == null) + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 = "2015-11-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("apiVersion", apiVersion); 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.OperationalInsights/workspaces").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 (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(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) @@ -1331,51 +1409,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -1385,7 +1463,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -1398,21 +1476,21 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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,67 +1504,74 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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.SubscriptionId == null) + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + 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 = "2015-11-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(); - tracingParameters.Add("apiVersion", apiVersion); + _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}/providers/Microsoft.OperationalInsights/workspaces").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -1502,51 +1587,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -1556,7 +1641,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -1569,21 +1654,21 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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; } @@ -1606,14 +1691,11 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) /// /// The cancellation token. /// - public async System.Threading.Tasks.Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync( - resourceGroupName, workspaceName, parameters, customHeaders, cancellationToken); - return await this.Client.GetPutOrPatchOperationResultAsync(_response, - customHeaders, - cancellationToken); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// @@ -1631,76 +1713,83 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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 resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); - 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}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -1716,43 +1805,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -1762,7 +1859,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -1771,7 +1868,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) } if (_shouldTrace) { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + ServiceClientTracing.Exit(_invocationId, _result); } return _result; } @@ -1791,79 +1888,86 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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 workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string workspaceName, 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 (workspaceName == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); } - if (this.Client.SubscriptionId == null) + if (Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-11-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("workspaceName", workspaceName); - 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/Microsoft.OperationalInsights/workspaces/{workspaceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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) @@ -1879,51 +1983,51 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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) @@ -1933,7 +2037,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -1946,97 +2050,143 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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; } /// - /// Get a list of workspaces which the current user has administrator - /// privileges and are not associated with an Azure Subscription. The - /// subscriptionId parameter in the Url is ignored. + /// Updates a workspace. /// + /// + /// The resource group name of the workspace. + /// + /// + /// The name of the workspace. + /// + /// + /// The parameters required to patch a workspace. + /// /// /// 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 System.Threading.Tasks.Task>> ListLinkTargetsWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { - if (this.Client.SubscriptionId == null) + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (workspaceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 63) + { + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 63); + } + if (workspaceName.Length < 4) + { + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 4); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(workspaceName, "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$")) + { + throw new ValidationException(ValidationRules.Pattern, "workspaceName", "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$"); + } + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (Client.ApiVersion == null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2015-03-20"; // 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(); - tracingParameters.Add("apiVersion", apiVersion); + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceName", workspaceName); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListLinkTargets", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL - var _baseUrl = this.Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.OperationalInsights/linkTargets").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (apiVersion != null) + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); + _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(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("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) @@ -2051,52 +2201,58 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) // 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 (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) @@ -2106,7 +2262,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -2119,33 +2275,36 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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; } /// - /// Gets the schema for a given workspace. + /// Create or update a workspace. /// /// - /// The name of the resource group to get. The name is case insensitive. + /// The resource group name of the workspace. /// /// - /// Log Analytics workspace name + /// The name of the workspace. + /// + /// + /// The parameters required to create or update a workspace. /// /// /// Headers that will be added to request. @@ -2153,94 +2312,110 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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> GetSchemaWithHttpMessagesAsync(string resourceGroupName, string workspaceName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace 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 (workspaceName == null) { - if (resourceGroupName.Length > 90) + throw new ValidationException(ValidationRules.CannotBeNull, "workspaceName"); + } + if (workspaceName != null) + { + if (workspaceName.Length > 63) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + throw new ValidationException(ValidationRules.MaxLength, "workspaceName", 63); } - if (resourceGroupName.Length < 1) + if (workspaceName.Length < 4) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + throw new ValidationException(ValidationRules.MinLength, "workspaceName", 4); } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + if (!System.Text.RegularExpressions.Regex.IsMatch(workspaceName, "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$")) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + throw new ValidationException(ValidationRules.Pattern, "workspaceName", "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$"); } } - if (workspaceName == null) + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); + parameters.Validate(); + } + if (Client.ApiVersion == null) + { + 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"); } - string apiVersion = "2015-03-20"; // 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("workspaceName", workspaceName); - tracingParameters.Add("apiVersion", apiVersion); + tracingParameters.Add("parameters", parameters); tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetSchema", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/schema").ToString(); + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); - if (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(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("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) @@ -2255,52 +2430,58 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) // 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 (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 != 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) @@ -2310,7 +2491,7 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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")) @@ -2323,480 +2504,16 @@ internal WorkspacesOperations(OperationalInsightsManagementClient 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); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Submit a search for a given workspace. The response will contain an id to - /// track the search. User can use the id to poll the search status and get the - /// full search result later if the search takes long time to finish. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The parameters required to execute a search query. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async System.Threading.Tasks.Task> GetSearchResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, SearchParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - // Send request - Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginGetSearchResultsWithHttpMessagesAsync( - resourceGroupName, workspaceName, parameters, customHeaders, cancellationToken); - return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken); - } - - /// - /// Gets updated search results for a given search query. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the search that will have results updated. You can get the id - /// from the response of the GetResults call. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> UpdateSearchResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, string id, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (id == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "id"); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("id", id); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "UpdateSearchResults", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/search/{id}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{id}", System.Uri.EscapeDataString(id)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create or update a workspace. - /// - /// - /// The resource group name of the workspace. - /// - /// - /// The name of the workspace. - /// - /// - /// The parameters required to create or update a workspace. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceName, Workspace parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (workspaceName != null) - { - if (workspaceName.Length > 63) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "workspaceName", 63); - } - if (workspaceName.Length < 4) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "workspaceName", 4); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(workspaceName, "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "workspaceName", "^[A-Za-z0-9][A-Za-z0-9-]+[A-Za-z0-9]$"); - } - } - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-11-01-preview"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.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) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.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)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.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 @@ -2805,245 +2522,21 @@ internal WorkspacesOperations(OperationalInsightsManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); - } - catch (Newtonsoft.Json.JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Submit a search for a given workspace. The response will contain an id to - /// track the search. User can use the id to poll the search status and get the - /// full search result later if the search takes long time to finish. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The parameters required to execute a search query. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async System.Threading.Tasks.Task> BeginGetSearchResultsWithHttpMessagesAsync(string resourceGroupName, string workspaceName, SearchParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - if (resourceGroupName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (workspaceName == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceName"); - } - if (parameters == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (this.Client.SubscriptionId == null) - { - throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-03-20"; - // Tracing - bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); - System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("workspaceName", workspaceName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginGetSearchResults", 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/Microsoft.OperationalInsights/workspaces/{workspaceName}/search").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{workspaceName}", System.Uri.EscapeDataString(workspaceName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); - System.Collections.Generic.List _queryParameters = new System.Collections.Generic.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 - System.Net.Http.HttpRequestMessage _httpRequest = new System.Net.Http.HttpRequestMessage(); - System.Net.Http.HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (this.Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.Client.SerializationSettings); - _httpRequest.Content = new System.Net.Http.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) - { - cancellationToken.ThrowIfCancellationRequested(); - await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new Microsoft.Rest.Azure.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); - if (_errorBody != null) - { - ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (Newtonsoft.Json.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(); - } - if (_shouldTrace) - { - Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new Microsoft.Rest.Azure.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 = 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/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperationsExtensions.cs b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperationsExtensions.cs index 112e74e2f104..f80af78a224d 100644 --- a/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperationsExtensions.cs +++ b/src/SDKs/OperationalInsights/Management/Management.OperationalInsights/Generated/WorkspacesOperationsExtensions.cs @@ -1,12 +1,22 @@ -// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0 +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is // regenerated. +// namespace Microsoft.Azure.Management.OperationalInsights { + 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 WorkspacesOperations. @@ -30,7 +40,7 @@ public static partial class WorkspacesOperationsExtensions /// public static void DisableIntelligencePack(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string intelligencePackName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).DisableIntelligencePackAsync(resourceGroupName, workspaceName, intelligencePackName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DisableIntelligencePackAsync(resourceGroupName, workspaceName, intelligencePackName).GetAwaiter().GetResult(); } /// @@ -51,9 +61,9 @@ public static void DisableIntelligencePack(this IWorkspacesOperations operations /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DisableIntelligencePackAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string intelligencePackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DisableIntelligencePackAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string intelligencePackName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DisableIntelligencePackWithHttpMessagesAsync(resourceGroupName, workspaceName, intelligencePackName, null, cancellationToken).ConfigureAwait(false); + (await operations.DisableIntelligencePackWithHttpMessagesAsync(resourceGroupName, workspaceName, intelligencePackName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -73,7 +83,7 @@ public static void DisableIntelligencePack(this IWorkspacesOperations operations /// public static void EnableIntelligencePack(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string intelligencePackName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).EnableIntelligencePackAsync(resourceGroupName, workspaceName, intelligencePackName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.EnableIntelligencePackAsync(resourceGroupName, workspaceName, intelligencePackName).GetAwaiter().GetResult(); } /// @@ -94,9 +104,9 @@ public static void EnableIntelligencePack(this IWorkspacesOperations operations, /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task EnableIntelligencePackAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string intelligencePackName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task EnableIntelligencePackAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string intelligencePackName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.EnableIntelligencePackWithHttpMessagesAsync(resourceGroupName, workspaceName, intelligencePackName, null, cancellationToken).ConfigureAwait(false); + (await operations.EnableIntelligencePackWithHttpMessagesAsync(resourceGroupName, workspaceName, intelligencePackName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -112,9 +122,9 @@ public static void EnableIntelligencePack(this IWorkspacesOperations operations, /// /// Name of the Log Analytics Workspace. /// - public static System.Collections.Generic.IList ListIntelligencePacks(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + public static IList ListIntelligencePacks(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).ListIntelligencePacksAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListIntelligencePacksAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); } /// @@ -133,7 +143,7 @@ public static System.Collections.Generic.IList ListIntelligenc /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task> ListIntelligencePacksAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListIntelligencePacksAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListIntelligencePacksWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) { @@ -155,7 +165,7 @@ public static System.Collections.Generic.IList ListIntelligenc /// public static SharedKeys GetSharedKeys(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).GetSharedKeysAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetSharedKeysAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); } /// @@ -173,7 +183,7 @@ public static SharedKeys GetSharedKeys(this IWorkspacesOperations operations, st /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetSharedKeysAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetSharedKeysAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSharedKeysWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) { @@ -193,9 +203,9 @@ public static SharedKeys GetSharedKeys(this IWorkspacesOperations operations, st /// /// The name of the workspace. /// - public static System.Collections.Generic.IEnumerable ListUsages(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + public static IEnumerable ListUsages(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).ListUsagesAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListUsagesAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); } /// @@ -213,7 +223,7 @@ public static System.Collections.Generic.IEnumerable ListUsages(thi /// /// The cancellation token. /// - public static async Task> ListUsagesAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListUsagesAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListUsagesWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) { @@ -233,9 +243,9 @@ public static System.Collections.Generic.IEnumerable ListUsages(thi /// /// The name of the workspace. /// - public static System.Collections.Generic.IEnumerable ListManagementGroups(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) + public static IEnumerable ListManagementGroups(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).ListManagementGroupsAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListManagementGroupsAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); } /// @@ -253,7 +263,7 @@ public static System.Collections.Generic.IEnumerable ListManage /// /// The cancellation token. /// - public static async Task> ListManagementGroupsAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListManagementGroupsAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListManagementGroupsWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) { @@ -270,9 +280,9 @@ public static System.Collections.Generic.IEnumerable ListManage /// /// The name of the resource group to get. The name is case insensitive. /// - public static System.Collections.Generic.IEnumerable ListByResourceGroup(this IWorkspacesOperations operations, string resourceGroupName) + public static IEnumerable ListByResourceGroup(this IWorkspacesOperations operations, string resourceGroupName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).ListByResourceGroupAsync(resourceGroupName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } /// @@ -287,7 +297,7 @@ public static System.Collections.Generic.IEnumerable ListByResourceGr /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IWorkspacesOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IWorkspacesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -301,9 +311,9 @@ public static System.Collections.Generic.IEnumerable ListByResourceGr /// /// The operations group for this extension method. /// - public static System.Collections.Generic.IEnumerable List(this IWorkspacesOperations operations) + public static IEnumerable List(this IWorkspacesOperations operations) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)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(); } /// @@ -315,7 +325,7 @@ public static System.Collections.Generic.IEnumerable List(this IWorks /// /// The cancellation token. /// - public static async Task> ListAsync(this IWorkspacesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task> ListAsync(this IWorkspacesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -340,7 +350,7 @@ public static System.Collections.Generic.IEnumerable List(this IWorks /// public static Workspace CreateOrUpdate(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).CreateOrUpdateAsync(resourceGroupName, workspaceName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult(); } /// @@ -361,7 +371,7 @@ public static Workspace CreateOrUpdate(this IWorkspacesOperations operations, st /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task CreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task CreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -383,7 +393,7 @@ public static Workspace CreateOrUpdate(this IWorkspacesOperations operations, st /// public static void Delete(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) { - System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).DeleteAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); } /// @@ -401,9 +411,9 @@ public static void Delete(this IWorkspacesOperations operations, string resource /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task DeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task DeleteAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) { - await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false); + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -420,7 +430,7 @@ public static void Delete(this IWorkspacesOperations operations, string resource /// public static Workspace Get(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).GetAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, workspaceName).GetAwaiter().GetResult(); } /// @@ -438,7 +448,7 @@ public static Workspace Get(this IWorkspacesOperations operations, string resour /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task GetAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task GetAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) { @@ -447,170 +457,46 @@ public static Workspace Get(this IWorkspacesOperations operations, string resour } /// - /// Get a list of workspaces which the current user has administrator - /// privileges and are not associated with an Azure Subscription. The - /// subscriptionId parameter in the Url is ignored. - /// - /// - /// The operations group for this extension method. - /// - public static System.Collections.Generic.IList ListLinkTargets(this IWorkspacesOperations operations) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).ListLinkTargetsAsync(), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Get a list of workspaces which the current user has administrator - /// privileges and are not associated with an Azure Subscription. The - /// subscriptionId parameter in the Url is ignored. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task> ListLinkTargetsAsync(this IWorkspacesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.ListLinkTargetsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the schema for a given workspace. + /// Updates a workspace. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - public static SearchGetSchemaResponse GetSchema(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).GetSchemaAsync(resourceGroupName, workspaceName), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Gets the schema for a given workspace. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task GetSchemaAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.GetSchemaWithHttpMessagesAsync(resourceGroupName, workspaceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Submit a search for a given workspace. The response will contain an id to - /// track the search. User can use the id to poll the search status and get the - /// full search result later if the search takes long time to finish. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. + /// The resource group name of the workspace. /// /// - /// Log Analytics workspace name + /// The name of the workspace. /// /// - /// The parameters required to execute a search query. + /// The parameters required to patch a workspace. /// - public static SearchResultsResponse GetSearchResults(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, SearchParameters parameters) + public static Workspace Update(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).GetSearchResultsAsync(resourceGroupName, workspaceName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult(); } /// - /// Submit a search for a given workspace. The response will contain an id to - /// track the search. User can use the id to poll the search status and get the - /// full search result later if the search takes long time to finish. + /// Updates a workspace. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group to get. The name is case insensitive. + /// The resource group name of the workspace. /// /// - /// Log Analytics workspace name + /// The name of the workspace. /// /// - /// The parameters required to execute a search query. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task GetSearchResultsAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, SearchParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.GetSearchResultsWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets updated search results for a given search query. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the search that will have results updated. You can get the id - /// from the response of the GetResults call. - /// - public static SearchResultsResponse UpdateSearchResults(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string id) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).UpdateSearchResultsAsync(resourceGroupName, workspaceName, id), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Gets updated search results for a given search query. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The id of the search that will have results updated. You can get the id - /// from the response of the GetResults call. + /// The parameters required to patch a workspace. /// /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task UpdateSearchResultsAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task UpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateSearchResultsWithHttpMessagesAsync(resourceGroupName, workspaceName, id, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -633,7 +519,7 @@ public static SearchResultsResponse UpdateSearchResults(this IWorkspacesOperatio /// public static Workspace BeginCreateOrUpdate(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters) { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.BeginCreateOrUpdateAsync(resourceGroupName, workspaceName, parameters).GetAwaiter().GetResult(); } /// @@ -654,7 +540,7 @@ public static Workspace BeginCreateOrUpdate(this IWorkspacesOperations operation /// /// The cancellation token. /// - public static async System.Threading.Tasks.Task BeginCreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + public static async Task BeginCreateOrUpdateAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, Workspace parameters, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) { @@ -662,55 +548,5 @@ public static Workspace BeginCreateOrUpdate(this IWorkspacesOperations operation } } - /// - /// Submit a search for a given workspace. The response will contain an id to - /// track the search. User can use the id to poll the search status and get the - /// full search result later if the search takes long time to finish. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The parameters required to execute a search query. - /// - public static SearchResultsResponse BeginGetSearchResults(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, SearchParameters parameters) - { - return System.Threading.Tasks.Task.Factory.StartNew(s => ((IWorkspacesOperations)s).BeginGetSearchResultsAsync(resourceGroupName, workspaceName, parameters), operations, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskCreationOptions.None, System.Threading.Tasks.TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); - } - - /// - /// Submit a search for a given workspace. The response will contain an id to - /// track the search. User can use the id to poll the search status and get the - /// full search result later if the search takes long time to finish. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group to get. The name is case insensitive. - /// - /// - /// Log Analytics workspace name - /// - /// - /// The parameters required to execute a search query. - /// - /// - /// The cancellation token. - /// - public static async System.Threading.Tasks.Task BeginGetSearchResultsAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceName, SearchParameters parameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) - { - using (var _result = await operations.BeginGetSearchResultsWithHttpMessagesAsync(resourceGroupName, workspaceName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - } }