diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperations.cs deleted file mode 100644 index e1e63466085b6..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperations.cs +++ /dev/null @@ -1,1380 +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.Monitor -{ - 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; - - /// - /// ActionGroupsOperations operations. - /// - internal partial class ActionGroupsOperations : IServiceOperations, IActionGroupsOperations - { - /// - /// Initializes a new instance of the ActionGroupsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ActionGroupsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Create a new action group or update an existing one. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The action group to create or use for the update. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (actionGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName"); - } - if (actionGroup == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionGroup"); - } - if (actionGroup != null) - { - actionGroup.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("actionGroupName", actionGroupName); - tracingParameters.Add("actionGroup", actionGroup); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(actionGroup != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(actionGroup, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get an action group. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (actionGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("actionGroupName", actionGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete an action group. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (actionGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("actionGroupName", actionGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates an existing action group's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (actionGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName"); - } - if (actionGroupPatch == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupPatch"); - } - string apiVersion = "2019-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("actionGroupName", actionGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("actionGroupPatch", actionGroupPatch); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(actionGroupPatch != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(actionGroupPatch, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get a list of all action groups in a subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionId", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/actionGroups").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Get a list of all action groups in a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-06-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Enable a receiver in an action group. This changes the receiver's status - /// from Disabled to Enabled. This operation is only supported for Email or SMS - /// receivers. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The name of the receiver to resubscribe. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task EnableReceiverWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, string receiverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (actionGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "actionGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (receiverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "receiverName"); - } - string apiVersion = "2019-06-01"; - EnableRequest enableRequest = new EnableRequest(); - if (receiverName != null) - { - enableRequest.ReceiverName = receiverName; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("actionGroupName", actionGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("enableRequest", enableRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "EnableReceiver", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/actionGroups/{actionGroupName}/subscribe").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{actionGroupName}", System.Uri.EscapeDataString(actionGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(enableRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(enableRequest, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 409) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperationsExtensions.cs deleted file mode 100644 index 4583e18a46247..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActionGroupsOperationsExtensions.cs +++ /dev/null @@ -1,307 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ActionGroupsOperations. - /// - public static partial class ActionGroupsOperationsExtensions - { - /// - /// Create a new action group or update an existing one. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The action group to create or use for the update. - /// - public static ActionGroupResource CreateOrUpdate(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup) - { - return operations.CreateOrUpdateAsync(resourceGroupName, actionGroupName, actionGroup).GetAwaiter().GetResult(); - } - - /// - /// Create a new action group or update an existing one. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The action group to create or use for the update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, actionGroupName, actionGroup, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get an action group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - public static ActionGroupResource Get(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName) - { - return operations.GetAsync(resourceGroupName, actionGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get an action group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, actionGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete an action group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - public static void Delete(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName) - { - operations.DeleteAsync(resourceGroupName, actionGroupName).GetAwaiter().GetResult(); - } - - /// - /// Delete an action group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, actionGroupName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates an existing action group's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// Parameters supplied to the operation. - /// - public static ActionGroupResource Update(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch) - { - return operations.UpdateAsync(resourceGroupName, actionGroupName, actionGroupPatch).GetAwaiter().GetResult(); - } - - /// - /// Updates an existing action group's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, actionGroupName, actionGroupPatch, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a list of all action groups in a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable ListBySubscriptionId(this IActionGroupsOperations operations) - { - return operations.ListBySubscriptionIdAsync().GetAwaiter().GetResult(); - } - - /// - /// Get a list of all action groups in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionIdAsync(this IActionGroupsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionIdWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Get a list of all action groups in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - public static IEnumerable ListByResourceGroup(this IActionGroupsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get a list of all action groups in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IActionGroupsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Enable a receiver in an action group. This changes the receiver's status - /// from Disabled to Enabled. This operation is only supported for Email or SMS - /// receivers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The name of the receiver to resubscribe. - /// - public static void EnableReceiver(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, string receiverName) - { - operations.EnableReceiverAsync(resourceGroupName, actionGroupName, receiverName).GetAwaiter().GetResult(); - } - - /// - /// Enable a receiver in an action group. This changes the receiver's status - /// from Disabled to Enabled. This operation is only supported for Email or SMS - /// receivers. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The name of the receiver to resubscribe. - /// - /// - /// The cancellation token. - /// - public static async Task EnableReceiverAsync(this IActionGroupsOperations operations, string resourceGroupName, string actionGroupName, string receiverName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.EnableReceiverWithHttpMessagesAsync(resourceGroupName, actionGroupName, receiverName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs index 861e5a5c1e240..28ae187174dbe 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperations.cs @@ -51,16 +51,16 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) public MonitorManagementClient Client { get; private set; } /// - /// Create a new activity log alert or update an existing one. + /// Create a new Activity Log Alert rule or update an existing one. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// - /// The activity log alert to create or use for the update. + /// + /// The Activity Log Alert rule to create or use for the update. /// /// /// Headers that will be added to request. @@ -83,29 +83,61 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (activityLogAlertName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - if (activityLogAlert == null) + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) { - throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlert"); + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } } - if (activityLogAlert != null) + if (activityLogAlertRule == null) { - activityLogAlert.Validate(); + throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertRule"); + } + if (activityLogAlertRule != null) + { + activityLogAlertRule.Validate(); } - string apiVersion = "2017-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -115,21 +147,20 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("activityLogAlertName", activityLogAlertName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("activityLogAlert", activityLogAlert); + tracingParameters.Add("activityLogAlertRule", activityLogAlertRule); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName)); List _queryParameters = new List(); - 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) { @@ -169,9 +200,9 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) // Serialize Request string _requestContent = null; - if(activityLogAlert != null) + if(activityLogAlertRule != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activityLogAlert, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activityLogAlertRule, 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"); } @@ -276,13 +307,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } /// - /// Get an activity log alert. + /// Get an Activity Log Alert rule. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// /// /// Headers that will be added to request. @@ -311,15 +342,47 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (activityLogAlertName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - string apiVersion = "2017-04-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -329,20 +392,19 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("activityLogAlertName", activityLogAlertName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName)); List _queryParameters = new List(); - 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) { @@ -465,13 +527,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } /// - /// Delete an activity log alert. + /// Delete an Activity Log Alert rule. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// /// /// Headers that will be added to request. @@ -497,15 +559,47 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (activityLogAlertName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - string apiVersion = "2017-04-01"; + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -515,20 +609,19 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("activityLogAlertName", activityLogAlertName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName)); List _queryParameters = new List(); - 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) { @@ -633,16 +726,17 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } /// - /// Updates an existing ActivityLogAlertResource's tags. To update other fields - /// use the CreateOrUpdate method. + /// Updates 'tags' and 'enabled' fields in an existing Alert rule. This method + /// is used to update the Alert rule tags, and to enable or disable the Alert + /// rule. To update other fields use CreateOrUpdate operation. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// + /// /// Parameters supplied to the operation. /// /// @@ -666,25 +760,57 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } if (activityLogAlertName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - if (activityLogAlertPatch == null) + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } + if (activityLogAlertRulePatch == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertPatch"); + throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertRulePatch"); } - string apiVersion = "2017-04-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -694,21 +820,20 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("activityLogAlertName", activityLogAlertName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("activityLogAlertPatch", activityLogAlertPatch); + tracingParameters.Add("activityLogAlertRulePatch", activityLogAlertRulePatch); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts/{activityLogAlertName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{activityLogAlertName}", System.Uri.EscapeDataString(activityLogAlertName)); List _queryParameters = new List(); - 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) { @@ -748,9 +873,9 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) // Serialize Request string _requestContent = null; - if(activityLogAlertPatch != null) + if(activityLogAlertRulePatch != null) { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activityLogAlertPatch, Client.SerializationSettings); + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(activityLogAlertRulePatch, 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"); } @@ -837,7 +962,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } /// - /// Get a list of all activity log alerts in a subscription. + /// Get a list of all Activity Log Alert rules in a subscription. /// /// /// Headers that will be added to request. @@ -860,13 +985,30 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } - string apiVersion = "2017-04-01"; + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -874,18 +1016,17 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionId", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/activityLogAlerts").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); List _queryParameters = new List(); - 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) { @@ -975,7 +1116,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -988,7 +1129,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -1008,10 +1149,10 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } /// - /// Get a list of all activity log alerts in a resource group. + /// Get a list of all Activity Log Alert rules in a resource group. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// Headers that will be added to request. @@ -1034,17 +1175,49 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); } + if (Client.SubscriptionId != null) + { + if (Client.SubscriptionId.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); + } + } if (resourceGroupName == null) { throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); } - string apiVersion = "2017-04-01"; + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.ApiVersion != null) + { + if (Client.ApiVersion.Length < 1) + { + throw new ValidationException(ValidationRules.MinLength, "Client.ApiVersion", 1); + } + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1053,20 +1226,355 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/activityLogAlerts").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); List _queryParameters = new List(); - if (apiVersion != null) + 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 ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get a list of all Activity Log Alert rules in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListBySubscriptionIdNextWithHttpMessagesAsync(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, "ListBySubscriptionIdNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); + _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; + } + + /// + /// Get a list of all Activity Log Alert rules in a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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); @@ -1155,7 +1663,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse>(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -1168,7 +1676,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperationsExtensions.cs index 80f03326243b7..689b9ab95c19d 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperationsExtensions.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogAlertsOperationsExtensions.cs @@ -13,8 +13,6 @@ namespace Microsoft.Azure.Management.Monitor using Microsoft.Rest; using Microsoft.Rest.Azure; using Models; - using System.Collections; - using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -24,62 +22,62 @@ namespace Microsoft.Azure.Management.Monitor public static partial class ActivityLogAlertsOperationsExtensions { /// - /// Create a new activity log alert or update an existing one. + /// Create a new Activity Log Alert rule or update an existing one. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// - /// The activity log alert to create or use for the update. + /// + /// The Activity Log Alert rule to create or use for the update. /// - public static ActivityLogAlertResource CreateOrUpdate(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert) + public static ActivityLogAlertResource CreateOrUpdate(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlertRule) { - return operations.CreateOrUpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlert).GetAwaiter().GetResult(); + return operations.CreateOrUpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlertRule).GetAwaiter().GetResult(); } /// - /// Create a new activity log alert or update an existing one. + /// Create a new Activity Log Alert rule or update an existing one. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// - /// The activity log alert to create or use for the update. + /// + /// The Activity Log Alert rule to create or use for the update. /// /// /// The cancellation token. /// - public static async Task CreateOrUpdateAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task CreateOrUpdateAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlertRule, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, activityLogAlert, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, activityLogAlertRule, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get an activity log alert. + /// Get an Activity Log Alert rule. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// public static ActivityLogAlertResource Get(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName) { @@ -87,16 +85,16 @@ public static ActivityLogAlertResource Get(this IActivityLogAlertsOperations ope } /// - /// Get an activity log alert. + /// Get an Activity Log Alert rule. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// /// /// The cancellation token. @@ -110,16 +108,16 @@ public static ActivityLogAlertResource Get(this IActivityLogAlertsOperations ope } /// - /// Delete an activity log alert. + /// Delete an Activity Log Alert rule. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// public static void Delete(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName) { @@ -127,16 +125,16 @@ public static void Delete(this IActivityLogAlertsOperations operations, string r } /// - /// Delete an activity log alert. + /// Delete an Activity Log Alert rule. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// /// /// The cancellation token. @@ -147,66 +145,68 @@ public static void Delete(this IActivityLogAlertsOperations operations, string r } /// - /// Updates an existing ActivityLogAlertResource's tags. To update other fields - /// use the CreateOrUpdate method. + /// Updates 'tags' and 'enabled' fields in an existing Alert rule. This method + /// is used to update the Alert rule tags, and to enable or disable the Alert + /// rule. To update other fields use CreateOrUpdate operation. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// + /// /// Parameters supplied to the operation. /// - public static ActivityLogAlertResource Update(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) + public static ActivityLogAlertResource Update(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch) { - return operations.UpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlertRulePatch).GetAwaiter().GetResult(); } /// - /// Updates an existing ActivityLogAlertResource's tags. To update other fields - /// use the CreateOrUpdate method. + /// Updates 'tags' and 'enabled' fields in an existing Alert rule. This method + /// is used to update the Alert rule tags, and to enable or disable the Alert + /// rule. To update other fields use CreateOrUpdate operation. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// + /// /// Parameters supplied to the operation. /// /// /// The cancellation token. /// - public static async Task UpdateAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, string activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, activityLogAlertName, activityLogAlertRulePatch, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Get a list of all activity log alerts in a subscription. + /// Get a list of all Activity Log Alert rules in a subscription. /// /// /// The operations group for this extension method. /// - public static IEnumerable ListBySubscriptionId(this IActivityLogAlertsOperations operations) + public static IPage ListBySubscriptionId(this IActivityLogAlertsOperations operations) { return operations.ListBySubscriptionIdAsync().GetAwaiter().GetResult(); } /// - /// Get a list of all activity log alerts in a subscription. + /// Get a list of all Activity Log Alert rules in a subscription. /// /// /// The operations group for this extension method. @@ -214,7 +214,7 @@ public static IEnumerable ListBySubscriptionId(this IA /// /// The cancellation token. /// - public static async Task> ListBySubscriptionIdAsync(this IActivityLogAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListBySubscriptionIdAsync(this IActivityLogAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListBySubscriptionIdWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { @@ -223,32 +223,32 @@ public static IEnumerable ListBySubscriptionId(this IA } /// - /// Get a list of all activity log alerts in a resource group. + /// Get a list of all Activity Log Alert rules in a resource group. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// - public static IEnumerable ListByResourceGroup(this IActivityLogAlertsOperations operations, string resourceGroupName) + public static IPage ListByResourceGroup(this IActivityLogAlertsOperations operations, string resourceGroupName) { return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } /// - /// Get a list of all activity log alerts in a resource group. + /// Get a list of all Activity Log Alert rules in a resource group. /// /// /// The operations group for this extension method. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The cancellation token. /// - public static async Task> ListByResourceGroupAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByResourceGroupAsync(this IActivityLogAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) { @@ -256,5 +256,73 @@ public static IEnumerable ListByResourceGroup(this IAc } } + /// + /// Get a list of all Activity Log Alert rules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListBySubscriptionIdNext(this IActivityLogAlertsOperations operations, string nextPageLink) + { + return operations.ListBySubscriptionIdNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all Activity Log Alert rules in a subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListBySubscriptionIdNextAsync(this IActivityLogAlertsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionIdNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get a list of all Activity Log Alert rules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListByResourceGroupNext(this IActivityLogAlertsOperations operations, string nextPageLink) + { + return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Get a list of all Activity Log Alert rules in a resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByResourceGroupNextAsync(this IActivityLogAlertsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperations.cs deleted file mode 100644 index 0bb485558e709..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperations.cs +++ /dev/null @@ -1,424 +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.Monitor -{ - 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; - - /// - /// ActivityLogsOperations operations. - /// - internal partial class ActivityLogsOperations : IServiceOperations, IActivityLogsOperations - { - /// - /// Initializes a new instance of the ActivityLogsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ActivityLogsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - /// - /// 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(ODataQuery odataQuery, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (odataQuery == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "odataQuery"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("select", select); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/eventtypes/management/values").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (select != null) - { - _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperationsExtensions.cs deleted file mode 100644 index ed039c9d08e23..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ActivityLogsOperationsExtensions.cs +++ /dev/null @@ -1,112 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for ActivityLogsOperations. - /// - public static partial class ActivityLogsOperationsExtensions - { - /// - /// Provides the list of records from the activity logs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - public static IPage List(this IActivityLogsOperations operations, ODataQuery odataQuery, string select = default(string)) - { - return operations.ListAsync(odataQuery, select).GetAwaiter().GetResult(); - } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IActivityLogsOperations operations, ODataQuery odataQuery, string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, select, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IActivityLogsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Provides the list of records from the activity logs. - /// - /// - /// 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 IActivityLogsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperations.cs deleted file mode 100644 index 4f17f6c37e44c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperations.cs +++ /dev/null @@ -1,446 +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.Monitor -{ - 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; - - /// - /// AlertRuleIncidentsOperations operations. - /// - internal partial class AlertRuleIncidentsOperations : IServiceOperations, IAlertRuleIncidentsOperations - { - /// - /// Initializes a new instance of the AlertRuleIncidentsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AlertRuleIncidentsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets an incident associated to an alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the incident to retrieve. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, string incidentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (incidentName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "incidentName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("incidentName", incidentName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{incidentName}", System.Uri.EscapeDataString(incidentName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of incidents associated to an alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// 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>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByAlertRule", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperationsExtensions.cs deleted file mode 100644 index e80fe08e5e804..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRuleIncidentsOperationsExtensions.cs +++ /dev/null @@ -1,113 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AlertRuleIncidentsOperations. - /// - public static partial class AlertRuleIncidentsOperationsExtensions - { - /// - /// Gets an incident associated to an alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the incident to retrieve. - /// - public static Incident Get(this IAlertRuleIncidentsOperations operations, string resourceGroupName, string ruleName, string incidentName) - { - return operations.GetAsync(resourceGroupName, ruleName, incidentName).GetAwaiter().GetResult(); - } - - /// - /// Gets an incident associated to an alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the incident to retrieve. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAlertRuleIncidentsOperations operations, string resourceGroupName, string ruleName, string incidentName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, incidentName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of incidents associated to an alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static IEnumerable ListByAlertRule(this IAlertRuleIncidentsOperations operations, string resourceGroupName, string ruleName) - { - return operations.ListByAlertRuleAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of incidents associated to an alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByAlertRuleAsync(this IAlertRuleIncidentsOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByAlertRuleWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperations.cs deleted file mode 100644 index 992f576643d7f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperations.cs +++ /dev/null @@ -1,1229 +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.Monitor -{ - 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; - - /// - /// AlertRulesOperations operations. - /// - internal partial class AlertRulesOperations : IServiceOperations, IAlertRulesOperations - { - /// - /// Initializes a new instance of the AlertRulesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AlertRulesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Creates or updates a classic metric alert rule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a classic metric alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a classic metric alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Updates an existing classic metric AlertRuleResource. To update other - /// fields use the CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (alertRulesResource == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "alertRulesResource"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("alertRulesResource", alertRulesResource); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(alertRulesResource != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(alertRulesResource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List the classic metric alert rules within a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/alertrules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperationsExtensions.cs deleted file mode 100644 index 1141a2deab66f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AlertRulesOperationsExtensions.cs +++ /dev/null @@ -1,260 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AlertRulesOperations. - /// - public static partial class AlertRulesOperationsExtensions - { - /// - /// Creates or updates a classic metric alert rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - public static AlertRuleResource CreateOrUpdate(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a classic metric alert rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResource parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static void Delete(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) - { - operations.DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static AlertRuleResource Get(this IAlertRulesOperations operations, string resourceGroupName, string ruleName) - { - return operations.GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Gets a classic metric alert rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates an existing classic metric AlertRuleResource. To update other - /// fields use the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Parameters supplied to the operation. - /// - public static AlertRuleResource Update(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource) - { - return operations.UpdateAsync(resourceGroupName, ruleName, alertRulesResource).GetAwaiter().GetResult(); - } - - /// - /// Updates an existing classic metric AlertRuleResource. To update other - /// fields use the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IAlertRulesOperations operations, string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, alertRulesResource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the classic metric alert rules within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - public static IEnumerable ListByResourceGroup(this IAlertRulesOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// List the classic metric alert rules within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IAlertRulesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable ListBySubscription(this IAlertRulesOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IAlertRulesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperations.cs deleted file mode 100644 index 2d2193992b4bd..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperations.cs +++ /dev/null @@ -1,1527 +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.Monitor -{ - 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; - - /// - /// AutoscaleSettingsOperations operations. - /// - internal partial class AutoscaleSettingsOperations : IServiceOperations, IAutoscaleSettingsOperations - { - /// - /// Initializes a new instance of the AutoscaleSettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal AutoscaleSettingsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates or updates an autoscale setting. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (autoscaleSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes and autoscale setting - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (autoscaleSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets an autoscale setting - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (autoscaleSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates an existing AutoscaleSettingsResource. To update other fields use - /// the CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (autoscaleSettingName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingName"); - } - if (autoscaleSettingResource == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "autoscaleSettingResource"); - } - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("autoscaleSettingName", autoscaleSettingName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("autoscaleSettingResource", autoscaleSettingResource); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/autoscalesettings/{autoscaleSettingName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{autoscaleSettingName}", System.Uri.EscapeDataString(autoscaleSettingName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(autoscaleSettingResource != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(autoscaleSettingResource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/autoscalesettings").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListBySubscriptionNextWithHttpMessagesAsync(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, "ListBySubscriptionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperationsExtensions.cs deleted file mode 100644 index c93ea91bbe530..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/AutoscaleSettingsOperationsExtensions.cs +++ /dev/null @@ -1,326 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for AutoscaleSettingsOperations. - /// - public static partial class AutoscaleSettingsOperationsExtensions - { - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - public static IPage ListByResourceGroup(this IAutoscaleSettingsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates an autoscale setting. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - public static AutoscaleSettingResource CreateOrUpdate(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, autoscaleSettingName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates an autoscale setting. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes and autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - public static void Delete(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) - { - operations.DeleteAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); - } - - /// - /// Deletes and autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets an autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - public static AutoscaleSettingResource Get(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName) - { - return operations.GetAsync(resourceGroupName, autoscaleSettingName).GetAwaiter().GetResult(); - } - - /// - /// Gets an autoscale setting - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates an existing AutoscaleSettingsResource. To update other fields use - /// the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - public static AutoscaleSettingResource Update(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) - { - return operations.UpdateAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).GetAwaiter().GetResult(); - } - - /// - /// Updates an existing AutoscaleSettingsResource. To update other fields use - /// the CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IAutoscaleSettingsOperations operations, string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The operations group for this extension method. - /// - public static IPage ListBySubscription(this IAutoscaleSettingsOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IAutoscaleSettingsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IAutoscaleSettingsOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IAutoscaleSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this IAutoscaleSettingsOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this IAutoscaleSettingsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperations.cs deleted file mode 100644 index 49715e977715f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperations.cs +++ /dev/null @@ -1,305 +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.Monitor -{ - 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; - - /// - /// BaselinesOperations operations. - /// - internal partial class BaselinesOperations : IServiceOperations, IBaselinesOperations - { - /// - /// Initializes a new instance of the BaselinesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal BaselinesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// The identifier of the resource. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// The **$filter** is used to reduce the set of metric data - /// returned.<br>Example:<br>Metric contains metadata A, B and - /// C.<br>- Return all time series of C where A = a1 and B = b1 or - /// b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq - /// ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq - /// ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the - /// logical or operator cannot separate two different metadata - /// names.<br>- Return all time series where A = a1, B = b1 and C = - /// c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- - /// Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq - /// ‘*’ and C eq ‘*’**. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - /// - /// 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(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - string apiVersion = "2019-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("metricnames", metricnames); - tracingParameters.Add("metricnamespace", metricnamespace); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("interval", interval); - tracingParameters.Add("aggregation", aggregation); - tracingParameters.Add("sensitivities", sensitivities); - tracingParameters.Add("filter", filter); - tracingParameters.Add("resultType", resultType); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metricBaselines").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (metricnames != null) - { - _queryParameters.Add(string.Format("metricnames={0}", System.Uri.EscapeDataString(metricnames))); - } - if (metricnamespace != null) - { - _queryParameters.Add(string.Format("metricnamespace={0}", System.Uri.EscapeDataString(metricnamespace))); - } - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (interval != null) - { - _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); - } - if (aggregation != null) - { - _queryParameters.Add(string.Format("aggregation={0}", System.Uri.EscapeDataString(aggregation))); - } - if (sensitivities != null) - { - _queryParameters.Add(string.Format("sensitivities={0}", System.Uri.EscapeDataString(sensitivities))); - } - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - if (resultType != null) - { - _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, Client.SerializationSettings).Trim('"')))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperationsExtensions.cs deleted file mode 100644 index dadeb22767847..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/BaselinesOperationsExtensions.cs +++ /dev/null @@ -1,133 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for BaselinesOperations. - /// - public static partial class BaselinesOperationsExtensions - { - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// The **$filter** is used to reduce the set of metric data - /// returned.<br>Example:<br>Metric contains metadata A, B and - /// C.<br>- Return all time series of C where A = a1 and B = b1 or - /// b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq - /// ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq - /// ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the - /// logical or operator cannot separate two different metadata - /// names.<br>- Return all time series where A = a1, B = b1 and C = - /// c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- - /// Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq - /// ‘*’ and C eq ‘*’**. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - public static IEnumerable List(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?)) - { - return operations.ListAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType).GetAwaiter().GetResult(); - } - - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// The **$filter** is used to reduce the set of metric data - /// returned.<br>Example:<br>Metric contains metadata A, B and - /// C.<br>- Return all time series of C where A = a1 and B = b1 or - /// b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq - /// ‘*’**<br>- Invalid variant:<br>**$filter=A eq ‘a1’ and B eq - /// ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is invalid because the - /// logical or operator cannot separate two different metadata - /// names.<br>- Return all time series where A = a1, B = b1 and C = - /// c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’**<br>- - /// Return all time series where A = a1<br>**$filter=A eq ‘a1’ and B eq - /// ‘*’ and C eq ‘*’**. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IBaselinesOperations operations, string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnames, metricnamespace, timespan, interval, aggregation, sensitivities, filter, resultType, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs deleted file mode 100644 index 4fae9f9b9192a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociations.cs +++ /dev/null @@ -1,1010 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - - using Models; - - using Newtonsoft.Json; - - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DataCollectionRuleAssociations operations. - /// - public partial class DataCollectionRuleAssociations : IServiceOperations, IDataCollectionRuleAssociations - { - /// - /// Initializes a new instance of the DataCollectionRuleAssociations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public DataCollectionRuleAssociations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Lists associations for the specified resource. - /// - /// - /// The identifier of the 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (resourceUri != null) - { - if (resourceUri.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResource", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (customHeaders != null) - { - foreach (var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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 associations for the specified data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// 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>> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (dataCollectionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); - } - if (dataCollectionRuleName != null) - { - if (dataCollectionRuleName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); - } - if (dataCollectionRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByRule", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (customHeaders != null) - { - foreach (var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Returns the specified association. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (resourceUri != null) - { - if (resourceUri.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); - } - } - if (associationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "associationName"); - } - if (associationName != null) - { - if (associationName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "associationName", 64); - } - if (associationName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "associationName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(associationName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "associationName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("associationName", associationName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{associationName}", System.Uri.EscapeDataString(associationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (customHeaders != null) - { - foreach (var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Creates or updates an association. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The payload - /// - /// - /// 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> CreateWithHttpMessagesAsync(string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (resourceUri != null) - { - if (resourceUri.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); - } - } - if (associationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "associationName"); - } - if (associationName != null) - { - if (associationName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "associationName", 64); - } - if (associationName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "associationName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(associationName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "associationName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (body != null) - { - body.Validate(); - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("associationName", associationName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{associationName}", System.Uri.EscapeDataString(associationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (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 (body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes an association. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (resourceUri != null) - { - if (resourceUri.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceUri", 1); - } - } - if (associationName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "associationName"); - } - if (associationName != null) - { - if (associationName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "associationName", 64); - } - if (associationName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "associationName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(associationName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "associationName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("associationName", associationName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{associationName}", System.Uri.EscapeDataString(associationName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (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 && (int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs deleted file mode 100644 index cb5e017e2e08e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRuleAssociationsExtensions.cs +++ /dev/null @@ -1,217 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Models; - - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DataCollectionRuleAssociations. - /// - public static partial class DataCollectionRuleAssociationsExtensions - { - /// - /// Lists associations for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - public static Page ListByResource(this IDataCollectionRuleAssociations operations, string resourceUri) - { - return operations.ListByResourceAsync(resourceUri).GetAwaiter().GetResult(); - } - - /// - /// Lists associations for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceAsync(this IDataCollectionRuleAssociations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists associations for the specified data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - public static Page ListByRule(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName) - { - return operations.ListByRuleAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); - } - - /// - /// Lists associations for the specified data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByRuleAsync(this IDataCollectionRuleAssociations operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByRuleWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns the specified association. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - public static DataCollectionRuleAssociationProxyOnlyResource Get(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName) - { - return operations.GetAsync(resourceUri, associationName).GetAwaiter().GetResult(); - } - - /// - /// Returns the specified association. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, associationName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates an association. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The payload - /// - public static DataCollectionRuleAssociationProxyOnlyResource Create(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource)) - { - return operations.CreateAsync(resourceUri, associationName, body).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates an association. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The payload - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(resourceUri, associationName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes an association. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - public static void Delete(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName) - { - operations.DeleteAsync(resourceUri, associationName).GetAwaiter().GetResult(); - } - - /// - /// Deletes an association. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDataCollectionRuleAssociations operations, string resourceUri, string associationName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceUri, associationName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs deleted file mode 100644 index 8b5de5f0a032a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRules.cs +++ /dev/null @@ -1,1262 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - - using Models; - - using Newtonsoft.Json; - - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DataCollectionRules operations. - /// - public partial class DataCollectionRules : IServiceOperations, IDataCollectionRules - { - /// - /// Initializes a new instance of the DataCollectionRules class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public DataCollectionRules(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Lists all data collection rules in the specified resource group. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (customHeaders != null) - { - foreach (var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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 data collection rules in the specified subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (customHeaders != null) - { - foreach (var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Returns the specified data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (dataCollectionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); - } - if (dataCollectionRuleName != null) - { - if (dataCollectionRuleName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); - } - if (dataCollectionRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (customHeaders != null) - { - foreach (var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Creates or updates a data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (dataCollectionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); - } - if (dataCollectionRuleName != null) - { - if (dataCollectionRuleName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); - } - if (dataCollectionRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (body != null) - { - body.Validate(); - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (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 (body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates part of a data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (dataCollectionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); - } - if (dataCollectionRuleName != null) - { - if (dataCollectionRuleName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); - } - if (dataCollectionRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("body", body); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - 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 (body != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (Client.SubscriptionId != null) - { - if (Client.SubscriptionId.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); - } - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (resourceGroupName != null) - { - if (resourceGroupName.Length > 90) - { - throw new ValidationException(ValidationRules.MaxLength, "resourceGroupName", 90); - } - if (resourceGroupName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); - } - } - if (dataCollectionRuleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataCollectionRuleName"); - } - if (dataCollectionRuleName != null) - { - if (dataCollectionRuleName.Length > 64) - { - throw new ValidationException(ValidationRules.MaxLength, "dataCollectionRuleName", 64); - } - if (dataCollectionRuleName.Length < 1) - { - throw new ValidationException(ValidationRules.MinLength, "dataCollectionRuleName", 1); - } - if (!System.Text.RegularExpressions.Regex.IsMatch(dataCollectionRuleName, "^[-\\w\\._\\(\\)]+$")) - { - throw new ValidationException(ValidationRules.Pattern, "dataCollectionRuleName", "^[-\\w\\._\\(\\)]+$"); - } - } - string apiVersion = "2019-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("dataCollectionRuleName", dataCollectionRuleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{dataCollectionRuleName}", System.Uri.EscapeDataString(dataCollectionRuleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - - - if (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 && (int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs deleted file mode 100644 index 1c443c8cbf1aa..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DataCollectionRulesExtensions.cs +++ /dev/null @@ -1,251 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Models; - - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DataCollectionRules. - /// - public static partial class DataCollectionRulesExtensions - { - /// - /// Lists all data collection rules in the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - public static Page ListByResourceGroup(this IDataCollectionRules operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Lists all data collection rules in the specified resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IDataCollectionRules operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists all data collection rules in the specified subscription. - /// - /// - /// The operations group for this extension method. - /// - public static Page ListBySubscription(this IDataCollectionRules operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Lists all data collection rules in the specified subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IDataCollectionRules operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns the specified data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - public static DataCollectionRuleResource Get(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) - { - return operations.GetAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); - } - - /// - /// Returns the specified data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - public static DataCollectionRuleResource Create(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource)) - { - return operations.CreateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// The cancellation token. - /// - public static async Task CreateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates part of a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - public static DataCollectionRuleResource Update(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate)) - { - return operations.UpdateAsync(resourceGroupName, dataCollectionRuleName, body).GetAwaiter().GetResult(); - } - - /// - /// Updates part of a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, body, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - public static void Delete(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName) - { - operations.DeleteAsync(resourceGroupName, dataCollectionRuleName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a data collection rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDataCollectionRules operations, string resourceGroupName, string dataCollectionRuleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dataCollectionRuleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsCategoryOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsCategoryOperations.cs deleted file mode 100644 index 7869144306cc0..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsCategoryOperations.cs +++ /dev/null @@ -1,413 +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.Monitor -{ - 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; - - /// - /// DiagnosticSettingsCategoryOperations operations. - /// - internal partial class DiagnosticSettingsCategoryOperations : IServiceOperations, IDiagnosticSettingsCategoryOperations - { - /// - /// Initializes a new instance of the DiagnosticSettingsCategoryOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal DiagnosticSettingsCategoryOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets the diagnostic settings category for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2017-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories/{name}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Lists the diagnostic settings categories for the specified resource. - /// - /// - /// The identifier of the 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - string apiVersion = "2017-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/diagnosticSettingsCategories").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsCategoryOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsCategoryOperationsExtensions.cs deleted file mode 100644 index ebfa0fc72b936..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsCategoryOperationsExtensions.cs +++ /dev/null @@ -1,99 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DiagnosticSettingsCategoryOperations. - /// - public static partial class DiagnosticSettingsCategoryOperationsExtensions - { - /// - /// Gets the diagnostic settings category for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - public static DiagnosticSettingsCategoryResource Get(this IDiagnosticSettingsCategoryOperations operations, string resourceUri, string name) - { - return operations.GetAsync(resourceUri, name).GetAwaiter().GetResult(); - } - - /// - /// Gets the diagnostic settings category for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDiagnosticSettingsCategoryOperations operations, string resourceUri, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Lists the diagnostic settings categories for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - public static DiagnosticSettingsCategoryResourceCollection List(this IDiagnosticSettingsCategoryOperations operations, string resourceUri) - { - return operations.ListAsync(resourceUri).GetAwaiter().GetResult(); - } - - /// - /// Lists the diagnostic settings categories for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IDiagnosticSettingsCategoryOperations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsOperations.cs deleted file mode 100644 index edfc46a301d81..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsOperations.cs +++ /dev/null @@ -1,774 +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.Monitor -{ - 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; - - /// - /// DiagnosticSettingsOperations operations. - /// - internal partial class DiagnosticSettingsOperations : IServiceOperations, IDiagnosticSettingsOperations - { - /// - /// Initializes a new instance of the DiagnosticSettingsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal DiagnosticSettingsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets the active diagnostic settings for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2017-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Creates or updates diagnostic settings for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceUri, DiagnosticSettingsResource parameters, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2017-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes existing diagnostic settings for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2017-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/diagnosticSettings/{name}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the active diagnostic settings list for the specified resource. - /// - /// - /// The identifier of the 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - string apiVersion = "2017-05-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/diagnosticSettings").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsOperationsExtensions.cs deleted file mode 100644 index b04fabda1b166..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/DiagnosticSettingsOperationsExtensions.cs +++ /dev/null @@ -1,182 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DiagnosticSettingsOperations. - /// - public static partial class DiagnosticSettingsOperationsExtensions - { - /// - /// Gets the active diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - public static DiagnosticSettingsResource Get(this IDiagnosticSettingsOperations operations, string resourceUri, string name) - { - return operations.GetAsync(resourceUri, name).GetAwaiter().GetResult(); - } - - /// - /// Gets the active diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates or updates diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The name of the diagnostic setting. - /// - public static DiagnosticSettingsResource CreateOrUpdate(this IDiagnosticSettingsOperations operations, string resourceUri, DiagnosticSettingsResource parameters, string name) - { - return operations.CreateOrUpdateAsync(resourceUri, parameters, name).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IDiagnosticSettingsOperations operations, string resourceUri, DiagnosticSettingsResource parameters, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceUri, parameters, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes existing diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - public static void Delete(this IDiagnosticSettingsOperations operations, string resourceUri, string name) - { - operations.DeleteAsync(resourceUri, name).GetAwaiter().GetResult(); - } - - /// - /// Deletes existing diagnostic settings for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IDiagnosticSettingsOperations operations, string resourceUri, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceUri, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets the active diagnostic settings list for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - public static DiagnosticSettingsResourceCollection List(this IDiagnosticSettingsOperations operations, string resourceUri) - { - return operations.ListAsync(resourceUri).GetAwaiter().GetResult(); - } - - /// - /// Gets the active diagnostic settings list for the specified resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IDiagnosticSettingsOperations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/EventCategoriesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/EventCategoriesOperations.cs deleted file mode 100644 index d4fa28f572263..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/EventCategoriesOperations.cs +++ /dev/null @@ -1,216 +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.Monitor -{ - 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; - - /// - /// EventCategoriesOperations operations. - /// - internal partial class EventCategoriesOperations : IServiceOperations, IEventCategoriesOperations - { - /// - /// Initializes a new instance of the EventCategoriesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal EventCategoriesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Get the list of available event categories supported in the Activity Logs - /// Service.<br>The current list includes the following: Administrative, - /// Security, ServiceHealth, Alert, Recommendation, Policy. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/microsoft.insights/eventcategories").ToString(); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/EventCategoriesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/EventCategoriesOperationsExtensions.cs deleted file mode 100644 index f4bd0714fd98a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/EventCategoriesOperationsExtensions.cs +++ /dev/null @@ -1,59 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for EventCategoriesOperations. - /// - public static partial class EventCategoriesOperationsExtensions - { - /// - /// Get the list of available event categories supported in the Activity Logs - /// Service.<br>The current list includes the following: Administrative, - /// Security, ServiceHealth, Alert, Recommendation, Policy. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable List(this IEventCategoriesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Get the list of available event categories supported in the Activity Logs - /// Service.<br>The current list includes the following: Administrative, - /// Security, ServiceHealth, Alert, Recommendation, Policy. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IEventCategoriesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActionGroupsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActionGroupsOperations.cs deleted file mode 100644 index 9e85c5659aa7c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActionGroupsOperations.cs +++ /dev/null @@ -1,199 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// ActionGroupsOperations operations. - /// - public partial interface IActionGroupsOperations - { - /// - /// Create a new action group or update an existing one. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The action group to create or use for the update. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, ActionGroupResource actionGroup, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get an action group. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete an action group. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates an existing action group's tags. To update other fields use - /// the CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, ActionGroupPatchBody actionGroupPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get a list of all action groups in a subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Get a list of all action groups in a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Enable a receiver in an action group. This changes the receiver's - /// status from Disabled to Enabled. This operation is only supported - /// for Email or SMS receivers. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the action group. - /// - /// - /// The name of the receiver to resubscribe. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task EnableReceiverWithHttpMessagesAsync(string resourceGroupName, string actionGroupName, string receiverName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogAlertsOperations.cs index 5244dcac59f8e..333917453e7cb 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogAlertsOperations.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogAlertsOperations.cs @@ -24,16 +24,16 @@ namespace Microsoft.Azure.Management.Monitor public partial interface IActivityLogAlertsOperations { /// - /// Create a new activity log alert or update an existing one. + /// Create a new Activity Log Alert rule or update an existing one. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// - /// The activity log alert to create or use for the update. + /// + /// The Activity Log Alert rule to create or use for the update. /// /// /// The headers that will be added to request. @@ -50,15 +50,15 @@ public partial interface IActivityLogAlertsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlert, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertResource activityLogAlertRule, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get an activity log alert. + /// Get an Activity Log Alert rule. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// /// /// The headers that will be added to request. @@ -77,13 +77,13 @@ public partial interface IActivityLogAlertsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Delete an activity log alert. + /// Delete an Activity Log Alert rule. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// /// /// The headers that will be added to request. @@ -99,16 +99,18 @@ public partial interface IActivityLogAlertsOperations /// Task DeleteWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Updates an existing ActivityLogAlertResource's tags. To update - /// other fields use the CreateOrUpdate method. + /// Updates 'tags' and 'enabled' fields in an existing Alert rule. This + /// method is used to update the Alert rule tags, and to enable or + /// disable the Alert rule. To update other fields use CreateOrUpdate + /// operation. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// + /// /// Parameters supplied to the operation. /// /// @@ -126,9 +128,9 @@ public partial interface IActivityLogAlertsOperations /// /// Thrown when a required parameter is null /// - Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get a list of all activity log alerts in a subscription. + /// Get a list of all Activity Log Alert rules in a subscription. /// /// /// The headers that will be added to request. @@ -145,12 +147,12 @@ public partial interface IActivityLogAlertsOperations /// /// Thrown when a required parameter is null /// - Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListBySubscriptionIdWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Get a list of all activity log alerts in a resource group. + /// Get a list of all Activity Log Alert rules in a resource group. /// /// - /// The name of the resource group. + /// The name of the resource group. The name is case insensitive. /// /// /// The headers that will be added to request. @@ -167,6 +169,50 @@ public partial interface IActivityLogAlertsOperations /// /// Thrown when a required parameter is null /// - Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of all Activity Log Alert rules in a subscription. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListBySubscriptionIdNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get a list of all Activity Log Alert rules in a resource group. + /// + /// + /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogsOperations.cs deleted file mode 100644 index 79a99a34891ec..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogsOperations.cs +++ /dev/null @@ -1,82 +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.Monitor -{ - 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; - - /// - /// ActivityLogsOperations operations. - /// - public partial interface IActivityLogsOperations - { - /// - /// Provides the list of records from the activity logs. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to - /// be returned. Possible values are: *authorization*, *claims*, - /// *correlationId*, *description*, *eventDataId*, *eventName*, - /// *eventTimestamp*, *httpRequest*, *level*, *operationId*, - /// *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, - /// *submissionTimestamp*, *subStatus*, *subscriptionId* - /// - /// - /// 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(ODataQuery odataQuery, string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Provides the list of records from the activity logs. - /// - /// - /// 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRuleIncidentsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRuleIncidentsOperations.cs deleted file mode 100644 index 8a77a721de282..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRuleIncidentsOperations.cs +++ /dev/null @@ -1,80 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AlertRuleIncidentsOperations operations. - /// - public partial interface IAlertRuleIncidentsOperations - { - /// - /// Gets an incident associated to an alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the incident to retrieve. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, string incidentName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of incidents associated to an alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// 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>> ListByAlertRuleWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRulesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRulesOperations.cs deleted file mode 100644 index 9a365ee836ed7..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAlertRulesOperations.cs +++ /dev/null @@ -1,172 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AlertRulesOperations operations. - /// - public partial interface IAlertRulesOperations - { - /// - /// Creates or updates a classic metric alert rule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a classic metric alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a classic metric alert rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates an existing classic metric AlertRuleResource. To update - /// other fields use the CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, AlertRuleResourcePatch alertRulesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the classic metric alert rules within a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the classic metric alert rules within a subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAutoscaleSettingsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAutoscaleSettingsOperations.cs deleted file mode 100644 index f19a2533a7880..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IAutoscaleSettingsOperations.cs +++ /dev/null @@ -1,216 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// AutoscaleSettingsOperations operations. - /// - public partial interface IAutoscaleSettingsOperations - { - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates an autoscale setting. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the 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> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes and autoscale setting - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets an autoscale setting - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting 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 - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates an existing AutoscaleSettingsResource. To update other - /// fields use the CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The autoscale setting name. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists the autoscale settings for a resource group - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists the autoscale settings for a subscription - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IBaselinesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IBaselinesOperations.cs deleted file mode 100644 index 065deca8f8eeb..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IBaselinesOperations.cs +++ /dev/null @@ -1,86 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// BaselinesOperations operations. - /// - public partial interface IBaselinesOperations - { - /// - /// **Lists the metric baseline values for a resource**. - /// - /// - /// The identifier of the resource. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// The **$filter** is used to reduce the set of metric data - /// returned.<br>Example:<br>Metric contains metadata A, B - /// and C.<br>- Return all time series of C where A = a1 and B = - /// b1 or b2<br>**$filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ - /// and C eq ‘*’**<br>- Invalid variant:<br>**$filter=A eq - /// ‘a1’ and B eq ‘b1’ and C eq ‘*’ or B = ‘b2’**<br>This is - /// invalid because the logical or operator cannot separate two - /// different metadata names.<br>- Return all time series where A - /// = a1, B = b1 and C = c1:<br>**$filter=A eq ‘a1’ and B eq ‘b1’ - /// and C eq ‘c1’**<br>- Return all time series where A = - /// a1<br>**$filter=A eq ‘a1’ and B eq ‘*’ and C eq ‘*’**. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request - /// all information is retrieved. Possible values include: 'Data', - /// 'Metadata' - /// - /// - /// 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(string resourceUri, string metricnames = default(string), string metricnamespace = default(string), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), string filter = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs deleted file mode 100644 index cdceddf6a90a9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRuleAssociations.cs +++ /dev/null @@ -1,146 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - - using Models; - - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DataCollectionRuleAssociations operations. - /// - public partial interface IDataCollectionRuleAssociations - { - /// - /// Lists associations for the specified resource. - /// - /// - /// The identifier of the 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 - /// - Task>> ListByResourceWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists associations for the specified data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// 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>> ListByRuleWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the specified association. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates an association. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The payload - /// - /// - /// 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> CreateWithHttpMessagesAsync(string resourceUri, string associationName, DataCollectionRuleAssociationProxyOnlyResource body = default(DataCollectionRuleAssociationProxyOnlyResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes an association. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the association. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceUri, string associationName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs deleted file mode 100644 index 1002215a1d476..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDataCollectionRules.cs +++ /dev/null @@ -1,168 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor -{ - using Microsoft.Rest; - - using Models; - - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DataCollectionRules operations. - /// - public partial interface IDataCollectionRules - { - /// - /// Lists all data collection rules in the specified resource group. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists all data collection rules in the specified subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the specified data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates a data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, DataCollectionRuleResource body = default(DataCollectionRuleResource), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates part of a data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The payload - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, ResourceForUpdate body = default(ResourceForUpdate), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a data collection rule. - /// - /// - /// The name of the resource group. The name is case insensitive. - /// - /// - /// The name of the data collection rule. The name is case insensitive. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dataCollectionRuleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDiagnosticSettingsCategoryOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDiagnosticSettingsCategoryOperations.cs deleted file mode 100644 index 98f66214414d2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDiagnosticSettingsCategoryOperations.cs +++ /dev/null @@ -1,75 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DiagnosticSettingsCategoryOperations operations. - /// - public partial interface IDiagnosticSettingsCategoryOperations - { - /// - /// Gets the diagnostic settings category for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Lists the diagnostic settings categories for the specified - /// resource. - /// - /// - /// The identifier of the 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 - /// - Task> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDiagnosticSettingsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDiagnosticSettingsOperations.cs deleted file mode 100644 index ed683fb71e30c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IDiagnosticSettingsOperations.cs +++ /dev/null @@ -1,125 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DiagnosticSettingsOperations operations. - /// - public partial interface IDiagnosticSettingsOperations - { - /// - /// Gets the active diagnostic settings for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates or updates diagnostic settings for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceUri, DiagnosticSettingsResource parameters, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes existing diagnostic settings for the specified resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The name of the diagnostic setting. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceUri, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the active diagnostic settings list for the specified - /// resource. - /// - /// - /// The identifier of the 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 - /// - Task> ListWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IEventCategoriesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IEventCategoriesOperations.cs deleted file mode 100644 index 80737e5455efc..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IEventCategoriesOperations.cs +++ /dev/null @@ -1,49 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// EventCategoriesOperations operations. - /// - public partial interface IEventCategoriesOperations - { - /// - /// Get the list of available event categories supported in the - /// Activity Logs Service.<br>The current list includes the - /// following: Administrative, Security, ServiceHealth, Alert, - /// Recommendation, Policy. - /// - /// - /// 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)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ILogProfilesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ILogProfilesOperations.cs deleted file mode 100644 index f9d0fa23a80d6..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ILogProfilesOperations.cs +++ /dev/null @@ -1,138 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// LogProfilesOperations operations. - /// - public partial interface ILogProfilesOperations - { - /// - /// Deletes the log profile. - /// - /// - /// The name of the log profile. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the log profile. - /// - /// - /// The name of the log profile. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or update a log profile in Azure Monitoring REST API. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the 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> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates an existing LogProfilesResource. To update other fields use - /// the CreateOrUpdate method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the log profiles. - /// - /// - /// 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)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsOperations.cs deleted file mode 100644 index ec52f97ca1dc8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsOperations.cs +++ /dev/null @@ -1,171 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// MetricAlertsOperations operations. - /// - public partial interface IMetricAlertsOperations - { - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve alert rule definitions in a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve an alert rule definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Create or update an metric alert definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update an metric alert definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Delete an alert rule definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsStatusOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsStatusOperations.cs deleted file mode 100644 index 292c2a96a8d3f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricAlertsStatusOperations.cs +++ /dev/null @@ -1,80 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// MetricAlertsStatusOperations operations. - /// - public partial interface IMetricAlertsStatusOperations - { - /// - /// Retrieve an alert rule status. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// 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(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve an alert rule status. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the status. - /// - /// - /// 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> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricBaselineOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricBaselineOperations.cs deleted file mode 100644 index fa417ecdba123..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricBaselineOperations.cs +++ /dev/null @@ -1,102 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// MetricBaselineOperations operations. - /// - public partial interface IMetricBaselineOperations - { - /// - /// **Gets the baseline values for a specific metric**. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// The name of the metric to retrieve the baseline for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The aggregation type of the metric to retrieve the baseline for. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request - /// all information is retrieved. Possible values include: 'Data', - /// 'Metadata' - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceUri, string metricName, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// **Lists the baseline values for a resource**. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// Information that need to be specified to calculate a baseline on a - /// time series. - /// - /// - /// 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> CalculateBaselineWithHttpMessagesAsync(string resourceUri, TimeSeriesInformation timeSeriesInformation, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricDefinitionsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricDefinitionsOperations.cs deleted file mode 100644 index 13beb545e854d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricDefinitionsOperations.cs +++ /dev/null @@ -1,52 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// MetricDefinitionsOperations operations. - /// - public partial interface IMetricDefinitionsOperations - { - /// - /// Lists the metric definitions for the resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// 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(string resourceUri, string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricNamespacesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricNamespacesOperations.cs deleted file mode 100644 index 79fbc89452627..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricNamespacesOperations.cs +++ /dev/null @@ -1,53 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// MetricNamespacesOperations operations. - /// - public partial interface IMetricNamespacesOperations - { - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric - /// namespaces. - /// - /// - /// 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(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricsOperations.cs deleted file mode 100644 index 1058e9de10188..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMetricsOperations.cs +++ /dev/null @@ -1,85 +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.Monitor -{ - 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; - - /// - /// MetricsOperations operations. - /// - public partial interface IMetricsOperations - { - /// - /// **Lists the metric values for a resource**. - /// - /// - /// The identifier of the resource. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The maximum number of records to retrieve. - /// Valid only if $filter is specified. - /// Defaults to 10. - /// - /// - /// The aggregation to use for sorting results and the direction of the - /// sort. - /// Only one order can be specified. - /// Examples: sum asc. - /// - /// - /// Reduces the set of data collected. The syntax allowed depends on - /// the operation. See the operation's description for details. - /// Possible values include: 'Data', 'Metadata' - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// 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(string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs index dc566c7a40578..6d99712b8841b 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IMonitorManagementClient.cs @@ -41,7 +41,12 @@ public partial interface IMonitorManagementClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// The Azure subscription Id. + /// The API version to use for this operation. + /// + string ApiVersion { get; } + + /// + /// The ID of the target subscription. /// string SubscriptionId { get; set; } @@ -64,144 +69,10 @@ public partial interface IMonitorManagementClient : System.IDisposable bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IAutoscaleSettingsOperations. - /// - IAutoscaleSettingsOperations AutoscaleSettings { get; } - - /// - /// Gets the IOperations. - /// - IOperations Operations { get; } - - /// - /// Gets the IAlertRuleIncidentsOperations. - /// - IAlertRuleIncidentsOperations AlertRuleIncidents { get; } - - /// - /// Gets the IAlertRulesOperations. - /// - IAlertRulesOperations AlertRules { get; } - - /// - /// Gets the ILogProfilesOperations. - /// - ILogProfilesOperations LogProfiles { get; } - - /// - /// Gets the IDiagnosticSettingsOperations. - /// - IDiagnosticSettingsOperations DiagnosticSettings { get; } - - /// - /// Gets the IDiagnosticSettingsCategoryOperations. - /// - IDiagnosticSettingsCategoryOperations DiagnosticSettingsCategory { get; } - - /// - /// Gets the IActionGroupsOperations. - /// - IActionGroupsOperations ActionGroups { get; } - /// /// Gets the IActivityLogAlertsOperations. /// IActivityLogAlertsOperations ActivityLogAlerts { get; } - /// - /// Gets the IActivityLogsOperations. - /// - IActivityLogsOperations ActivityLogs { get; } - - /// - /// Gets the IEventCategoriesOperations. - /// - IEventCategoriesOperations EventCategories { get; } - - /// - /// Gets the ITenantActivityLogsOperations. - /// - ITenantActivityLogsOperations TenantActivityLogs { get; } - - /// - /// Gets the IMetricDefinitionsOperations. - /// - IMetricDefinitionsOperations MetricDefinitions { get; } - - /// - /// Gets the IMetricsOperations. - /// - IMetricsOperations Metrics { get; } - - /// - /// Gets the IMetricBaselineOperations. - /// - IMetricBaselineOperations MetricBaseline { get; } - - /// - /// Gets the IBaselinesOperations. - /// - IBaselinesOperations Baselines { get; } - - /// - /// Gets the IMetricAlertsOperations. - /// - IMetricAlertsOperations MetricAlerts { get; } - - /// - /// Gets the IMetricAlertsStatusOperations. - /// - IMetricAlertsStatusOperations MetricAlertsStatus { get; } - - /// - /// Gets the IScheduledQueryRulesOperations. - /// - IScheduledQueryRulesOperations ScheduledQueryRules { get; } - - /// - /// Gets the IMetricNamespacesOperations. - /// - IMetricNamespacesOperations MetricNamespaces { get; } - - /// - /// Gets the IVMInsightsOperations. - /// - IVMInsightsOperations VMInsights { get; } - - /// - /// Gets the IPrivateLinkScopesOperations. - /// - IPrivateLinkScopesOperations PrivateLinkScopes { get; } - - /// - /// Gets the IPrivateLinkScopeOperationStatusOperations. - /// - IPrivateLinkScopeOperationStatusOperations PrivateLinkScopeOperationStatus { get; } - - /// - /// Gets the IPrivateLinkResourcesOperations. - /// - IPrivateLinkResourcesOperations PrivateLinkResources { get; } - - /// - /// Gets the IPrivateEndpointConnectionsOperations. - /// - IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } - - /// - /// Gets the IPrivateLinkScopedResourcesOperations. - /// - IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; } - - /// - /// Gets the IDataCollectionRules. - /// - IDataCollectionRules DataCollectionRules { get; } - - /// - /// Gets the IDataCollectionRuleAssociations. - /// - IDataCollectionRuleAssociations DataCollectionRuleAssociations { get; } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IOperations.cs deleted file mode 100644 index 8ee5a5628e81e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IOperations.cs +++ /dev/null @@ -1,47 +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.Monitor -{ - 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 operations from Microsoft.Insights - /// provider. - /// - /// - /// 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)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateEndpointConnectionsOperations.cs deleted file mode 100644 index a7ba557f35670..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateEndpointConnectionsOperations.cs +++ /dev/null @@ -1,212 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateEndpointConnectionsOperations operations. - /// - public partial interface IPrivateEndpointConnectionsOperations - { - /// - /// Gets a private endpoint connection. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// 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>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkResourcesOperations.cs deleted file mode 100644 index 0f99e2a8db8cb..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkResourcesOperations.cs +++ /dev/null @@ -1,105 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkResourcesOperations operations. - /// - public partial interface IPrivateLinkResourcesOperations - { - /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link 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 - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the private link resources that need to be created for a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// 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>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopeOperationStatusOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopeOperationStatusOperations.cs deleted file mode 100644 index 45e67dbd6f896..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopeOperationStatusOperations.cs +++ /dev/null @@ -1,53 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopeOperationStatusOperations operations. - /// - public partial interface IPrivateLinkScopeOperationStatusOperations - { - /// - /// Get the status of an azure asynchronous operation associated with a - /// private link scope operation. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string asyncOperationId, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopedResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopedResourcesOperations.cs deleted file mode 100644 index 5e9aae6b02e5e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopedResourcesOperations.cs +++ /dev/null @@ -1,214 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopedResourcesOperations operations. - /// - public partial interface IPrivateLinkScopedResourcesOperations - { - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor 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 - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor 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 - /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// 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>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopesOperations.cs deleted file mode 100644 index 764f73ca2ff60..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IPrivateLinkScopesOperations.cs +++ /dev/null @@ -1,245 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// PrivateLinkScopesOperations operations. - /// - public partial interface IPrivateLinkScopesOperations - { - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a - /// subscription. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource - /// group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You - /// cannot specify a different value for InstrumentationKey nor AppId - /// in the Put operation. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure - /// Monitor PrivateLinkScope. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields - /// use the CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - /// - /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a - /// subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource - /// group. - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IScheduledQueryRulesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IScheduledQueryRulesOperations.cs deleted file mode 100644 index ba4456ae5c1e9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IScheduledQueryRulesOperations.cs +++ /dev/null @@ -1,178 +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.Monitor -{ - 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; - - /// - /// ScheduledQueryRulesOperations operations. - /// - public partial interface IScheduledQueryRulesOperations - { - /// - /// Creates or updates an log search rule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, LogSearchRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets an Log Search rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Update log search Rule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, LogSearchRuleResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes a Log Search rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the Log Search rules within a subscription group. - /// - /// - /// OData parameters to apply to the 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>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// List the Log Search rules within a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ITenantActivityLogsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ITenantActivityLogsOperations.cs deleted file mode 100644 index 429a7c1539dcd..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ITenantActivityLogsOperations.cs +++ /dev/null @@ -1,94 +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.Monitor -{ - 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; - - /// - /// TenantActivityLogsOperations operations. - /// - public partial interface ITenantActivityLogsOperations - { - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription - /// is applicable to this API (the parameters, $filter, - /// etc.).<br>One thing to point out here is that this API does - /// *not* retrieve the logs at the individual subscription of the - /// tenant but only surfaces the logs that were generated at the tenant - /// level. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to - /// be returned. Possible values are: *authorization*, *claims*, - /// *correlationId*, *description*, *eventDataId*, *eventName*, - /// *eventTimestamp*, *httpRequest*, *level*, *operationId*, - /// *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, - /// *submissionTimestamp*, *subStatus*, *subscriptionId* - /// - /// - /// 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(ODataQuery odataQuery = default(ODataQuery), string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription - /// is applicable to this API (the parameters, $filter, - /// etc.).<br>One thing to point out here is that this API does - /// *not* retrieve the logs at the individual subscription of the - /// tenant but only surfaces the logs that were generated at the tenant - /// level. - /// - /// - /// 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IVMInsightsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IVMInsightsOperations.cs deleted file mode 100644 index bfae7b017527b..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IVMInsightsOperations.cs +++ /dev/null @@ -1,51 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// VMInsightsOperations operations. - /// - public partial interface IVMInsightsOperations - { - /// - /// Retrieves the VM Insights onboarding status for the specified - /// resource or resource scope. - /// - /// - /// The fully qualified Azure Resource manager identifier of the - /// resource, or scope, whose status to retrieve. - /// - /// - /// 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> GetOnboardingStatusWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperations.cs deleted file mode 100644 index 22c26c0894b2c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperations.cs +++ /dev/null @@ -1,972 +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.Monitor -{ - 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; - - /// - /// LogProfilesOperations operations. - /// - internal partial class LogProfilesOperations : IServiceOperations, ILogProfilesOperations - { - /// - /// Initializes a new instance of the LogProfilesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal LogProfilesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Deletes the log profile. - /// - /// - /// The name of the log profile. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (logProfileName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("logProfileName", logProfileName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}").ToString(); - _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 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(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the log profile. - /// - /// - /// The name of the log profile. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string logProfileName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (logProfileName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("logProfileName", logProfileName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}").ToString(); - _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create or update a log profile in Azure Monitoring REST API. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the 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> CreateOrUpdateWithHttpMessagesAsync(string logProfileName, LogProfileResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (logProfileName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("logProfileName", logProfileName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}").ToString(); - _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 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; - } - - /// - /// Updates an existing LogProfilesResource. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the 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> UpdateWithHttpMessagesAsync(string logProfileName, LogProfileResourcePatch logProfilesResource, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (logProfileName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfileName"); - } - if (logProfilesResource == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "logProfilesResource"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("logProfileName", logProfileName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("logProfilesResource", logProfilesResource); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles/{logProfileName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{logProfileName}", System.Uri.EscapeDataString(logProfileName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(logProfilesResource != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(logProfilesResource, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List the log profiles. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2016-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/logprofiles").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperationsExtensions.cs deleted file mode 100644 index 90792ce0a5f16..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/LogProfilesOperationsExtensions.cs +++ /dev/null @@ -1,202 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for LogProfilesOperations. - /// - public static partial class LogProfilesOperationsExtensions - { - /// - /// Deletes the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - public static void Delete(this ILogProfilesOperations operations, string logProfileName) - { - operations.DeleteAsync(logProfileName).GetAwaiter().GetResult(); - } - - /// - /// Deletes the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this ILogProfilesOperations operations, string logProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - public static LogProfileResource Get(this ILogProfilesOperations operations, string logProfileName) - { - return operations.GetAsync(logProfileName).GetAwaiter().GetResult(); - } - - /// - /// Gets the log profile. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this ILogProfilesOperations operations, string logProfileName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(logProfileName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or update a log profile in Azure Monitoring REST API. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - public static LogProfileResource CreateOrUpdate(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters) - { - return operations.CreateOrUpdateAsync(logProfileName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Create or update a log profile in Azure Monitoring REST API. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResource parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(logProfileName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates an existing LogProfilesResource. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - public static LogProfileResource Update(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource) - { - return operations.UpdateAsync(logProfileName, logProfilesResource).GetAwaiter().GetResult(); - } - - /// - /// Updates an existing LogProfilesResource. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the log profile. - /// - /// - /// Parameters supplied to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this ILogProfilesOperations operations, string logProfileName, LogProfileResourcePatch logProfilesResource, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(logProfileName, logProfilesResource, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the log profiles. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable List(this ILogProfilesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// List the log profiles. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ILogProfilesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperations.cs deleted file mode 100644 index 212520cb0f36c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperations.cs +++ /dev/null @@ -1,1177 +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.Monitor -{ - 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; - - /// - /// MetricAlertsOperations operations. - /// - internal partial class MetricAlertsOperations : IServiceOperations, IMetricAlertsOperations - { - /// - /// Initializes a new instance of the MetricAlertsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MetricAlertsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Retrieve alert rule definitions in a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Retrieve an alert rule definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Create or update an metric alert definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Update an metric alert definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Delete an alert rule definition. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperationsExtensions.cs deleted file mode 100644 index 9f8e6f9968a54..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsOperationsExtensions.cs +++ /dev/null @@ -1,258 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MetricAlertsOperations. - /// - public static partial class MetricAlertsOperationsExtensions - { - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IEnumerable ListBySubscription(this IMetricAlertsOperations operations) - { - return operations.ListBySubscriptionAsync().GetAwaiter().GetResult(); - } - - /// - /// Retrieve alert rule definitions in a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IMetricAlertsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve alert rule definitions in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - public static IEnumerable ListByResourceGroup(this IMetricAlertsOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Retrieve alert rule definitions in a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IMetricAlertsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static MetricAlertResource Get(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) - { - return operations.GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Retrieve an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Create or update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - public static MetricAlertResource CreateOrUpdate(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Create or update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResource parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - public static MetricAlertResource Update(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters) - { - return operations.UpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Update an metric alert definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, MetricAlertResourcePatch parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Delete an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static void Delete(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName) - { - operations.DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Delete an alert rule definition. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IMetricAlertsOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperations.cs deleted file mode 100644 index 2fc747a557515..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperations.cs +++ /dev/null @@ -1,441 +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.Monitor -{ - 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; - - /// - /// MetricAlertsStatusOperations operations. - /// - internal partial class MetricAlertsStatusOperations : IServiceOperations, IMetricAlertsStatusOperations - { - /// - /// Initializes a new instance of the MetricAlertsStatusOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MetricAlertsStatusOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Retrieve an alert rule status. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// 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(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Retrieve an alert rule status. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the status. - /// - /// - /// 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> ListByNameWithHttpMessagesAsync(string resourceGroupName, string ruleName, string statusName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (statusName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "statusName"); - } - string apiVersion = "2018-03-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("statusName", statusName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByName", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{statusName}", System.Uri.EscapeDataString(statusName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperationsExtensions.cs deleted file mode 100644 index 9a5e5573db103..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricAlertsStatusOperationsExtensions.cs +++ /dev/null @@ -1,111 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MetricAlertsStatusOperations. - /// - public static partial class MetricAlertsStatusOperationsExtensions - { - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static MetricAlertStatusCollection List(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName) - { - return operations.ListAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the status. - /// - public static MetricAlertStatusCollection ListByName(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName) - { - return operations.ListByNameAsync(resourceGroupName, ruleName, statusName).GetAwaiter().GetResult(); - } - - /// - /// Retrieve an alert rule status. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The name of the status. - /// - /// - /// The cancellation token. - /// - public static async Task ListByNameAsync(this IMetricAlertsStatusOperations operations, string resourceGroupName, string ruleName, string statusName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByNameWithHttpMessagesAsync(resourceGroupName, ruleName, statusName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperations.cs deleted file mode 100644 index 048ca649aaf3c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperations.cs +++ /dev/null @@ -1,480 +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.Monitor -{ - 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; - - /// - /// MetricBaselineOperations operations. - /// - internal partial class MetricBaselineOperations : IServiceOperations, IMetricBaselineOperations - { - /// - /// Initializes a new instance of the MetricBaselineOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MetricBaselineOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// **Gets the baseline values for a specific metric**. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// The name of the metric to retrieve the baseline for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The aggregation type of the metric to retrieve the baseline for. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceUri, string metricName, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), ResultType? resultType = default(ResultType?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (metricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "metricName"); - } - string apiVersion = "2017-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("metricName", metricName); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("interval", interval); - tracingParameters.Add("aggregation", aggregation); - tracingParameters.Add("sensitivities", sensitivities); - tracingParameters.Add("resultType", resultType); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/baseline/{metricName}").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - _url = _url.Replace("{metricName}", System.Uri.EscapeDataString(metricName)); - List _queryParameters = new List(); - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (interval != null) - { - _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); - } - if (aggregation != null) - { - _queryParameters.Add(string.Format("aggregation={0}", System.Uri.EscapeDataString(aggregation))); - } - if (sensitivities != null) - { - _queryParameters.Add(string.Format("sensitivities={0}", System.Uri.EscapeDataString(sensitivities))); - } - if (resultType != null) - { - _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, Client.SerializationSettings).Trim('"')))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// **Lists the baseline values for a resource**. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// Information that need to be specified to calculate a baseline on a time - /// series. - /// - /// - /// 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> CalculateBaselineWithHttpMessagesAsync(string resourceUri, TimeSeriesInformation timeSeriesInformation, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - if (timeSeriesInformation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "timeSeriesInformation"); - } - if (timeSeriesInformation != null) - { - timeSeriesInformation.Validate(); - } - string apiVersion = "2017-11-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("timeSeriesInformation", timeSeriesInformation); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CalculateBaseline", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/calculatebaseline").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("POST"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(timeSeriesInformation != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(timeSeriesInformation, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperationsExtensions.cs deleted file mode 100644 index 8cb8be9f89698..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricBaselineOperationsExtensions.cs +++ /dev/null @@ -1,153 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MetricBaselineOperations. - /// - public static partial class MetricBaselineOperationsExtensions - { - /// - /// **Gets the baseline values for a specific metric**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// The name of the metric to retrieve the baseline for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The aggregation type of the metric to retrieve the baseline for. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - public static BaselineResponse Get(this IMetricBaselineOperations operations, string resourceUri, string metricName, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), ResultType? resultType = default(ResultType?)) - { - return operations.GetAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType).GetAwaiter().GetResult(); - } - - /// - /// **Gets the baseline values for a specific metric**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// The name of the metric to retrieve the baseline for. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The aggregation type of the metric to retrieve the baseline for. - /// - /// - /// The list of sensitivities (comma separated) to retrieve. - /// - /// - /// Allows retrieving only metadata of the baseline. On data request all - /// information is retrieved. Possible values include: 'Data', 'Metadata' - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IMetricBaselineOperations operations, string resourceUri, string metricName, string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), string sensitivities = default(string), ResultType? resultType = default(ResultType?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceUri, metricName, timespan, interval, aggregation, sensitivities, resultType, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// **Lists the baseline values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// Information that need to be specified to calculate a baseline on a time - /// series. - /// - public static CalculateBaselineResponse CalculateBaseline(this IMetricBaselineOperations operations, string resourceUri, TimeSeriesInformation timeSeriesInformation) - { - return operations.CalculateBaselineAsync(resourceUri, timeSeriesInformation).GetAwaiter().GetResult(); - } - - /// - /// **Lists the baseline values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. It has the following structure: - /// subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/{providerName}/{resourceName}. - /// For example: - /// subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1 - /// - /// - /// Information that need to be specified to calculate a baseline on a time - /// series. - /// - /// - /// The cancellation token. - /// - public static async Task CalculateBaselineAsync(this IMetricBaselineOperations operations, string resourceUri, TimeSeriesInformation timeSeriesInformation, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CalculateBaselineWithHttpMessagesAsync(resourceUri, timeSeriesInformation, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricDefinitionsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricDefinitionsOperations.cs deleted file mode 100644 index d69e00083adc6..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricDefinitionsOperations.cs +++ /dev/null @@ -1,237 +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.Monitor -{ - 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; - - /// - /// MetricDefinitionsOperations operations. - /// - internal partial class MetricDefinitionsOperations : IServiceOperations, IMetricDefinitionsOperations - { - /// - /// Initializes a new instance of the MetricDefinitionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MetricDefinitionsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Lists the metric definitions for the resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// 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(string resourceUri, string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - string apiVersion = "2018-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("metricnamespace", metricnamespace); - 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("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metricDefinitions").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (metricnamespace != null) - { - _queryParameters.Add(string.Format("metricnamespace={0}", System.Uri.EscapeDataString(metricnamespace))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricDefinitionsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricDefinitionsOperationsExtensions.cs deleted file mode 100644 index b7a408b6ca336..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricDefinitionsOperationsExtensions.cs +++ /dev/null @@ -1,67 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MetricDefinitionsOperations. - /// - public static partial class MetricDefinitionsOperationsExtensions - { - /// - /// Lists the metric definitions for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Metric namespace to query metric definitions for. - /// - public static IEnumerable List(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string)) - { - return operations.ListAsync(resourceUri, metricnamespace).GetAwaiter().GetResult(); - } - - /// - /// Lists the metric definitions for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IMetricDefinitionsOperations operations, string resourceUri, string metricnamespace = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, metricnamespace, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricNamespacesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricNamespacesOperations.cs deleted file mode 100644 index 8e73a78d2a25c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricNamespacesOperations.cs +++ /dev/null @@ -1,238 +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.Monitor -{ - 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; - - /// - /// MetricNamespacesOperations operations. - /// - internal partial class MetricNamespacesOperations : IServiceOperations, IMetricNamespacesOperations - { - /// - /// Initializes a new instance of the MetricNamespacesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MetricNamespacesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// The identifier of the resource. - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric - /// namespaces. - /// - /// - /// 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(string resourceUri, string startTime = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - string apiVersion = "2017-12-01-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("startTime", startTime); - 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("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metricNamespaces").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (startTime != null) - { - _queryParameters.Add(string.Format("startTime={0}", System.Uri.EscapeDataString(startTime))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricNamespacesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricNamespacesOperationsExtensions.cs deleted file mode 100644 index bf67203b2baf2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricNamespacesOperationsExtensions.cs +++ /dev/null @@ -1,69 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MetricNamespacesOperations. - /// - public static partial class MetricNamespacesOperationsExtensions - { - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric - /// namespaces. - /// - public static IEnumerable List(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string)) - { - return operations.ListAsync(resourceUri, startTime).GetAwaiter().GetResult(); - } - - /// - /// Lists the metric namespaces for the resource. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// The ISO 8601 conform Date start time from which to query for metric - /// namespaces. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IMetricNamespacesOperations operations, string resourceUri, string startTime = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, startTime, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricsOperations.cs deleted file mode 100644 index d5a6702e129a4..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricsOperations.cs +++ /dev/null @@ -1,313 +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.Monitor -{ - 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; - - /// - /// MetricsOperations operations. - /// - internal partial class MetricsOperations : IServiceOperations, IMetricsOperations - { - /// - /// Initializes a new instance of the MetricsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal MetricsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// **Lists the metric values for a resource**. - /// - /// - /// The identifier of the resource. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The maximum number of records to retrieve. - /// Valid only if $filter is specified. - /// Defaults to 10. - /// - /// - /// The aggregation to use for sorting results and the direction of the sort. - /// Only one order can be specified. - /// Examples: sum asc. - /// - /// - /// Reduces the set of data collected. The syntax allowed depends on the - /// operation. See the operation's description for details. Possible values - /// include: 'Data', 'Metadata' - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// 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(string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - string apiVersion = "2018-01-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("timespan", timespan); - tracingParameters.Add("interval", interval); - tracingParameters.Add("metricnames", metricnames); - tracingParameters.Add("aggregation", aggregation); - tracingParameters.Add("top", top); - tracingParameters.Add("orderby", orderby); - tracingParameters.Add("resultType", resultType); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("metricnamespace", metricnamespace); - 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("/") ? "" : "/")), "{resourceUri}/providers/microsoft.insights/metrics").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (timespan != null) - { - _queryParameters.Add(string.Format("timespan={0}", System.Uri.EscapeDataString(timespan))); - } - if (interval != null) - { - _queryParameters.Add(string.Format("interval={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(interval, Client.SerializationSettings).Trim('"')))); - } - if (metricnames != null) - { - _queryParameters.Add(string.Format("metricnames={0}", System.Uri.EscapeDataString(metricnames))); - } - if (aggregation != null) - { - _queryParameters.Add(string.Format("aggregation={0}", System.Uri.EscapeDataString(aggregation))); - } - if (top != null) - { - _queryParameters.Add(string.Format("top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (orderby != null) - { - _queryParameters.Add(string.Format("orderby={0}", System.Uri.EscapeDataString(orderby))); - } - if (resultType != null) - { - _queryParameters.Add(string.Format("resultType={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(resultType, Client.SerializationSettings).Trim('"')))); - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (metricnamespace != null) - { - _queryParameters.Add(string.Format("metricnamespace={0}", System.Uri.EscapeDataString(metricnamespace))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricsOperationsExtensions.cs deleted file mode 100644 index d6fa05e274066..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MetricsOperationsExtensions.cs +++ /dev/null @@ -1,128 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for MetricsOperations. - /// - public static partial class MetricsOperationsExtensions - { - /// - /// **Lists the metric values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The maximum number of records to retrieve. - /// Valid only if $filter is specified. - /// Defaults to 10. - /// - /// - /// The aggregation to use for sorting results and the direction of the sort. - /// Only one order can be specified. - /// Examples: sum asc. - /// - /// - /// Reduces the set of data collected. The syntax allowed depends on the - /// operation. See the operation's description for details. Possible values - /// include: 'Data', 'Metadata' - /// - /// - /// Metric namespace to query metric definitions for. - /// - public static Response List(this IMetricsOperations operations, string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string)) - { - return operations.ListAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace).GetAwaiter().GetResult(); - } - - /// - /// **Lists the metric values for a resource**. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The identifier of the resource. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The timespan of the query. It is a string with the following format - /// 'startDateTime_ISO/endDateTime_ISO'. - /// - /// - /// The interval (i.e. timegrain) of the query. - /// - /// - /// The names of the metrics (comma separated) to retrieve. - /// - /// - /// The list of aggregation types (comma separated) to retrieve. - /// - /// - /// The maximum number of records to retrieve. - /// Valid only if $filter is specified. - /// Defaults to 10. - /// - /// - /// The aggregation to use for sorting results and the direction of the sort. - /// Only one order can be specified. - /// Examples: sum asc. - /// - /// - /// Reduces the set of data collected. The syntax allowed depends on the - /// operation. See the operation's description for details. Possible values - /// include: 'Data', 'Metadata' - /// - /// - /// Metric namespace to query metric definitions for. - /// - /// - /// The cancellation token. - /// - public static async Task ListAsync(this IMetricsOperations operations, string resourceUri, ODataQuery odataQuery = default(ODataQuery), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string metricnames = default(string), string aggregation = default(string), int? top = default(int?), string orderby = default(string), ResultType? resultType = default(ResultType?), string metricnamespace = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(resourceUri, odataQuery, timespan, interval, metricnames, aggregation, top, orderby, resultType, metricnamespace, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Action.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Action.cs deleted file mode 100644 index 31f552c145626..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Action.cs +++ /dev/null @@ -1,35 +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.Monitor.Models -{ - using System.Linq; - - /// - /// Action descriptor. - /// - public partial class Action - { - /// - /// Initializes a new instance of the Action class. - /// - public Action() - { - CustomInit(); - } - - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionGroup.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroup.cs similarity index 79% rename from sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionGroup.cs rename to sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroup.cs index 07b3b047ba2a3..e2b84febd11f4 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionGroup.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroup.cs @@ -19,27 +19,25 @@ namespace Microsoft.Azure.Management.Monitor.Models /// /// A pointer to an Azure Action Group. /// - public partial class ActivityLogAlertActionGroup + public partial class ActionGroup { /// - /// Initializes a new instance of the ActivityLogAlertActionGroup - /// class. + /// Initializes a new instance of the ActionGroup class. /// - public ActivityLogAlertActionGroup() + public ActionGroup() { CustomInit(); } /// - /// Initializes a new instance of the ActivityLogAlertActionGroup - /// class. + /// Initializes a new instance of the ActionGroup class. /// - /// The resourceId of the action group. + /// The resource ID of the Action Group. /// This cannot be null or empty. /// the dictionary of custom properties /// to include with the post operation. These data are appended to the /// webhook payload. - public ActivityLogAlertActionGroup(string actionGroupId, IDictionary webhookProperties = default(IDictionary)) + public ActionGroup(string actionGroupId, IDictionary webhookProperties = default(IDictionary)) { ActionGroupId = actionGroupId; WebhookProperties = webhookProperties; @@ -52,7 +50,7 @@ public ActivityLogAlertActionGroup() partial void CustomInit(); /// - /// Gets or sets the resourceId of the action group. This cannot be + /// Gets or sets the resource ID of the Action Group. This cannot be /// null or empty. /// [JsonProperty(PropertyName = "actionGroupId")] diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroupResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroupResource.cs deleted file mode 100644 index 20e0287652bca..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroupResource.cs +++ /dev/null @@ -1,300 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An action group resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class ActionGroupResource : Resource - { - /// - /// Initializes a new instance of the ActionGroupResource class. - /// - public ActionGroupResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ActionGroupResource class. - /// - /// Resource location - /// The short name of the action group. - /// This will be used in SMS messages. - /// Indicates whether this action group is - /// enabled. If an action group is not enabled, then none of its - /// receivers will receive communications. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// The list of email receivers that are - /// part of this action group. - /// The list of SMS receivers that are part - /// of this action group. - /// The list of webhook receivers that - /// are part of this action group. - /// The list of ITSM receivers that are - /// part of this action group. - /// The list of AzureAppPush - /// receivers that are part of this action group. - /// The list of - /// AutomationRunbook receivers that are part of this action - /// group. - /// The list of voice receivers that are - /// part of this action group. - /// The list of logic app receivers - /// that are part of this action group. - /// The list of azure function - /// receivers that are part of this action group. - /// The list of ARM role receivers that - /// are part of this action group. Roles are Azure RBAC roles and only - /// built-in roles are supported. - public ActionGroupResource(string location, string groupShortName, bool enabled, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList emailReceivers = default(IList), IList smsReceivers = default(IList), IList webhookReceivers = default(IList), IList itsmReceivers = default(IList), IList azureAppPushReceivers = default(IList), IList automationRunbookReceivers = default(IList), IList voiceReceivers = default(IList), IList logicAppReceivers = default(IList), IList azureFunctionReceivers = default(IList), IList armRoleReceivers = default(IList)) - : base(location, id, name, type, tags) - { - GroupShortName = groupShortName; - Enabled = enabled; - EmailReceivers = emailReceivers; - SmsReceivers = smsReceivers; - WebhookReceivers = webhookReceivers; - ItsmReceivers = itsmReceivers; - AzureAppPushReceivers = azureAppPushReceivers; - AutomationRunbookReceivers = automationRunbookReceivers; - VoiceReceivers = voiceReceivers; - LogicAppReceivers = logicAppReceivers; - AzureFunctionReceivers = azureFunctionReceivers; - ArmRoleReceivers = armRoleReceivers; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the short name of the action group. This will be used - /// in SMS messages. - /// - [JsonProperty(PropertyName = "properties.groupShortName")] - public string GroupShortName { get; set; } - - /// - /// Gets or sets indicates whether this action group is enabled. If an - /// action group is not enabled, then none of its receivers will - /// receive communications. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; set; } - - /// - /// Gets or sets the list of email receivers that are part of this - /// action group. - /// - [JsonProperty(PropertyName = "properties.emailReceivers")] - public IList EmailReceivers { get; set; } - - /// - /// Gets or sets the list of SMS receivers that are part of this action - /// group. - /// - [JsonProperty(PropertyName = "properties.smsReceivers")] - public IList SmsReceivers { get; set; } - - /// - /// Gets or sets the list of webhook receivers that are part of this - /// action group. - /// - [JsonProperty(PropertyName = "properties.webhookReceivers")] - public IList WebhookReceivers { get; set; } - - /// - /// Gets or sets the list of ITSM receivers that are part of this - /// action group. - /// - [JsonProperty(PropertyName = "properties.itsmReceivers")] - public IList ItsmReceivers { get; set; } - - /// - /// Gets or sets the list of AzureAppPush receivers that are part of - /// this action group. - /// - [JsonProperty(PropertyName = "properties.azureAppPushReceivers")] - public IList AzureAppPushReceivers { get; set; } - - /// - /// Gets or sets the list of AutomationRunbook receivers that are part - /// of this action group. - /// - [JsonProperty(PropertyName = "properties.automationRunbookReceivers")] - public IList AutomationRunbookReceivers { get; set; } - - /// - /// Gets or sets the list of voice receivers that are part of this - /// action group. - /// - [JsonProperty(PropertyName = "properties.voiceReceivers")] - public IList VoiceReceivers { get; set; } - - /// - /// Gets or sets the list of logic app receivers that are part of this - /// action group. - /// - [JsonProperty(PropertyName = "properties.logicAppReceivers")] - public IList LogicAppReceivers { get; set; } - - /// - /// Gets or sets the list of azure function receivers that are part of - /// this action group. - /// - [JsonProperty(PropertyName = "properties.azureFunctionReceivers")] - public IList AzureFunctionReceivers { get; set; } - - /// - /// Gets or sets the list of ARM role receivers that are part of this - /// action group. Roles are Azure RBAC roles and only built-in roles - /// are supported. - /// - [JsonProperty(PropertyName = "properties.armRoleReceivers")] - public IList ArmRoleReceivers { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (GroupShortName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "GroupShortName"); - } - if (GroupShortName != null) - { - if (GroupShortName.Length > 12) - { - throw new ValidationException(ValidationRules.MaxLength, "GroupShortName", 12); - } - } - if (EmailReceivers != null) - { - foreach (var element in EmailReceivers) - { - if (element != null) - { - element.Validate(); - } - } - } - if (SmsReceivers != null) - { - foreach (var element1 in SmsReceivers) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (WebhookReceivers != null) - { - foreach (var element2 in WebhookReceivers) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - if (ItsmReceivers != null) - { - foreach (var element3 in ItsmReceivers) - { - if (element3 != null) - { - element3.Validate(); - } - } - } - if (AzureAppPushReceivers != null) - { - foreach (var element4 in AzureAppPushReceivers) - { - if (element4 != null) - { - element4.Validate(); - } - } - } - if (AutomationRunbookReceivers != null) - { - foreach (var element5 in AutomationRunbookReceivers) - { - if (element5 != null) - { - element5.Validate(); - } - } - } - if (VoiceReceivers != null) - { - foreach (var element6 in VoiceReceivers) - { - if (element6 != null) - { - element6.Validate(); - } - } - } - if (LogicAppReceivers != null) - { - foreach (var element7 in LogicAppReceivers) - { - if (element7 != null) - { - element7.Validate(); - } - } - } - if (AzureFunctionReceivers != null) - { - foreach (var element8 in AzureFunctionReceivers) - { - if (element8 != null) - { - element8.Validate(); - } - } - } - if (ArmRoleReceivers != null) - { - foreach (var element9 in ArmRoleReceivers) - { - if (element9 != null) - { - element9.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionList.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionList.cs similarity index 62% rename from sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionList.cs rename to sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionList.cs index a9de7c860ae53..26aafe4a4135f 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionList.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionList.cs @@ -16,23 +16,23 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// A list of activity log alert actions. + /// A list of Activity Log Alert rule actions. /// - public partial class ActivityLogAlertActionList + public partial class ActionList { /// - /// Initializes a new instance of the ActivityLogAlertActionList class. + /// Initializes a new instance of the ActionList class. /// - public ActivityLogAlertActionList() + public ActionList() { CustomInit(); } /// - /// Initializes a new instance of the ActivityLogAlertActionList class. + /// Initializes a new instance of the ActionList class. /// - /// The list of activity log alerts. - public ActivityLogAlertActionList(IList actionGroups = default(IList)) + /// The list of the Action Groups. + public ActionList(IList actionGroups = default(IList)) { ActionGroups = actionGroups; CustomInit(); @@ -44,10 +44,10 @@ public ActivityLogAlertActionList() partial void CustomInit(); /// - /// Gets or sets the list of activity log alerts. + /// Gets or sets the list of the Action Groups. /// [JsonProperty(PropertyName = "actionGroups")] - public IList ActionGroups { get; set; } + public IList ActionGroups { get; set; } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertLeafCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertLeafCondition.cs deleted file mode 100644 index 8a951407ad022..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertLeafCondition.cs +++ /dev/null @@ -1,90 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An Activity Log alert condition that is met by comparing an activity - /// log field and value. - /// - public partial class ActivityLogAlertLeafCondition - { - /// - /// Initializes a new instance of the ActivityLogAlertLeafCondition - /// class. - /// - public ActivityLogAlertLeafCondition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ActivityLogAlertLeafCondition - /// class. - /// - /// The name of the field that this condition will - /// examine. The possible values for this field are (case-insensitive): - /// 'resourceId', 'category', 'caller', 'level', 'operationName', - /// 'resourceGroup', 'resourceProvider', 'status', 'subStatus', - /// 'resourceType', or anything beginning with 'properties.'. - /// The field value will be compared to this value - /// (case-insensitive) to determine if the condition is met. - public ActivityLogAlertLeafCondition(string field, string equals) - { - Field = field; - Equals = equals; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the field that this condition will - /// examine. The possible values for this field are (case-insensitive): - /// 'resourceId', 'category', 'caller', 'level', 'operationName', - /// 'resourceGroup', 'resourceProvider', 'status', 'subStatus', - /// 'resourceType', or anything beginning with 'properties.'. - /// - [JsonProperty(PropertyName = "field")] - public string Field { get; set; } - - /// - /// Gets or sets the field value will be compared to this value - /// (case-insensitive) to determine if the condition is met. - /// - [JsonProperty(PropertyName = "equals")] - public string Equals { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Field == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Field"); - } - if (Equals == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Equals"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertPatchBody.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertPatchBody.cs deleted file mode 100644 index 78a7006459140..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertPatchBody.cs +++ /dev/null @@ -1,68 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An activity log alert object for the body of patch operations. - /// - [Rest.Serialization.JsonTransformation] - public partial class ActivityLogAlertPatchBody - { - /// - /// Initializes a new instance of the ActivityLogAlertPatchBody class. - /// - public ActivityLogAlertPatchBody() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ActivityLogAlertPatchBody class. - /// - /// Resource tags - /// Indicates whether this activity log alert is - /// enabled. If an activity log alert is not enabled, then none of its - /// actions will be activated. - public ActivityLogAlertPatchBody(IDictionary tags = default(IDictionary), bool? enabled = default(bool?)) - { - Tags = tags; - Enabled = enabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets indicates whether this activity log alert is enabled. - /// If an activity log alert is not enabled, then none of its actions - /// will be activated. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertResource.cs index 8ca7e0796dbd1..547febff2f29f 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertResource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertResource.cs @@ -18,10 +18,10 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// An activity log alert resource. + /// An Activity Log Alert rule resource. /// [Rest.Serialization.JsonTransformation] - public partial class ActivityLogAlertResource : Resource + public partial class ActivityLogAlertResource : AzureResource { /// /// Initializes a new instance of the ActivityLogAlertResource class. @@ -34,31 +34,33 @@ public ActivityLogAlertResource() /// /// Initializes a new instance of the ActivityLogAlertResource class. /// - /// Resource location - /// A list of resourceIds that will be used as - /// prefixes. The alert will only apply to activityLogs with - /// resourceIds that fall under one of these prefixes. This list must + /// A list of resource IDs that will be used as + /// prefixes. The alert will only apply to Activity Log events with + /// resource IDs that fall under one of these prefixes. This list must /// include at least one item. /// The condition that will cause this alert to /// activate. /// The actions that will activate when the /// condition is met. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// Indicates whether this activity log alert is - /// enabled. If an activity log alert is not enabled, then none of its - /// actions will be activated. - /// A description of this activity log - /// alert. - public ActivityLogAlertResource(string location, IList scopes, ActivityLogAlertAllOfCondition condition, ActivityLogAlertActionList actions, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), bool? enabled = default(bool?), string description = default(string)) - : base(location, id, name, type, tags) + /// The resource Id. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. Since Azure + /// Activity Log Alerts is a global service, the location of the rules + /// should always be 'global'. + /// The tags of the resource. + /// Indicates whether this Activity Log Alert + /// rule is enabled. If an Activity Log Alert rule is not enabled, then + /// none of its actions will be activated. + /// A description of this Activity Log Alert + /// rule. + public ActivityLogAlertResource(IList scopes, AlertRuleAllOfCondition condition, ActionList actions, string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), bool? enabled = default(bool?), string description = default(string)) + : base(id, name, type, location, tags) { Scopes = scopes; - Enabled = enabled; Condition = condition; Actions = actions; + Enabled = enabled; Description = description; CustomInit(); } @@ -69,37 +71,37 @@ public ActivityLogAlertResource() partial void CustomInit(); /// - /// Gets or sets a list of resourceIds that will be used as prefixes. - /// The alert will only apply to activityLogs with resourceIds that - /// fall under one of these prefixes. This list must include at least - /// one item. + /// Gets or sets a list of resource IDs that will be used as prefixes. + /// The alert will only apply to Activity Log events with resource IDs + /// that fall under one of these prefixes. This list must include at + /// least one item. /// [JsonProperty(PropertyName = "properties.scopes")] public IList Scopes { get; set; } - /// - /// Gets or sets indicates whether this activity log alert is enabled. - /// If an activity log alert is not enabled, then none of its actions - /// will be activated. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } - /// /// Gets or sets the condition that will cause this alert to activate. /// [JsonProperty(PropertyName = "properties.condition")] - public ActivityLogAlertAllOfCondition Condition { get; set; } + public AlertRuleAllOfCondition Condition { get; set; } /// /// Gets or sets the actions that will activate when the condition is /// met. /// [JsonProperty(PropertyName = "properties.actions")] - public ActivityLogAlertActionList Actions { get; set; } + public ActionList Actions { get; set; } + + /// + /// Gets or sets indicates whether this Activity Log Alert rule is + /// enabled. If an Activity Log Alert rule is not enabled, then none of + /// its actions will be activated. + /// + [JsonProperty(PropertyName = "properties.enabled")] + public bool? Enabled { get; set; } /// - /// Gets or sets a description of this activity log alert. + /// Gets or sets a description of this Activity Log Alert rule. /// [JsonProperty(PropertyName = "properties.description")] public string Description { get; set; } @@ -110,9 +112,8 @@ public ActivityLogAlertResource() /// /// Thrown if validation fails /// - public override void Validate() + public virtual void Validate() { - base.Validate(); if (Scopes == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Scopes"); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AggregationType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AggregationType.cs deleted file mode 100644 index fed1698e35fb3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AggregationType.cs +++ /dev/null @@ -1,84 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for AggregationType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum AggregationType - { - [EnumMember(Value = "None")] - None, - [EnumMember(Value = "Average")] - Average, - [EnumMember(Value = "Count")] - Count, - [EnumMember(Value = "Minimum")] - Minimum, - [EnumMember(Value = "Maximum")] - Maximum, - [EnumMember(Value = "Total")] - Total - } - internal static class AggregationTypeEnumExtension - { - internal static string ToSerializedValue(this AggregationType? value) - { - return value == null ? null : ((AggregationType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this AggregationType value) - { - switch( value ) - { - case AggregationType.None: - return "None"; - case AggregationType.Average: - return "Average"; - case AggregationType.Count: - return "Count"; - case AggregationType.Minimum: - return "Minimum"; - case AggregationType.Maximum: - return "Maximum"; - case AggregationType.Total: - return "Total"; - } - return null; - } - - internal static AggregationType? ParseAggregationType(this string value) - { - switch( value ) - { - case "None": - return AggregationType.None; - case "Average": - return AggregationType.Average; - case "Count": - return AggregationType.Count; - case "Minimum": - return AggregationType.Minimum; - case "Maximum": - return AggregationType.Maximum; - case "Total": - return AggregationType.Total; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertAllOfCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleAllOfCondition.cs similarity index 62% rename from sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertAllOfCondition.cs rename to sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleAllOfCondition.cs index bd35eba748129..f6a90d22df8b8 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertAllOfCondition.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleAllOfCondition.cs @@ -17,27 +17,25 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// An Activity Log alert condition that is met when all its member + /// An Activity Log Alert rule condition that is met when all its member /// conditions are met. /// - public partial class ActivityLogAlertAllOfCondition + public partial class AlertRuleAllOfCondition { /// - /// Initializes a new instance of the ActivityLogAlertAllOfCondition - /// class. + /// Initializes a new instance of the AlertRuleAllOfCondition class. /// - public ActivityLogAlertAllOfCondition() + public AlertRuleAllOfCondition() { CustomInit(); } /// - /// Initializes a new instance of the ActivityLogAlertAllOfCondition - /// class. + /// Initializes a new instance of the AlertRuleAllOfCondition class. /// - /// The list of activity log alert + /// The list of Activity Log Alert rule /// conditions. - public ActivityLogAlertAllOfCondition(IList allOf) + public AlertRuleAllOfCondition(IList allOf) { AllOf = allOf; CustomInit(); @@ -49,10 +47,10 @@ public ActivityLogAlertAllOfCondition(IList allOf partial void CustomInit(); /// - /// Gets or sets the list of activity log alert conditions. + /// Gets or sets the list of Activity Log Alert rule conditions. /// [JsonProperty(PropertyName = "allOf")] - public IList AllOf { get; set; } + public IList AllOf { get; set; } /// /// Validate the object. @@ -66,16 +64,6 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "AllOf"); } - if (AllOf != null) - { - foreach (var element in AllOf) - { - if (element != null) - { - element.Validate(); - } - } - } } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleAnyOfOrLeafCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleAnyOfOrLeafCondition.cs new file mode 100644 index 0000000000000..d09651d95f090 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleAnyOfOrLeafCondition.cs @@ -0,0 +1,85 @@ +// +// 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.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Activity Log Alert rule condition that is met when all its member + /// conditions are met. + /// Each condition can be of one of the following types: + /// __Important__: Each type has its unique subset of properties. + /// Properties from different types CANNOT exist in one condition. + /// * __Leaf Condition -__ must contain 'field' and either 'equals' or + /// 'containsAny'. + /// _Please note, 'anyOf' should __not__ be set in a Leaf Condition._ + /// * __AnyOf Condition -__ must contain __only__ 'anyOf' (which is an + /// array of Leaf Conditions). + /// _Please note, 'field', 'equals' and 'containsAny' should __not__ be set + /// in an AnyOf Condition._ + /// + /// + public partial class AlertRuleAnyOfOrLeafCondition : AlertRuleLeafCondition + { + /// + /// Initializes a new instance of the AlertRuleAnyOfOrLeafCondition + /// class. + /// + public AlertRuleAnyOfOrLeafCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleAnyOfOrLeafCondition + /// class. + /// + /// The name of the Activity Log event's field that + /// this condition will examine. + /// The possible values for this field are (case-insensitive): + /// 'resourceId', 'category', 'caller', 'level', 'operationName', + /// 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + /// 'resourceType', or anything beginning with 'properties'. + /// The value of the event's field will be + /// compared to this value (case-insensitive) to determine if the + /// condition is met. + /// The value of the event's field will be + /// compared to the values in this array (case-insensitive) to + /// determine if the condition is met. + /// An Activity Log Alert rule 'anyOf' + /// condition. + public AlertRuleAnyOfOrLeafCondition(string field = default(string), string equals = default(string), IList containsAny = default(IList), IList anyOf = default(IList)) + : base(field, equals, containsAny) + { + AnyOf = anyOf; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets an Activity Log Alert rule 'anyOf' condition. + /// + /// + /// An Activity Log Alert rule condition that is met when at least one + /// of its member leaf conditions are met. + /// + [JsonProperty(PropertyName = "anyOf")] + public IList AnyOf { get; set; } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleLeafCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleLeafCondition.cs new file mode 100644 index 0000000000000..ada48105213c2 --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleLeafCondition.cs @@ -0,0 +1,89 @@ +// +// 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.Monitor.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// An Activity Log Alert rule condition that is met by comparing the field + /// and value of an Activity Log event. + /// This condition must contain 'field' and either 'equals' or + /// 'containsAny'. + /// + public partial class AlertRuleLeafCondition + { + /// + /// Initializes a new instance of the AlertRuleLeafCondition class. + /// + public AlertRuleLeafCondition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AlertRuleLeafCondition class. + /// + /// The name of the Activity Log event's field that + /// this condition will examine. + /// The possible values for this field are (case-insensitive): + /// 'resourceId', 'category', 'caller', 'level', 'operationName', + /// 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + /// 'resourceType', or anything beginning with 'properties'. + /// The value of the event's field will be + /// compared to this value (case-insensitive) to determine if the + /// condition is met. + /// The value of the event's field will be + /// compared to the values in this array (case-insensitive) to + /// determine if the condition is met. + public AlertRuleLeafCondition(string field = default(string), string equals = default(string), IList containsAny = default(IList)) + { + Field = field; + Equals = equals; + ContainsAny = containsAny; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the Activity Log event's field that this + /// condition will examine. + /// The possible values for this field are (case-insensitive): + /// 'resourceId', 'category', 'caller', 'level', 'operationName', + /// 'resourceGroup', 'resourceProvider', 'status', 'subStatus', + /// 'resourceType', or anything beginning with 'properties'. + /// + [JsonProperty(PropertyName = "field")] + public string Field { get; set; } + + /// + /// Gets or sets the value of the event's field will be compared to + /// this value (case-insensitive) to determine if the condition is met. + /// + [JsonProperty(PropertyName = "equals")] + public string Equals { get; set; } + + /// + /// Gets or sets the value of the event's field will be compared to the + /// values in this array (case-insensitive) to determine if the + /// condition is met. + /// + [JsonProperty(PropertyName = "containsAny")] + public IList ContainsAny { get; set; } + + } +} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroupPatchBody.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRulePatchObject.cs similarity index 62% rename from sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroupPatchBody.cs rename to sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRulePatchObject.cs index 4c3fe37164910..e9735467269c1 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroupPatchBody.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRulePatchObject.cs @@ -18,27 +18,27 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// An action group object for the body of patch operations. + /// An Activity Log Alert rule object for the body of patch operations. /// [Rest.Serialization.JsonTransformation] - public partial class ActionGroupPatchBody + public partial class AlertRulePatchObject { /// - /// Initializes a new instance of the ActionGroupPatchBody class. + /// Initializes a new instance of the AlertRulePatchObject class. /// - public ActionGroupPatchBody() + public AlertRulePatchObject() { CustomInit(); } /// - /// Initializes a new instance of the ActionGroupPatchBody class. + /// Initializes a new instance of the AlertRulePatchObject class. /// - /// Resource tags - /// Indicates whether this action group is - /// enabled. If an action group is not enabled, then none of its - /// actions will be activated. - public ActionGroupPatchBody(IDictionary tags = default(IDictionary), bool? enabled = default(bool?)) + /// The resource tags + /// Indicates whether this Activity Log Alert + /// rule is enabled. If an Activity Log Alert rule is not enabled, then + /// none of its actions will be activated. + public AlertRulePatchObject(IDictionary tags = default(IDictionary), bool? enabled = default(bool?)) { Tags = tags; Enabled = enabled; @@ -51,15 +51,15 @@ public ActionGroupPatchBody() partial void CustomInit(); /// - /// Gets or sets resource tags + /// Gets or sets the resource tags /// [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } /// - /// Gets or sets indicates whether this action group is enabled. If an - /// action group is not enabled, then none of its actions will be - /// activated. + /// Gets or sets indicates whether this Activity Log Alert rule is + /// enabled. If an Activity Log Alert rule is not enabled, then none of + /// its actions will be activated. /// [JsonProperty(PropertyName = "properties.enabled")] public bool? Enabled { get; set; } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleResource.cs deleted file mode 100644 index 3720c83e68d92..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleResource.cs +++ /dev/null @@ -1,131 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The alert rule resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class AlertRuleResource : Resource - { - /// - /// Initializes a new instance of the AlertRuleResource class. - /// - public AlertRuleResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertRuleResource class. - /// - /// Resource location - /// the name of the alert - /// rule. - /// the flag that indicates whether the alert - /// rule is enabled. - /// the condition that results in the alert - /// rule being activated. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// the description of the alert rule that - /// will be included in the alert email. - /// the array of actions that are performed when - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - public AlertRuleResource(string location, string alertRuleResourceName, bool isEnabled, RuleCondition condition, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) - : base(location, id, name, type, tags) - { - AlertRuleResourceName = alertRuleResourceName; - Description = description; - IsEnabled = isEnabled; - Condition = condition; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the alert rule. - /// - [JsonProperty(PropertyName = "properties.name")] - public string AlertRuleResourceName { get; set; } - - /// - /// Gets or sets the description of the alert rule that will be - /// included in the alert email. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the flag that indicates whether the alert rule is - /// enabled. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool IsEnabled { get; set; } - - /// - /// Gets or sets the condition that results in the alert rule being - /// activated. - /// - [JsonProperty(PropertyName = "properties.condition")] - public RuleCondition Condition { get; set; } - - /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. - /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } - - /// - /// Gets last time the rule was updated in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (AlertRuleResourceName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertRuleResourceName"); - } - if (Condition == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Condition"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleResourcePatch.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleResourcePatch.cs deleted file mode 100644 index b80302c7690e2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleResourcePatch.cs +++ /dev/null @@ -1,131 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The alert rule object for patch operations. - /// - [Rest.Serialization.JsonTransformation] - public partial class AlertRuleResourcePatch - { - /// - /// Initializes a new instance of the AlertRuleResourcePatch class. - /// - public AlertRuleResourcePatch() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertRuleResourcePatch class. - /// - /// the name of the alert rule. - /// the flag that indicates whether the alert - /// rule is enabled. - /// the condition that results in the alert - /// rule being activated. - /// Resource tags - /// the description of the alert rule that - /// will be included in the alert email. - /// the array of actions that are performed when - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - public AlertRuleResourcePatch(string name, bool isEnabled, RuleCondition condition, IDictionary tags = default(IDictionary), string description = default(string), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) - { - Tags = tags; - Name = name; - Description = description; - IsEnabled = isEnabled; - Condition = condition; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets the name of the alert rule. - /// - [JsonProperty(PropertyName = "properties.name")] - public string Name { get; set; } - - /// - /// Gets or sets the description of the alert rule that will be - /// included in the alert email. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the flag that indicates whether the alert rule is - /// enabled. - /// - [JsonProperty(PropertyName = "properties.isEnabled")] - public bool IsEnabled { get; set; } - - /// - /// Gets or sets the condition that results in the alert rule being - /// activated. - /// - [JsonProperty(PropertyName = "properties.condition")] - public RuleCondition Condition { get; set; } - - /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. - /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } - - /// - /// Gets last time the rule was updated in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Condition == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Condition"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertSeverity.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertSeverity.cs deleted file mode 100644 index 61b755cfc3d7e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertSeverity.cs +++ /dev/null @@ -1,25 +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.Monitor.Models -{ - - /// - /// Defines values for AlertSeverity. - /// - public static class AlertSeverity - { - public const string Zero = "0"; - public const string One = "1"; - public const string Two = "2"; - public const string Three = "3"; - public const string Four = "4"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertingAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertingAction.cs deleted file mode 100644 index 31e2bc56ccfc7..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertingAction.cs +++ /dev/null @@ -1,104 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Specify action need to be taken when rule type is Alert - /// - [Newtonsoft.Json.JsonObject("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction")] - public partial class AlertingAction : Action - { - /// - /// Initializes a new instance of the AlertingAction class. - /// - public AlertingAction() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AlertingAction class. - /// - /// Severity of the alert. Possible values - /// include: '0', '1', '2', '3', '4' - /// The trigger condition that results in the - /// alert rule being. - /// Azure action group reference. - /// time (in minutes) for which Alerts - /// should be throttled or suppressed. - public AlertingAction(string severity, TriggerCondition trigger, AzNsActionGroup aznsAction = default(AzNsActionGroup), int? throttlingInMin = default(int?)) - { - Severity = severity; - AznsAction = aznsAction; - ThrottlingInMin = throttlingInMin; - Trigger = trigger; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets severity of the alert. Possible values include: '0', - /// '1', '2', '3', '4' - /// - [JsonProperty(PropertyName = "severity")] - public string Severity { get; set; } - - /// - /// Gets or sets azure action group reference. - /// - [JsonProperty(PropertyName = "aznsAction")] - public AzNsActionGroup AznsAction { get; set; } - - /// - /// Gets or sets time (in minutes) for which Alerts should be throttled - /// or suppressed. - /// - [JsonProperty(PropertyName = "throttlingInMin")] - public int? ThrottlingInMin { get; set; } - - /// - /// Gets or sets the trigger condition that results in the alert rule - /// being. - /// - [JsonProperty(PropertyName = "trigger")] - public TriggerCondition Trigger { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Severity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Severity"); - } - if (Trigger == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Trigger"); - } - if (Trigger != null) - { - Trigger.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ArmRoleReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ArmRoleReceiver.cs deleted file mode 100644 index b6868eab88908..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ArmRoleReceiver.cs +++ /dev/null @@ -1,88 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An arm role receiver. - /// - public partial class ArmRoleReceiver - { - /// - /// Initializes a new instance of the ArmRoleReceiver class. - /// - public ArmRoleReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ArmRoleReceiver class. - /// - /// The name of the arm role receiver. Names must be - /// unique across all receivers within an action group. - /// The arm role id. - /// Indicates whether to use common - /// alert schema. - public ArmRoleReceiver(string name, string roleId, bool useCommonAlertSchema) - { - Name = name; - RoleId = roleId; - UseCommonAlertSchema = useCommonAlertSchema; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the arm role receiver. Names must be - /// unique across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the arm role id. - /// - [JsonProperty(PropertyName = "roleId")] - public string RoleId { get; set; } - - /// - /// Gets or sets indicates whether to use common alert schema. - /// - [JsonProperty(PropertyName = "useCommonAlertSchema")] - public bool UseCommonAlertSchema { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (RoleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RoleId"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutomationRunbookReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutomationRunbookReceiver.cs deleted file mode 100644 index 3acb0207fb462..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutomationRunbookReceiver.cs +++ /dev/null @@ -1,128 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The Azure Automation Runbook notification receiver. - /// - public partial class AutomationRunbookReceiver - { - /// - /// Initializes a new instance of the AutomationRunbookReceiver class. - /// - public AutomationRunbookReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutomationRunbookReceiver class. - /// - /// The Azure automation account Id - /// which holds this runbook and authenticate to Azure - /// resource. - /// The name for this runbook. - /// The resource id for webhook linked - /// to this runbook. - /// Indicates whether this instance is - /// global runbook. - /// Indicates whether to use common - /// alert schema. - /// Indicates name of the webhook. - /// The URI where webhooks should be - /// sent. - public AutomationRunbookReceiver(string automationAccountId, string runbookName, string webhookResourceId, bool isGlobalRunbook, bool useCommonAlertSchema, string name = default(string), string serviceUri = default(string)) - { - AutomationAccountId = automationAccountId; - RunbookName = runbookName; - WebhookResourceId = webhookResourceId; - IsGlobalRunbook = isGlobalRunbook; - Name = name; - ServiceUri = serviceUri; - UseCommonAlertSchema = useCommonAlertSchema; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Azure automation account Id which holds this - /// runbook and authenticate to Azure resource. - /// - [JsonProperty(PropertyName = "automationAccountId")] - public string AutomationAccountId { get; set; } - - /// - /// Gets or sets the name for this runbook. - /// - [JsonProperty(PropertyName = "runbookName")] - public string RunbookName { get; set; } - - /// - /// Gets or sets the resource id for webhook linked to this runbook. - /// - [JsonProperty(PropertyName = "webhookResourceId")] - public string WebhookResourceId { get; set; } - - /// - /// Gets or sets indicates whether this instance is global runbook. - /// - [JsonProperty(PropertyName = "isGlobalRunbook")] - public bool IsGlobalRunbook { get; set; } - - /// - /// Gets or sets indicates name of the webhook. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the URI where webhooks should be sent. - /// - [JsonProperty(PropertyName = "serviceUri")] - public string ServiceUri { get; set; } - - /// - /// Gets or sets indicates whether to use common alert schema. - /// - [JsonProperty(PropertyName = "useCommonAlertSchema")] - public bool UseCommonAlertSchema { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (AutomationAccountId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AutomationAccountId"); - } - if (RunbookName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RunbookName"); - } - if (WebhookResourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "WebhookResourceId"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleNotification.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleNotification.cs deleted file mode 100644 index 8ac9f845761d3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleNotification.cs +++ /dev/null @@ -1,76 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Autoscale notification. - /// - public partial class AutoscaleNotification - { - /// - /// Initializes a new instance of the AutoscaleNotification class. - /// - public AutoscaleNotification() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutoscaleNotification class. - /// - /// the email notification. - /// the collection of webhook - /// notifications. - public AutoscaleNotification(EmailNotification email = default(EmailNotification), IList webhooks = default(IList)) - { - Email = email; - Webhooks = webhooks; - CustomInit(); - } - /// - /// Static constructor for AutoscaleNotification class. - /// - static AutoscaleNotification() - { - Operation = "Scale"; - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the email notification. - /// - [JsonProperty(PropertyName = "email")] - public EmailNotification Email { get; set; } - - /// - /// Gets or sets the collection of webhook notifications. - /// - [JsonProperty(PropertyName = "webhooks")] - public IList Webhooks { get; set; } - - /// - /// the operation associated with the notification and its value must - /// be "scale" - /// - [JsonProperty(PropertyName = "operation")] - public static string Operation { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleProfile.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleProfile.cs deleted file mode 100644 index ac0e4a09c11f5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleProfile.cs +++ /dev/null @@ -1,140 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Autoscale profile. - /// - public partial class AutoscaleProfile - { - /// - /// Initializes a new instance of the AutoscaleProfile class. - /// - public AutoscaleProfile() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutoscaleProfile class. - /// - /// the name of the profile. - /// the number of instances that can be used - /// during this profile. - /// the collection of rules that provide the - /// triggers and parameters for the scaling action. A maximum of 10 - /// rules can be specified. - /// the specific date-time for the profile. - /// This element is not used if the Recurrence element is used. - /// the repeating times at which this profile - /// begins. This element is not used if the FixedDate element is - /// used. - public AutoscaleProfile(string name, ScaleCapacity capacity, IList rules, TimeWindow fixedDate = default(TimeWindow), Recurrence recurrence = default(Recurrence)) - { - Name = name; - Capacity = capacity; - Rules = rules; - FixedDate = fixedDate; - Recurrence = recurrence; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the profile. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the number of instances that can be used during this - /// profile. - /// - [JsonProperty(PropertyName = "capacity")] - public ScaleCapacity Capacity { get; set; } - - /// - /// Gets or sets the collection of rules that provide the triggers and - /// parameters for the scaling action. A maximum of 10 rules can be - /// specified. - /// - [JsonProperty(PropertyName = "rules")] - public IList Rules { get; set; } - - /// - /// Gets or sets the specific date-time for the profile. This element - /// is not used if the Recurrence element is used. - /// - [JsonProperty(PropertyName = "fixedDate")] - public TimeWindow FixedDate { get; set; } - - /// - /// Gets or sets the repeating times at which this profile begins. This - /// element is not used if the FixedDate element is used. - /// - [JsonProperty(PropertyName = "recurrence")] - public Recurrence Recurrence { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Capacity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Capacity"); - } - if (Rules == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Rules"); - } - if (Capacity != null) - { - Capacity.Validate(); - } - if (Rules != null) - { - foreach (var element in Rules) - { - if (element != null) - { - element.Validate(); - } - } - } - if (FixedDate != null) - { - FixedDate.Validate(); - } - if (Recurrence != null) - { - Recurrence.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleSettingResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleSettingResource.cs deleted file mode 100644 index 7ce1047ae27f6..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleSettingResource.cs +++ /dev/null @@ -1,133 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The autoscale setting resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class AutoscaleSettingResource : Resource - { - /// - /// Initializes a new instance of the AutoscaleSettingResource class. - /// - public AutoscaleSettingResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutoscaleSettingResource class. - /// - /// Resource location - /// the collection of automatic scaling profiles - /// that specify different scaling parameters for different time - /// periods. A maximum of 20 profiles can be specified. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// the collection of - /// notifications. - /// the enabled flag. Specifies whether automatic - /// scaling is enabled for the resource. The default value is - /// 'true'. - /// the name of the - /// autoscale setting. - /// the resource identifier of the - /// resource that the autoscale setting should be added to. - public AutoscaleSettingResource(string location, IList profiles, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList notifications = default(IList), bool? enabled = default(bool?), string autoscaleSettingResourceName = default(string), string targetResourceUri = default(string)) - : base(location, id, name, type, tags) - { - Profiles = profiles; - Notifications = notifications; - Enabled = enabled; - AutoscaleSettingResourceName = autoscaleSettingResourceName; - TargetResourceUri = targetResourceUri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the collection of automatic scaling profiles that - /// specify different scaling parameters for different time periods. A - /// maximum of 20 profiles can be specified. - /// - [JsonProperty(PropertyName = "properties.profiles")] - public IList Profiles { get; set; } - - /// - /// Gets or sets the collection of notifications. - /// - [JsonProperty(PropertyName = "properties.notifications")] - public IList Notifications { get; set; } - - /// - /// Gets or sets the enabled flag. Specifies whether automatic scaling - /// is enabled for the resource. The default value is 'true'. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } - - /// - /// Gets or sets the name of the autoscale setting. - /// - [JsonProperty(PropertyName = "properties.name")] - public string AutoscaleSettingResourceName { get; set; } - - /// - /// Gets or sets the resource identifier of the resource that the - /// autoscale setting should be added to. - /// - [JsonProperty(PropertyName = "properties.targetResourceUri")] - public string TargetResourceUri { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (Profiles == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); - } - if (Profiles != null) - { - if (Profiles.Count > 20) - { - throw new ValidationException(ValidationRules.MaxItems, "Profiles", 20); - } - foreach (var element in Profiles) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleSettingResourcePatch.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleSettingResourcePatch.cs deleted file mode 100644 index fc9d799fc6cc9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AutoscaleSettingResourcePatch.cs +++ /dev/null @@ -1,135 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The autoscale setting object for patch operations. - /// - [Rest.Serialization.JsonTransformation] - public partial class AutoscaleSettingResourcePatch - { - /// - /// Initializes a new instance of the AutoscaleSettingResourcePatch - /// class. - /// - public AutoscaleSettingResourcePatch() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AutoscaleSettingResourcePatch - /// class. - /// - /// the collection of automatic scaling profiles - /// that specify different scaling parameters for different time - /// periods. A maximum of 20 profiles can be specified. - /// Resource tags - /// the collection of - /// notifications. - /// the enabled flag. Specifies whether automatic - /// scaling is enabled for the resource. The default value is - /// 'true'. - /// the name of the autoscale setting. - /// the resource identifier of the - /// resource that the autoscale setting should be added to. - public AutoscaleSettingResourcePatch(IList profiles, IDictionary tags = default(IDictionary), IList notifications = default(IList), bool? enabled = default(bool?), string name = default(string), string targetResourceUri = default(string)) - { - Tags = tags; - Profiles = profiles; - Notifications = notifications; - Enabled = enabled; - Name = name; - TargetResourceUri = targetResourceUri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets the collection of automatic scaling profiles that - /// specify different scaling parameters for different time periods. A - /// maximum of 20 profiles can be specified. - /// - [JsonProperty(PropertyName = "properties.profiles")] - public IList Profiles { get; set; } - - /// - /// Gets or sets the collection of notifications. - /// - [JsonProperty(PropertyName = "properties.notifications")] - public IList Notifications { get; set; } - - /// - /// Gets or sets the enabled flag. Specifies whether automatic scaling - /// is enabled for the resource. The default value is 'true'. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool? Enabled { get; set; } - - /// - /// Gets or sets the name of the autoscale setting. - /// - [JsonProperty(PropertyName = "properties.name")] - public string Name { get; set; } - - /// - /// Gets or sets the resource identifier of the resource that the - /// autoscale setting should be added to. - /// - [JsonProperty(PropertyName = "properties.targetResourceUri")] - public string TargetResourceUri { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Profiles == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Profiles"); - } - if (Profiles != null) - { - if (Profiles.Count > 20) - { - throw new ValidationException(ValidationRules.MaxItems, "Profiles", 20); - } - foreach (var element in Profiles) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzNsActionGroup.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzNsActionGroup.cs deleted file mode 100644 index e327bc653e779..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzNsActionGroup.cs +++ /dev/null @@ -1,73 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Azure action group - /// - public partial class AzNsActionGroup - { - /// - /// Initializes a new instance of the AzNsActionGroup class. - /// - public AzNsActionGroup() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzNsActionGroup class. - /// - /// Azure Action Group reference. - /// Custom subject override for all email - /// ids in Azure action group - /// Custom payload to be sent for - /// all webhook URI in Azure action group - public AzNsActionGroup(IList actionGroup = default(IList), string emailSubject = default(string), string customWebhookPayload = default(string)) - { - ActionGroup = actionGroup; - EmailSubject = emailSubject; - CustomWebhookPayload = customWebhookPayload; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets azure Action Group reference. - /// - [JsonProperty(PropertyName = "actionGroup")] - public IList ActionGroup { get; set; } - - /// - /// Gets or sets custom subject override for all email ids in Azure - /// action group - /// - [JsonProperty(PropertyName = "emailSubject")] - public string EmailSubject { get; set; } - - /// - /// Gets or sets custom payload to be sent for all webhook URI in Azure - /// action group - /// - [JsonProperty(PropertyName = "customWebhookPayload")] - public string CustomWebhookPayload { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureAppPushReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureAppPushReceiver.cs deleted file mode 100644 index 70ccc8b1dab0b..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureAppPushReceiver.cs +++ /dev/null @@ -1,81 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The Azure mobile App push notification receiver. - /// - public partial class AzureAppPushReceiver - { - /// - /// Initializes a new instance of the AzureAppPushReceiver class. - /// - public AzureAppPushReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureAppPushReceiver class. - /// - /// The name of the Azure mobile app push receiver. - /// Names must be unique across all receivers within an action - /// group. - /// The email address registered for the - /// Azure mobile app. - public AzureAppPushReceiver(string name, string emailAddress) - { - Name = name; - EmailAddress = emailAddress; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the Azure mobile app push receiver. Names - /// must be unique across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the email address registered for the Azure mobile app. - /// - [JsonProperty(PropertyName = "emailAddress")] - public string EmailAddress { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (EmailAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EmailAddress"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureFunctionReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureFunctionReceiver.cs deleted file mode 100644 index 9a0157305b0be..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureFunctionReceiver.cs +++ /dev/null @@ -1,115 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An azure function receiver. - /// - public partial class AzureFunctionReceiver - { - /// - /// Initializes a new instance of the AzureFunctionReceiver class. - /// - public AzureFunctionReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureFunctionReceiver class. - /// - /// The name of the azure function receiver. Names - /// must be unique across all receivers within an action group. - /// The azure resource id of the - /// function app. - /// The function name in the function - /// app. - /// The http trigger url where http - /// request sent to. - /// Indicates whether to use common - /// alert schema. - public AzureFunctionReceiver(string name, string functionAppResourceId, string functionName, string httpTriggerUrl, bool useCommonAlertSchema) - { - Name = name; - FunctionAppResourceId = functionAppResourceId; - FunctionName = functionName; - HttpTriggerUrl = httpTriggerUrl; - UseCommonAlertSchema = useCommonAlertSchema; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the azure function receiver. Names must be - /// unique across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the azure resource id of the function app. - /// - [JsonProperty(PropertyName = "functionAppResourceId")] - public string FunctionAppResourceId { get; set; } - - /// - /// Gets or sets the function name in the function app. - /// - [JsonProperty(PropertyName = "functionName")] - public string FunctionName { get; set; } - - /// - /// Gets or sets the http trigger url where http request sent to. - /// - [JsonProperty(PropertyName = "httpTriggerUrl")] - public string HttpTriggerUrl { get; set; } - - /// - /// Gets or sets indicates whether to use common alert schema. - /// - [JsonProperty(PropertyName = "useCommonAlertSchema")] - public bool UseCommonAlertSchema { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (FunctionAppResourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FunctionAppResourceId"); - } - if (FunctionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FunctionName"); - } - if (HttpTriggerUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "HttpTriggerUrl"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs deleted file mode 100644 index 024b31b45b870..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorMetricsDestination.cs +++ /dev/null @@ -1,67 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Azure Monitor Metrics destination. - /// - public partial class AzureMonitorMetricsDestination - { - /// - /// Initializes a new instance of the AzureMonitorMetricsDestination - /// class. - /// - public AzureMonitorMetricsDestination() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureMonitorMetricsDestination - /// class. - /// - /// A friendly name for the destination. - /// This name should be unique across all destinations (regardless of - /// type) within the data collection rule. - public AzureMonitorMetricsDestination(string name) - { - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a friendly name for the destination. - /// This name should be unique across all destinations (regardless of - /// type) within the data collection rule. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorPrivateLinkScope.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorPrivateLinkScope.cs deleted file mode 100644 index 47dbcf85231d3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureMonitorPrivateLinkScope.cs +++ /dev/null @@ -1,100 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An Azure Monitor PrivateLinkScope definition. - /// - [Rest.Serialization.JsonTransformation] - public partial class AzureMonitorPrivateLinkScope : PrivateLinkScopesResource - { - /// - /// Initializes a new instance of the AzureMonitorPrivateLinkScope - /// class. - /// - public AzureMonitorPrivateLinkScope() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the AzureMonitorPrivateLinkScope - /// class. - /// - /// Resource location - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// Current state of this - /// PrivateLinkScope: whether or not is has been provisioned within the - /// resource group it is defined. Users cannot change this value but - /// are able to read from it. Values will include Provisioning - /// ,Succeeded, Canceled and Failed. - /// List of private endpoint - /// connections. - public AzureMonitorPrivateLinkScope(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), IList privateEndpointConnections = default(IList)) - : base(location, id, name, type, tags) - { - ProvisioningState = provisioningState; - PrivateEndpointConnections = privateEndpointConnections; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets current state of this PrivateLinkScope: whether or not is has - /// been provisioned within the resource group it is defined. Users - /// cannot change this value but are able to read from it. Values will - /// include Provisioning ,Succeeded, Canceled and Failed. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets list of private endpoint connections. - /// - [JsonProperty(PropertyName = "properties.privateEndpointConnections")] - public IList PrivateEndpointConnections { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (PrivateEndpointConnections != null) - { - foreach (var element in PrivateEndpointConnections) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Resource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureResource.cs similarity index 58% rename from sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Resource.cs rename to sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureResource.cs index d3ccce82751b3..c2e6c89ff1bac 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Resource.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AzureResource.cs @@ -18,27 +18,29 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// An azure resource object + /// An Azure resource object. /// - public partial class Resource : IResource + public partial class AzureResource : IResource { /// - /// Initializes a new instance of the Resource class. + /// Initializes a new instance of the AzureResource class. /// - public Resource() + public AzureResource() { CustomInit(); } /// - /// Initializes a new instance of the Resource class. + /// Initializes a new instance of the AzureResource class. /// - /// Resource location - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + /// The resource Id. + /// The name of the resource. + /// The type of the resource. + /// The location of the resource. Since Azure + /// Activity Log Alerts is a global service, the location of the rules + /// should always be 'global'. + /// The tags of the resource. + public AzureResource(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary)) { Id = id; Name = name; @@ -54,47 +56,36 @@ public Resource() partial void CustomInit(); /// - /// Gets azure resource Id + /// Gets the resource Id. /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets azure resource name + /// Gets the name of the resource. /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets azure resource type + /// Gets the type of the resource. /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } /// - /// Gets or sets resource location + /// Gets or sets the location of the resource. Since Azure Activity Log + /// Alerts is a global service, the location of the rules should always + /// be 'global'. /// [JsonProperty(PropertyName = "location")] public string Location { get; set; } /// - /// Gets or sets resource tags + /// Gets or sets the tags of the resource. /// [JsonProperty(PropertyName = "tags")] public IDictionary Tags { get; set; } - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Baseline.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Baseline.cs deleted file mode 100644 index 2aefd3ac9a2c3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Baseline.cs +++ /dev/null @@ -1,91 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The baseline values for a single sensitivity value. - /// - public partial class Baseline - { - /// - /// Initializes a new instance of the Baseline class. - /// - public Baseline() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Baseline class. - /// - /// the sensitivity of the baseline. Possible - /// values include: 'Low', 'Medium', 'High' - /// The low thresholds of the - /// baseline. - /// The high thresholds of the - /// baseline. - public Baseline(Sensitivity sensitivity, IList lowThresholds, IList highThresholds) - { - Sensitivity = sensitivity; - LowThresholds = lowThresholds; - HighThresholds = highThresholds; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the sensitivity of the baseline. Possible values - /// include: 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "sensitivity")] - public Sensitivity Sensitivity { get; set; } - - /// - /// Gets or sets the low thresholds of the baseline. - /// - [JsonProperty(PropertyName = "lowThresholds")] - public IList LowThresholds { get; set; } - - /// - /// Gets or sets the high thresholds of the baseline. - /// - [JsonProperty(PropertyName = "highThresholds")] - public IList HighThresholds { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (LowThresholds == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "LowThresholds"); - } - if (HighThresholds == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "HighThresholds"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineMetadata.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineMetadata.cs deleted file mode 100644 index fa234fe8bac1a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineMetadata.cs +++ /dev/null @@ -1,77 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a baseline metadata value. - /// - public partial class BaselineMetadata - { - /// - /// Initializes a new instance of the BaselineMetadata class. - /// - public BaselineMetadata() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the BaselineMetadata class. - /// - /// Name of the baseline metadata. - /// Value of the baseline metadata. - public BaselineMetadata(string name, string value) - { - Name = name; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the baseline metadata. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets value of the baseline metadata. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineMetadataValue.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineMetadataValue.cs deleted file mode 100644 index 637a70d9b84bb..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineMetadataValue.cs +++ /dev/null @@ -1,72 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a baseline metadata value. - /// - public partial class BaselineMetadataValue - { - /// - /// Initializes a new instance of the BaselineMetadataValue class. - /// - public BaselineMetadataValue() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the BaselineMetadataValue class. - /// - /// the name of the metadata. - /// the value of the metadata. - public BaselineMetadataValue(LocalizableString name = default(LocalizableString), string value = default(string)) - { - Name = name; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the metadata. - /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; set; } - - /// - /// Gets or sets the value of the metadata. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name != null) - { - Name.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineResponse.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineResponse.cs deleted file mode 100644 index cb3a7c95483f9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineResponse.cs +++ /dev/null @@ -1,171 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The response to a baseline query. - /// - [Rest.Serialization.JsonTransformation] - public partial class BaselineResponse - { - /// - /// Initializes a new instance of the BaselineResponse class. - /// - public BaselineResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the BaselineResponse class. - /// - /// the metric baseline Id. - /// the resource type of the baseline - /// resource. - /// the name and the display name of the metric, - /// i.e. it is localizable string. - /// The timespan for which the data was - /// retrieved. Its value consists of two datetimes concatenated, - /// separated by '/'. This may be adjusted in the future and returned - /// back from what was originally requested. - /// The interval (window size) for which the - /// metric data was returned in. This may be adjusted in the future - /// and returned back from what was originally requested. This is not - /// present if a metadata request was made. - /// The aggregation type of the - /// metric. - /// the array of timestamps of the - /// baselines. - /// the baseline values for each - /// sensitivity. - /// the baseline metadata values. - public BaselineResponse(string id = default(string), string type = default(string), LocalizableString name = default(LocalizableString), string timespan = default(string), System.TimeSpan? interval = default(System.TimeSpan?), string aggregation = default(string), IList timestamps = default(IList), IList baseline = default(IList), IList metadata = default(IList)) - { - Id = id; - Type = type; - Name = name; - Timespan = timespan; - Interval = interval; - Aggregation = aggregation; - Timestamps = timestamps; - Baseline = baseline; - Metadata = metadata; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the metric baseline Id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the resource type of the baseline resource. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets the name and the display name of the metric, i.e. it is - /// localizable string. - /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; private set; } - - /// - /// Gets or sets the timespan for which the data was retrieved. Its - /// value consists of two datetimes concatenated, separated by '/'. - /// This may be adjusted in the future and returned back from what was - /// originally requested. - /// - [JsonProperty(PropertyName = "properties.timespan")] - public string Timespan { get; set; } - - /// - /// Gets or sets the interval (window size) for which the metric data - /// was returned in. This may be adjusted in the future and returned - /// back from what was originally requested. This is not present if a - /// metadata request was made. - /// - [JsonProperty(PropertyName = "properties.interval")] - public System.TimeSpan? Interval { get; set; } - - /// - /// Gets or sets the aggregation type of the metric. - /// - [JsonProperty(PropertyName = "properties.aggregation")] - public string Aggregation { get; set; } - - /// - /// Gets or sets the array of timestamps of the baselines. - /// - [JsonProperty(PropertyName = "properties.timestamps")] - public IList Timestamps { get; set; } - - /// - /// Gets or sets the baseline values for each sensitivity. - /// - [JsonProperty(PropertyName = "properties.baseline")] - public IList Baseline { get; set; } - - /// - /// Gets or sets the baseline metadata values. - /// - [JsonProperty(PropertyName = "properties.metadata")] - public IList Metadata { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name != null) - { - Name.Validate(); - } - if (Baseline != null) - { - foreach (var element in Baseline) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Metadata != null) - { - foreach (var element1 in Metadata) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineSensitivity.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineSensitivity.cs deleted file mode 100644 index 4170b0895b206..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/BaselineSensitivity.cs +++ /dev/null @@ -1,23 +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.Monitor.Models -{ - - /// - /// Defines values for BaselineSensitivity. - /// - public static class BaselineSensitivity - { - public const string Low = "Low"; - public const string Medium = "Medium"; - public const string High = "High"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/CalculateBaselineResponse.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/CalculateBaselineResponse.cs deleted file mode 100644 index f635318ab02e1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/CalculateBaselineResponse.cs +++ /dev/null @@ -1,100 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The response to a calculate baseline call. - /// - public partial class CalculateBaselineResponse - { - /// - /// Initializes a new instance of the CalculateBaselineResponse class. - /// - public CalculateBaselineResponse() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the CalculateBaselineResponse class. - /// - /// the resource type of the baseline - /// resource. - /// the baseline values for each - /// sensitivity. - /// the array of timestamps of the - /// baselines. - public CalculateBaselineResponse(string type, IList baseline, IList timestamps = default(IList)) - { - Type = type; - Timestamps = timestamps; - Baseline = baseline; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource type of the baseline resource. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the array of timestamps of the baselines. - /// - [JsonProperty(PropertyName = "timestamps")] - public IList Timestamps { get; set; } - - /// - /// Gets or sets the baseline values for each sensitivity. - /// - [JsonProperty(PropertyName = "baseline")] - public IList Baseline { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Type == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); - } - if (Baseline == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Baseline"); - } - if (Baseline != null) - { - foreach (var element in Baseline) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/CategoryType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/CategoryType.cs deleted file mode 100644 index ffd36dc58673f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/CategoryType.cs +++ /dev/null @@ -1,60 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for CategoryType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum CategoryType - { - [EnumMember(Value = "Metrics")] - Metrics, - [EnumMember(Value = "Logs")] - Logs - } - internal static class CategoryTypeEnumExtension - { - internal static string ToSerializedValue(this CategoryType? value) - { - return value == null ? null : ((CategoryType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this CategoryType value) - { - switch( value ) - { - case CategoryType.Metrics: - return "Metrics"; - case CategoryType.Logs: - return "Logs"; - } - return null; - } - - internal static CategoryType? ParseCategoryType(this string value) - { - switch( value ) - { - case "Metrics": - return CategoryType.Metrics; - case "Logs": - return CategoryType.Logs; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ComparisonOperationType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ComparisonOperationType.cs deleted file mode 100644 index 7c4846aeb1f26..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ComparisonOperationType.cs +++ /dev/null @@ -1,84 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ComparisonOperationType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ComparisonOperationType - { - [EnumMember(Value = "Equals")] - Equals, - [EnumMember(Value = "NotEquals")] - NotEquals, - [EnumMember(Value = "GreaterThan")] - GreaterThan, - [EnumMember(Value = "GreaterThanOrEqual")] - GreaterThanOrEqual, - [EnumMember(Value = "LessThan")] - LessThan, - [EnumMember(Value = "LessThanOrEqual")] - LessThanOrEqual - } - internal static class ComparisonOperationTypeEnumExtension - { - internal static string ToSerializedValue(this ComparisonOperationType? value) - { - return value == null ? null : ((ComparisonOperationType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ComparisonOperationType value) - { - switch( value ) - { - case ComparisonOperationType.Equals: - return "Equals"; - case ComparisonOperationType.NotEquals: - return "NotEquals"; - case ComparisonOperationType.GreaterThan: - return "GreaterThan"; - case ComparisonOperationType.GreaterThanOrEqual: - return "GreaterThanOrEqual"; - case ComparisonOperationType.LessThan: - return "LessThan"; - case ComparisonOperationType.LessThanOrEqual: - return "LessThanOrEqual"; - } - return null; - } - - internal static ComparisonOperationType? ParseComparisonOperationType(this string value) - { - switch( value ) - { - case "Equals": - return ComparisonOperationType.Equals; - case "NotEquals": - return ComparisonOperationType.NotEquals; - case "GreaterThan": - return ComparisonOperationType.GreaterThan; - case "GreaterThanOrEqual": - return ComparisonOperationType.GreaterThanOrEqual; - case "LessThan": - return ComparisonOperationType.LessThan; - case "LessThanOrEqual": - return ComparisonOperationType.LessThanOrEqual; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ConditionOperator.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ConditionOperator.cs deleted file mode 100644 index 7b4003f6cb1d2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ConditionOperator.cs +++ /dev/null @@ -1,72 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ConditionOperator. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ConditionOperator - { - [EnumMember(Value = "GreaterThan")] - GreaterThan, - [EnumMember(Value = "GreaterThanOrEqual")] - GreaterThanOrEqual, - [EnumMember(Value = "LessThan")] - LessThan, - [EnumMember(Value = "LessThanOrEqual")] - LessThanOrEqual - } - internal static class ConditionOperatorEnumExtension - { - internal static string ToSerializedValue(this ConditionOperator? value) - { - return value == null ? null : ((ConditionOperator)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ConditionOperator value) - { - switch( value ) - { - case ConditionOperator.GreaterThan: - return "GreaterThan"; - case ConditionOperator.GreaterThanOrEqual: - return "GreaterThanOrEqual"; - case ConditionOperator.LessThan: - return "LessThan"; - case ConditionOperator.LessThanOrEqual: - return "LessThanOrEqual"; - } - return null; - } - - internal static ConditionOperator? ParseConditionOperator(this string value) - { - switch( value ) - { - case "GreaterThan": - return ConditionOperator.GreaterThan; - case "GreaterThanOrEqual": - return ConditionOperator.GreaterThanOrEqual; - case "LessThan": - return ConditionOperator.LessThan; - case "LessThanOrEqual": - return ConditionOperator.LessThanOrEqual; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ConditionalOperator.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ConditionalOperator.cs deleted file mode 100644 index 98d5f8fd2d69a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ConditionalOperator.cs +++ /dev/null @@ -1,23 +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.Monitor.Models -{ - - /// - /// Defines values for ConditionalOperator. - /// - public static class ConditionalOperator - { - public const string GreaterThan = "GreaterThan"; - public const string LessThan = "LessThan"; - public const string Equal = "Equal"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Criteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Criteria.cs deleted file mode 100644 index 3de19395bf714..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Criteria.cs +++ /dev/null @@ -1,86 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the criteria for converting log to metric. - /// - public partial class Criteria - { - /// - /// Initializes a new instance of the Criteria class. - /// - public Criteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Criteria class. - /// - /// Name of the metric - /// List of Dimensions for creating - /// metric - public Criteria(string metricName, IList dimensions = default(IList)) - { - MetricName = metricName; - Dimensions = dimensions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the metric - /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } - - /// - /// Gets or sets list of Dimensions for creating metric - /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (MetricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); - } - if (Dimensions != null) - { - foreach (var element in Dimensions) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs deleted file mode 100644 index 96789654534da..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleAssociationProxyOnlyResource.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - - /// - /// Definition of generic ARM proxy resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class DataCollectionRuleAssociationProxyOnlyResource : ProxyOnlyResource - { - /// - /// Initializes a new instance of the - /// DataCollectionRuleAssociationProxyOnlyResource class. - /// - public DataCollectionRuleAssociationProxyOnlyResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DataCollectionRuleAssociationProxyOnlyResource class. - /// - /// The resource ID of the data - /// collection rule that is to be associated. - /// Description of the association. - /// The resource provisioning state. - /// Possible values include: 'Creating', 'Updating', 'Deleting', - /// 'Succeeded', 'Failed' - /// Fully qualified ID of the resource. - /// The name of the resource. - /// The type of the resource. - /// Resource entity tag (ETag). - public DataCollectionRuleAssociationProxyOnlyResource(string dataCollectionRuleId, string description = default(string), string provisioningState = default(string), string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) - : base(id, name, type) - { - Description = description; - DataCollectionRuleId = dataCollectionRuleId; - ProvisioningState = provisioningState; - Etag = etag; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets description of the association. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the resource ID of the data collection rule that is to - /// be associated. - /// - [JsonProperty(PropertyName = "properties.dataCollectionRuleId")] - public string DataCollectionRuleId { get; set; } - - /// - /// Gets the resource provisioning state. Possible values include: - /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets resource entity tag (ETag). - /// - [JsonProperty(PropertyName = "etag")] - public string Etag { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DataCollectionRuleId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DataCollectionRuleId"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs deleted file mode 100644 index a8f31f4b717d3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDataSources.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The specification of data sources. - /// This property is optional and can be omitted if the rule is meant to be - /// used via direct calls to the provisioned endpoint. - /// - public partial class DataCollectionRuleDataSources : DataSourcesSpec - { - /// - /// Initializes a new instance of the DataCollectionRuleDataSources - /// class. - /// - public DataCollectionRuleDataSources() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataCollectionRuleDataSources - /// class. - /// - /// The list of performance counter - /// data source configurations. - /// The list of Windows Event Log data - /// source configurations. - /// The list of Syslog data source - /// configurations. - /// The list of Azure VM extension data source - /// configurations. - public DataCollectionRuleDataSources(IList performanceCounters = default(IList), IList windowsEventLogs = default(IList), IList syslog = default(IList), IList extensions = default(IList)) - : base(performanceCounters, windowsEventLogs, syslog, extensions) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs deleted file mode 100644 index 99cb30cf99024..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleDestinations.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The specification of destinations. - /// - public partial class DataCollectionRuleDestinations : DestinationsSpec - { - /// - /// Initializes a new instance of the DataCollectionRuleDestinations - /// class. - /// - public DataCollectionRuleDestinations() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataCollectionRuleDestinations - /// class. - /// - /// List of Log Analytics - /// destinations. - /// Azure Monitor Metrics - /// destination. - public DataCollectionRuleDestinations(IList logAnalytics = default(IList), DestinationsSpecAzureMonitorMetrics azureMonitorMetrics = default(DestinationsSpecAzureMonitorMetrics)) - : base(logAnalytics, azureMonitorMetrics) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs deleted file mode 100644 index 4d31b6a37da8b..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataCollectionRuleResource.cs +++ /dev/null @@ -1,139 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections.Generic; - - /// - /// Definition of ARM tracked top level resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class DataCollectionRuleResource : Resource - { - /// - /// Initializes a new instance of the DataCollectionRuleResource class. - /// - public DataCollectionRuleResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataCollectionRuleResource class. - /// - /// The specification of - /// destinations. - /// The specification of data flows. - /// The geo-location where the resource - /// lives. - /// Description of the data collection - /// rule. - /// The specification of data sources. - /// This property is optional and can be omitted if the rule is meant - /// to be used via direct calls to the provisioned endpoint. - /// The resource provisioning state. - /// Possible values include: 'Creating', 'Updating', 'Deleting', - /// 'Succeeded', 'Failed' - /// Resource tags. - /// Fully qualified ID of the resource. - /// The name of the resource. - /// The type of the resource. - /// Resource entity tag (ETag). - public DataCollectionRuleResource(DataCollectionRuleDestinations destinations, IList dataFlows, string location, string description = default(string), DataCollectionRuleDataSources dataSources = default(DataCollectionRuleDataSources), string provisioningState = default(string), IDictionary tags = default(IDictionary), string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) - : base(location, id, name, type, tags) - { - Description = description; - DataSources = dataSources; - Destinations = destinations; - DataFlows = dataFlows; - ProvisioningState = provisioningState; - Location = location; - Etag = etag; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets description of the data collection rule. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the specification of data sources. - /// This property is optional and can be omitted if the rule is meant - /// to be used via direct calls to the provisioned endpoint. - /// - [JsonProperty(PropertyName = "properties.dataSources")] - public DataCollectionRuleDataSources DataSources { get; set; } - - /// - /// Gets or sets the specification of destinations. - /// - [JsonProperty(PropertyName = "properties.destinations")] - public DataCollectionRuleDestinations Destinations { get; set; } - - /// - /// Gets or sets the specification of data flows. - /// - [JsonProperty(PropertyName = "properties.dataFlows")] - public IList DataFlows { get; set; } - - /// - /// Gets the resource provisioning state. Possible values include: - /// 'Creating', 'Updating', 'Deleting', 'Succeeded', 'Failed' - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets resource entity tag (ETag). - /// - [JsonProperty(PropertyName = "etag")] - public string Etag { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - - if (Destinations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Destinations"); - } - if (DataFlows == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DataFlows"); - } - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - if (DataFlows != null) - { - foreach (var element in DataFlows) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataContainer.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataContainer.cs deleted file mode 100644 index 07151405661a8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataContainer.cs +++ /dev/null @@ -1,70 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Information about a container with data for a given resource. - /// - public partial class DataContainer - { - /// - /// Initializes a new instance of the DataContainer class. - /// - public DataContainer() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataContainer class. - /// - /// Log Analytics workspace - /// information. - public DataContainer(WorkspaceInfo workspace) - { - Workspace = workspace; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets log Analytics workspace information. - /// - [JsonProperty(PropertyName = "workspace")] - public WorkspaceInfo Workspace { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Workspace == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Workspace"); - } - if (Workspace != null) - { - Workspace.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs deleted file mode 100644 index 9415dd42828af..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataFlow.cs +++ /dev/null @@ -1,76 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of which streams are sent to which destinations. - /// - public partial class DataFlow - { - /// - /// Initializes a new instance of the DataFlow class. - /// - public DataFlow() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataFlow class. - /// - /// List of streams for this data flow. - /// List of destinations for this data - /// flow. - public DataFlow(IList streams, IList destinations) - { - Streams = streams; - Destinations = destinations; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of streams for this data flow. - /// - [JsonProperty(PropertyName = "streams")] - public IList Streams { get; set; } - - /// - /// Gets or sets list of destinations for this data flow. - /// - [JsonProperty(PropertyName = "destinations")] - public IList Destinations { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Streams == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); - } - if (Destinations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Destinations"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs deleted file mode 100644 index f66eda00cfff0..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataSourcesSpec.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specification of data sources that will be collected. - /// - public partial class DataSourcesSpec - { - /// - /// Initializes a new instance of the DataSourcesSpec class. - /// - public DataSourcesSpec() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DataSourcesSpec class. - /// - /// The list of performance counter - /// data source configurations. - /// The list of Windows Event Log data - /// source configurations. - /// The list of Syslog data source - /// configurations. - /// The list of Azure VM extension data source - /// configurations. - public DataSourcesSpec(IList performanceCounters = default(IList), IList windowsEventLogs = default(IList), IList syslog = default(IList), IList extensions = default(IList)) - { - PerformanceCounters = performanceCounters; - WindowsEventLogs = windowsEventLogs; - Syslog = syslog; - Extensions = extensions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of performance counter data source - /// configurations. - /// - [JsonProperty(PropertyName = "performanceCounters")] - public IList PerformanceCounters { get; set; } - - /// - /// Gets or sets the list of Windows Event Log data source - /// configurations. - /// - [JsonProperty(PropertyName = "windowsEventLogs")] - public IList WindowsEventLogs { get; set; } - - /// - /// Gets or sets the list of Syslog data source configurations. - /// - [JsonProperty(PropertyName = "syslog")] - public IList Syslog { get; set; } - - /// - /// Gets or sets the list of Azure VM extension data source - /// configurations. - /// - [JsonProperty(PropertyName = "extensions")] - public IList Extensions { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataStatus.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataStatus.cs deleted file mode 100644 index 98b6052b4a7c5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DataStatus.cs +++ /dev/null @@ -1,22 +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.Monitor.Models -{ - - /// - /// Defines values for DataStatus. - /// - public static class DataStatus - { - public const string Present = "present"; - public const string NotPresent = "notPresent"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs deleted file mode 100644 index 5288b0fb67ecb..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpec.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specification of destinations that can be used in data flows. - /// - public partial class DestinationsSpec - { - /// - /// Initializes a new instance of the DestinationsSpec class. - /// - public DestinationsSpec() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DestinationsSpec class. - /// - /// List of Log Analytics - /// destinations. - /// Azure Monitor Metrics - /// destination. - public DestinationsSpec(IList logAnalytics = default(IList), DestinationsSpecAzureMonitorMetrics azureMonitorMetrics = default(DestinationsSpecAzureMonitorMetrics)) - { - LogAnalytics = logAnalytics; - AzureMonitorMetrics = azureMonitorMetrics; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of Log Analytics destinations. - /// - [JsonProperty(PropertyName = "logAnalytics")] - public IList LogAnalytics { get; set; } - - /// - /// Gets or sets azure Monitor Metrics destination. - /// - [JsonProperty(PropertyName = "azureMonitorMetrics")] - public DestinationsSpecAzureMonitorMetrics AzureMonitorMetrics { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs deleted file mode 100644 index 93d723887d24e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DestinationsSpecAzureMonitorMetrics.cs +++ /dev/null @@ -1,54 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using System.Linq; - - /// - /// Azure Monitor Metrics destination. - /// - public partial class DestinationsSpecAzureMonitorMetrics : AzureMonitorMetricsDestination - { - /// - /// Initializes a new instance of the - /// DestinationsSpecAzureMonitorMetrics class. - /// - public DestinationsSpecAzureMonitorMetrics() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DestinationsSpecAzureMonitorMetrics class. - /// - /// A friendly name for the destination. - /// This name should be unique across all destinations (regardless of - /// type) within the data collection rule. - public DestinationsSpecAzureMonitorMetrics(string name) - : base(name) - { - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsCategoryResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsCategoryResource.cs deleted file mode 100644 index 3f4fa9680901c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsCategoryResource.cs +++ /dev/null @@ -1,62 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The diagnostic settings category resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class DiagnosticSettingsCategoryResource : ProxyOnlyResource - { - /// - /// Initializes a new instance of the - /// DiagnosticSettingsCategoryResource class. - /// - public DiagnosticSettingsCategoryResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DiagnosticSettingsCategoryResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// The type of the diagnostic settings - /// category. Possible values include: 'Metrics', 'Logs' - public DiagnosticSettingsCategoryResource(string id = default(string), string name = default(string), string type = default(string), CategoryType categoryType = default(CategoryType)) - : base(id, name, type) - { - CategoryType = categoryType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the type of the diagnostic settings category. Possible - /// values include: 'Metrics', 'Logs' - /// - [JsonProperty(PropertyName = "properties.categoryType")] - public CategoryType CategoryType { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsCategoryResourceCollection.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsCategoryResourceCollection.cs deleted file mode 100644 index 8da998542cca9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsCategoryResourceCollection.cs +++ /dev/null @@ -1,57 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a collection of diagnostic setting category resources. - /// - public partial class DiagnosticSettingsCategoryResourceCollection - { - /// - /// Initializes a new instance of the - /// DiagnosticSettingsCategoryResourceCollection class. - /// - public DiagnosticSettingsCategoryResourceCollection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DiagnosticSettingsCategoryResourceCollection class. - /// - /// The collection of diagnostic settings category - /// resources. - public DiagnosticSettingsCategoryResourceCollection(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the collection of diagnostic settings category - /// resources. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsResource.cs deleted file mode 100644 index cacc1ef47e8ef..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsResource.cs +++ /dev/null @@ -1,139 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The diagnostic setting resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class DiagnosticSettingsResource : ProxyOnlyResource - { - /// - /// Initializes a new instance of the DiagnosticSettingsResource class. - /// - public DiagnosticSettingsResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DiagnosticSettingsResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// The resource ID of the storage - /// account to which you would like to send Diagnostic Logs. - /// The service bus rule Id of the - /// diagnostic setting. This is here to maintain backwards - /// compatibility. - /// The resource Id for the - /// event hub authorization rule. - /// The name of the event hub. If none is - /// specified, the default event hub will be selected. - /// The list of metric settings. - /// The list of logs settings. - /// The full ARM resource ID of the Log - /// Analytics workspace to which you would like to send Diagnostic - /// Logs. Example: - /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - /// A string indicating - /// whether the export to Log Analytics should use the default - /// destination type, i.e. AzureDiagnostics, or use a destination type - /// constructed as follows: <normalized service - /// identity>_<normalized category name>. Possible values are: - /// Dedicated and null (null is default.) - public DiagnosticSettingsResource(string id = default(string), string name = default(string), string type = default(string), string storageAccountId = default(string), string serviceBusRuleId = default(string), string eventHubAuthorizationRuleId = default(string), string eventHubName = default(string), IList metrics = default(IList), IList logs = default(IList), string workspaceId = default(string), string logAnalyticsDestinationType = default(string)) - : base(id, name, type) - { - StorageAccountId = storageAccountId; - ServiceBusRuleId = serviceBusRuleId; - EventHubAuthorizationRuleId = eventHubAuthorizationRuleId; - EventHubName = eventHubName; - Metrics = metrics; - Logs = logs; - WorkspaceId = workspaceId; - LogAnalyticsDestinationType = logAnalyticsDestinationType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource ID of the storage account to which you - /// would like to send Diagnostic Logs. - /// - [JsonProperty(PropertyName = "properties.storageAccountId")] - public string StorageAccountId { get; set; } - - /// - /// Gets or sets the service bus rule Id of the diagnostic setting. - /// This is here to maintain backwards compatibility. - /// - [JsonProperty(PropertyName = "properties.serviceBusRuleId")] - public string ServiceBusRuleId { get; set; } - - /// - /// Gets or sets the resource Id for the event hub authorization rule. - /// - [JsonProperty(PropertyName = "properties.eventHubAuthorizationRuleId")] - public string EventHubAuthorizationRuleId { get; set; } - - /// - /// Gets or sets the name of the event hub. If none is specified, the - /// default event hub will be selected. - /// - [JsonProperty(PropertyName = "properties.eventHubName")] - public string EventHubName { get; set; } - - /// - /// Gets or sets the list of metric settings. - /// - [JsonProperty(PropertyName = "properties.metrics")] - public IList Metrics { get; set; } - - /// - /// Gets or sets the list of logs settings. - /// - [JsonProperty(PropertyName = "properties.logs")] - public IList Logs { get; set; } - - /// - /// Gets or sets the full ARM resource ID of the Log Analytics - /// workspace to which you would like to send Diagnostic Logs. Example: - /// /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - /// - [JsonProperty(PropertyName = "properties.workspaceId")] - public string WorkspaceId { get; set; } - - /// - /// Gets or sets a string indicating whether the export to Log - /// Analytics should use the default destination type, i.e. - /// AzureDiagnostics, or use a destination type constructed as follows: - /// &lt;normalized service identity&gt;_&lt;normalized - /// category name&gt;. Possible values are: Dedicated and null - /// (null is default.) - /// - [JsonProperty(PropertyName = "properties.logAnalyticsDestinationType")] - public string LogAnalyticsDestinationType { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsResourceCollection.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsResourceCollection.cs deleted file mode 100644 index 2ee813f374061..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DiagnosticSettingsResourceCollection.cs +++ /dev/null @@ -1,56 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a collection of alert rule resources. - /// - public partial class DiagnosticSettingsResourceCollection - { - /// - /// Initializes a new instance of the - /// DiagnosticSettingsResourceCollection class. - /// - public DiagnosticSettingsResourceCollection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// DiagnosticSettingsResourceCollection class. - /// - /// The collection of diagnostic settings - /// resources;. - public DiagnosticSettingsResourceCollection(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the collection of diagnostic settings resources;. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Dimension.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Dimension.cs deleted file mode 100644 index 239257fa94d4f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Dimension.cs +++ /dev/null @@ -1,92 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the criteria for converting log to metric. - /// - public partial class Dimension - { - /// - /// Initializes a new instance of the Dimension class. - /// - public Dimension() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Dimension class. - /// - /// Name of the dimension - /// List of dimension values - public Dimension(string name, IList values) - { - Name = name; - Values = values; - CustomInit(); - } - /// - /// Static constructor for Dimension class. - /// - static Dimension() - { - OperatorProperty = "Include"; - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the dimension - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets list of dimension values - /// - [JsonProperty(PropertyName = "values")] - public IList Values { get; set; } - - /// - /// Operator for dimension values - /// - [JsonProperty(PropertyName = "operator")] - public static string OperatorProperty { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Values == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Values"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicMetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicMetricCriteria.cs deleted file mode 100644 index 7b8099392e660..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicMetricCriteria.cs +++ /dev/null @@ -1,133 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Criterion for dynamic threshold. - /// - [Newtonsoft.Json.JsonObject("DynamicThresholdCriterion")] - public partial class DynamicMetricCriteria : MultiMetricCriteria - { - /// - /// Initializes a new instance of the DynamicMetricCriteria class. - /// - public DynamicMetricCriteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DynamicMetricCriteria class. - /// - /// Name of the criteria. - /// Name of the metric. - /// the criteria time aggregation - /// types. - /// The operator used to compare the - /// metric value against the threshold. Possible values include: - /// 'GreaterThan', 'LessThan', 'GreaterOrLessThan' - /// The extent of deviation required to - /// trigger an alert. This will affect how tight the threshold is to - /// the metric series pattern. Possible values include: 'Low', - /// 'Medium', 'High' - /// The minimum number of violations - /// required within the selected lookback time window required to raise - /// an alert. - /// Unmatched properties from the - /// message are deserialized this collection - /// Namespace of the metric. - /// List of dimension conditions. - /// Allows creating an alert rule on - /// a custom metric that isn't yet emitted, by causing the metric - /// validation to be skipped. - /// Use this option to set the date from - /// which to start learning the metric historical data and calculate - /// the dynamic thresholds (in ISO8601 format) - public DynamicMetricCriteria(string name, string metricName, object timeAggregation, string operatorProperty, string alertSensitivity, DynamicThresholdFailingPeriods failingPeriods, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?), System.DateTime? ignoreDataBefore = default(System.DateTime?)) - : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions, skipMetricValidation) - { - OperatorProperty = operatorProperty; - AlertSensitivity = alertSensitivity; - FailingPeriods = failingPeriods; - IgnoreDataBefore = ignoreDataBefore; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the operator used to compare the metric value against - /// the threshold. Possible values include: 'GreaterThan', 'LessThan', - /// 'GreaterOrLessThan' - /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } - - /// - /// Gets or sets the extent of deviation required to trigger an alert. - /// This will affect how tight the threshold is to the metric series - /// pattern. Possible values include: 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "alertSensitivity")] - public string AlertSensitivity { get; set; } - - /// - /// Gets or sets the minimum number of violations required within the - /// selected lookback time window required to raise an alert. - /// - [JsonProperty(PropertyName = "failingPeriods")] - public DynamicThresholdFailingPeriods FailingPeriods { get; set; } - - /// - /// Gets or sets use this option to set the date from which to start - /// learning the metric historical data and calculate the dynamic - /// thresholds (in ISO8601 format) - /// - [JsonProperty(PropertyName = "ignoreDataBefore")] - public System.DateTime? IgnoreDataBefore { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (OperatorProperty == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); - } - if (AlertSensitivity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "AlertSensitivity"); - } - if (FailingPeriods == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FailingPeriods"); - } - if (FailingPeriods != null) - { - FailingPeriods.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdFailingPeriods.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdFailingPeriods.cs deleted file mode 100644 index 013569f048c5e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdFailingPeriods.cs +++ /dev/null @@ -1,80 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The minimum number of violations required within the selected lookback - /// time window required to raise an alert. - /// - public partial class DynamicThresholdFailingPeriods - { - /// - /// Initializes a new instance of the DynamicThresholdFailingPeriods - /// class. - /// - public DynamicThresholdFailingPeriods() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the DynamicThresholdFailingPeriods - /// class. - /// - /// The number of aggregated - /// lookback points. The lookback time window is calculated based on - /// the aggregation granularity (windowSize) and the selected number of - /// aggregated points. - /// The number of violations to - /// trigger an alert. Should be smaller or equal to - /// numberOfEvaluationPeriods. - public DynamicThresholdFailingPeriods(double numberOfEvaluationPeriods, double minFailingPeriodsToAlert) - { - NumberOfEvaluationPeriods = numberOfEvaluationPeriods; - MinFailingPeriodsToAlert = minFailingPeriodsToAlert; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the number of aggregated lookback points. The lookback - /// time window is calculated based on the aggregation granularity - /// (windowSize) and the selected number of aggregated points. - /// - [JsonProperty(PropertyName = "numberOfEvaluationPeriods")] - public double NumberOfEvaluationPeriods { get; set; } - - /// - /// Gets or sets the number of violations to trigger an alert. Should - /// be smaller or equal to numberOfEvaluationPeriods. - /// - [JsonProperty(PropertyName = "minFailingPeriodsToAlert")] - public double MinFailingPeriodsToAlert { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdOperator.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdOperator.cs deleted file mode 100644 index a887196950aee..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdOperator.cs +++ /dev/null @@ -1,23 +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.Monitor.Models -{ - - /// - /// Defines values for DynamicThresholdOperator. - /// - public static class DynamicThresholdOperator - { - public const string GreaterThan = "GreaterThan"; - public const string LessThan = "LessThan"; - public const string GreaterOrLessThan = "GreaterOrLessThan"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdSensitivity.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdSensitivity.cs deleted file mode 100644 index 1b8751ab78b3e..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/DynamicThresholdSensitivity.cs +++ /dev/null @@ -1,23 +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.Monitor.Models -{ - - /// - /// Defines values for DynamicThresholdSensitivity. - /// - public static class DynamicThresholdSensitivity - { - public const string Low = "Low"; - public const string Medium = "Medium"; - public const string High = "High"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EmailNotification.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EmailNotification.cs deleted file mode 100644 index ba475ecb62f27..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EmailNotification.cs +++ /dev/null @@ -1,76 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Email notification of an autoscale event. - /// - public partial class EmailNotification - { - /// - /// Initializes a new instance of the EmailNotification class. - /// - public EmailNotification() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EmailNotification class. - /// - /// a value indicating - /// whether to send email to subscription administrator. - /// a value indicating - /// whether to send email to subscription co-administrators. - /// the custom e-mails list. This value can - /// be null or empty, in which case this attribute will be - /// ignored. - public EmailNotification(bool? sendToSubscriptionAdministrator = default(bool?), bool? sendToSubscriptionCoAdministrators = default(bool?), IList customEmails = default(IList)) - { - SendToSubscriptionAdministrator = sendToSubscriptionAdministrator; - SendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators; - CustomEmails = customEmails; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a value indicating whether to send email to - /// subscription administrator. - /// - [JsonProperty(PropertyName = "sendToSubscriptionAdministrator")] - public bool? SendToSubscriptionAdministrator { get; set; } - - /// - /// Gets or sets a value indicating whether to send email to - /// subscription co-administrators. - /// - [JsonProperty(PropertyName = "sendToSubscriptionCoAdministrators")] - public bool? SendToSubscriptionCoAdministrators { get; set; } - - /// - /// Gets or sets the custom e-mails list. This value can be null or - /// empty, in which case this attribute will be ignored. - /// - [JsonProperty(PropertyName = "customEmails")] - public IList CustomEmails { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EmailReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EmailReceiver.cs deleted file mode 100644 index edd022c9f92f1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EmailReceiver.cs +++ /dev/null @@ -1,99 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An email receiver. - /// - public partial class EmailReceiver - { - /// - /// Initializes a new instance of the EmailReceiver class. - /// - public EmailReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EmailReceiver class. - /// - /// The name of the email receiver. Names must be - /// unique across all receivers within an action group. - /// The email address of this - /// receiver. - /// Indicates whether to use common - /// alert schema. - /// The receiver status of the e-mail. Possible - /// values include: 'NotSpecified', 'Enabled', 'Disabled' - public EmailReceiver(string name, string emailAddress, bool useCommonAlertSchema, ReceiverStatus? status = default(ReceiverStatus?)) - { - Name = name; - EmailAddress = emailAddress; - UseCommonAlertSchema = useCommonAlertSchema; - Status = status; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the email receiver. Names must be unique - /// across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the email address of this receiver. - /// - [JsonProperty(PropertyName = "emailAddress")] - public string EmailAddress { get; set; } - - /// - /// Gets or sets indicates whether to use common alert schema. - /// - [JsonProperty(PropertyName = "useCommonAlertSchema")] - public bool UseCommonAlertSchema { get; set; } - - /// - /// Gets the receiver status of the e-mail. Possible values include: - /// 'NotSpecified', 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "status")] - public ReceiverStatus? Status { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (EmailAddress == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "EmailAddress"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EnableRequest.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EnableRequest.cs deleted file mode 100644 index 8eccdf87f2fea..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EnableRequest.cs +++ /dev/null @@ -1,66 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Describes a receiver that should be resubscribed. - /// - public partial class EnableRequest - { - /// - /// Initializes a new instance of the EnableRequest class. - /// - public EnableRequest() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EnableRequest class. - /// - /// The name of the receiver to - /// resubscribe. - public EnableRequest(string receiverName) - { - ReceiverName = receiverName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the receiver to resubscribe. - /// - [JsonProperty(PropertyName = "receiverName")] - public string ReceiverName { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ReceiverName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ReceiverName"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Enabled.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Enabled.cs deleted file mode 100644 index 6620ddddeea62..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Enabled.cs +++ /dev/null @@ -1,22 +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.Monitor.Models -{ - - /// - /// Defines values for Enabled. - /// - public static class Enabled - { - public const string True = "true"; - public const string False = "false"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Error.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Error.cs deleted file mode 100644 index 3f7d8a71c50ff..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Error.cs +++ /dev/null @@ -1,74 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Error details. - /// - public partial class Error - { - /// - /// Initializes a new instance of the Error class. - /// - public Error() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Error class. - /// - /// Error code identifying the specific - /// error. - /// Error message in the caller's locale. - public Error(string code, string message = default(string)) - { - Code = code; - Message = message; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets error code identifying the specific error. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; set; } - - /// - /// Gets or sets error message in the caller's locale. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Code == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Code"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorAdditionalInfo.cs deleted file mode 100644 index 05bf1fbd6ec39..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorAdditionalInfo.cs +++ /dev/null @@ -1,59 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The resource management error additional info. - /// - public partial class ErrorAdditionalInfo - { - /// - /// Initializes a new instance of the ErrorAdditionalInfo class. - /// - public ErrorAdditionalInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorAdditionalInfo class. - /// - /// The additional info type. - /// The additional info. - public ErrorAdditionalInfo(string type = default(string), object info = default(object)) - { - Type = type; - Info = info; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the additional info type. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets the additional info. - /// - [JsonProperty(PropertyName = "info")] - public object Info { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponse.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponse.cs index 2f93fbb9e2473..3bf23b1b08fe2 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponse.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponse.cs @@ -14,7 +14,7 @@ namespace Microsoft.Azure.Management.Monitor.Models using System.Linq; /// - /// Describes the format of Error response. + /// The error response. /// public partial class ErrorResponse { @@ -29,9 +29,9 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// Error code - /// Error message indicating why the operation - /// failed. + /// The error code. + /// The error message indicating why the + /// operation failed. public ErrorResponse(string code = default(string), string message = default(string)) { Code = code; @@ -45,16 +45,16 @@ public ErrorResponse() partial void CustomInit(); /// - /// Gets or sets error code + /// Gets the error code. /// [JsonProperty(PropertyName = "code")] - public string Code { get; set; } + public string Code { get; private set; } /// - /// Gets or sets error message indicating why the operation failed. + /// Gets the error message indicating why the operation failed. /// [JsonProperty(PropertyName = "message")] - public string Message { get; set; } + public string Message { get; private set; } } } diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommon.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommon.cs deleted file mode 100644 index 03e89dfa4cbc1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommon.cs +++ /dev/null @@ -1,65 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The resource management error response. - /// - public partial class ErrorResponseCommon : ErrorResponse - { - /// - /// Initializes a new instance of the ErrorResponseCommon class. - /// - public ErrorResponseCommon() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorResponseCommon class. - /// - /// Error code - /// Error message indicating why the operation - /// failed. - /// The error details. - /// The error additional info. - public ErrorResponseCommon(string code = default(string), string message = default(string), IList details = default(IList), IList additionalInfo = default(IList)) - : base(code, message) - { - Details = details; - AdditionalInfo = additionalInfo; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the error details. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; private set; } - - /// - /// Gets the error additional info. - /// - [JsonProperty(PropertyName = "additionalInfo")] - public IList AdditionalInfo { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommonException.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommonException.cs deleted file mode 100644 index f68f9794927a1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ErrorResponseCommonException.cs +++ /dev/null @@ -1,62 +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.Monitor.Models -{ - using Microsoft.Rest; - - /// - /// Exception thrown for an invalid response with ErrorResponseCommon - /// information. - /// - public partial class ErrorResponseCommonException : RestException - { - /// - /// Gets information about the associated HTTP request. - /// - public HttpRequestMessageWrapper Request { get; set; } - - /// - /// Gets information about the associated HTTP response. - /// - public HttpResponseMessageWrapper Response { get; set; } - - /// - /// Gets or sets the body object. - /// - public ErrorResponseCommon Body { get; set; } - - /// - /// Initializes a new instance of the ErrorResponseCommonException class. - /// - public ErrorResponseCommonException() - { - } - - /// - /// Initializes a new instance of the ErrorResponseCommonException class. - /// - /// The exception message. - public ErrorResponseCommonException(string message) - : this(message, null) - { - } - - /// - /// Initializes a new instance of the ErrorResponseCommonException class. - /// - /// The exception message. - /// Inner exception. - public ErrorResponseCommonException(string message, System.Exception innerException) - : base(message, innerException) - { - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EventData.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EventData.cs deleted file mode 100644 index 91dc9e9d304de..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EventData.cs +++ /dev/null @@ -1,339 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The Azure event log entries are of type EventData - /// - public partial class EventData - { - /// - /// Initializes a new instance of the EventData class. - /// - public EventData() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the EventData class. - /// - /// The sender authorization - /// information. - /// key value pairs to identify ARM - /// permissions. - /// the email address of the user who has - /// performed the operation, the UPN claim or SPN claim based on - /// availability. - /// the description of the event. - /// the Id of this event as required by ARM for RBAC. - /// It contains the EventDataID and a timestamp information. - /// the event data Id. This is a unique - /// identifier for an event. - /// the correlation Id, usually a GUID in - /// the string format. The correlation Id is shared among the events - /// that belong to the same uber operation. - /// the event name. This value should not be - /// confused with OperationName. For practical purposes, OperationName - /// might be more appealing to end users. - /// the event category. - /// the HTTP request info. Usually includes - /// the 'clientRequestId', 'clientIpAddress' (IP address of the user - /// who initiated the event) and 'method' (HTTP method e.g. - /// PUT). - /// the event level. Possible values include: - /// 'Critical', 'Error', 'Warning', 'Informational', 'Verbose' - /// the resource group name of the - /// impacted resource. - /// the resource provider name of - /// the impacted resource. - /// the resource uri that uniquely identifies - /// the resource that caused this event. - /// the resource type - /// It is usually a GUID shared among the - /// events corresponding to single operation. This value should not be - /// confused with EventName. - /// the operation name. - /// the set of <Key, Value> pairs - /// (usually a Dictionary<String, String>) that includes details - /// about the event. - /// a string describing the status of the - /// operation. Some typical values are: Started, In progress, - /// Succeeded, Failed, Resolved. - /// the event sub status. Most of the time, - /// when included, this captures the HTTP status code of the REST call. - /// Common values are: OK (HTTP Status Code: 200), Created (HTTP Status - /// Code: 201), Accepted (HTTP Status Code: 202), No Content (HTTP - /// Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found - /// (HTTP Status Code: 404), Conflict (HTTP Status Code: 409), Internal - /// Server Error (HTTP Status Code: 500), Service Unavailable (HTTP - /// Status Code:503), Gateway Timeout (HTTP Status Code: 504) - /// the timestamp of when the event was - /// generated by the Azure service processing the request corresponding - /// the event. It in ISO 8601 format. - /// the timestamp of when the event - /// became available for querying via this API. It is in ISO 8601 - /// format. This value should not be confused eventTimestamp. As there - /// might be a delay between the occurrence time of the event, and the - /// time that the event is submitted to the Azure logging - /// infrastructure. - /// the Azure subscription Id usually a - /// GUID. - /// the Azure tenant Id - public EventData(SenderAuthorization authorization = default(SenderAuthorization), IDictionary claims = default(IDictionary), string caller = default(string), string description = default(string), string id = default(string), string eventDataId = default(string), string correlationId = default(string), LocalizableString eventName = default(LocalizableString), LocalizableString category = default(LocalizableString), HttpRequestInfo httpRequest = default(HttpRequestInfo), EventLevel? level = default(EventLevel?), string resourceGroupName = default(string), LocalizableString resourceProviderName = default(LocalizableString), string resourceId = default(string), LocalizableString resourceType = default(LocalizableString), string operationId = default(string), LocalizableString operationName = default(LocalizableString), IDictionary properties = default(IDictionary), LocalizableString status = default(LocalizableString), LocalizableString subStatus = default(LocalizableString), System.DateTime? eventTimestamp = default(System.DateTime?), System.DateTime? submissionTimestamp = default(System.DateTime?), string subscriptionId = default(string), string tenantId = default(string)) - { - Authorization = authorization; - Claims = claims; - Caller = caller; - Description = description; - Id = id; - EventDataId = eventDataId; - CorrelationId = correlationId; - EventName = eventName; - Category = category; - HttpRequest = httpRequest; - Level = level; - ResourceGroupName = resourceGroupName; - ResourceProviderName = resourceProviderName; - ResourceId = resourceId; - ResourceType = resourceType; - OperationId = operationId; - OperationName = operationName; - Properties = properties; - Status = status; - SubStatus = subStatus; - EventTimestamp = eventTimestamp; - SubmissionTimestamp = submissionTimestamp; - SubscriptionId = subscriptionId; - TenantId = tenantId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the sender authorization information. - /// - [JsonProperty(PropertyName = "authorization")] - public SenderAuthorization Authorization { get; private set; } - - /// - /// Gets key value pairs to identify ARM permissions. - /// - [JsonProperty(PropertyName = "claims")] - public IDictionary Claims { get; private set; } - - /// - /// Gets the email address of the user who has performed the operation, - /// the UPN claim or SPN claim based on availability. - /// - [JsonProperty(PropertyName = "caller")] - public string Caller { get; private set; } - - /// - /// Gets the description of the event. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; private set; } - - /// - /// Gets the Id of this event as required by ARM for RBAC. It contains - /// the EventDataID and a timestamp information. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets the event data Id. This is a unique identifier for an event. - /// - [JsonProperty(PropertyName = "eventDataId")] - public string EventDataId { get; private set; } - - /// - /// Gets the correlation Id, usually a GUID in the string format. The - /// correlation Id is shared among the events that belong to the same - /// uber operation. - /// - [JsonProperty(PropertyName = "correlationId")] - public string CorrelationId { get; private set; } - - /// - /// Gets the event name. This value should not be confused with - /// OperationName. For practical purposes, OperationName might be more - /// appealing to end users. - /// - [JsonProperty(PropertyName = "eventName")] - public LocalizableString EventName { get; private set; } - - /// - /// Gets the event category. - /// - [JsonProperty(PropertyName = "category")] - public LocalizableString Category { get; private set; } - - /// - /// Gets the HTTP request info. Usually includes the 'clientRequestId', - /// 'clientIpAddress' (IP address of the user who initiated the event) - /// and 'method' (HTTP method e.g. PUT). - /// - [JsonProperty(PropertyName = "httpRequest")] - public HttpRequestInfo HttpRequest { get; private set; } - - /// - /// Gets the event level. Possible values include: 'Critical', 'Error', - /// 'Warning', 'Informational', 'Verbose' - /// - [JsonProperty(PropertyName = "level")] - public EventLevel? Level { get; private set; } - - /// - /// Gets the resource group name of the impacted resource. - /// - [JsonProperty(PropertyName = "resourceGroupName")] - public string ResourceGroupName { get; private set; } - - /// - /// Gets the resource provider name of the impacted resource. - /// - [JsonProperty(PropertyName = "resourceProviderName")] - public LocalizableString ResourceProviderName { get; private set; } - - /// - /// Gets the resource uri that uniquely identifies the resource that - /// caused this event. - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; private set; } - - /// - /// Gets the resource type - /// - [JsonProperty(PropertyName = "resourceType")] - public LocalizableString ResourceType { get; private set; } - - /// - /// Gets it is usually a GUID shared among the events corresponding to - /// single operation. This value should not be confused with EventName. - /// - [JsonProperty(PropertyName = "operationId")] - public string OperationId { get; private set; } - - /// - /// Gets the operation name. - /// - [JsonProperty(PropertyName = "operationName")] - public LocalizableString OperationName { get; private set; } - - /// - /// Gets the set of &lt;Key, Value&gt; pairs (usually a - /// Dictionary&lt;String, String&gt;) that includes details - /// about the event. - /// - [JsonProperty(PropertyName = "properties")] - public IDictionary Properties { get; private set; } - - /// - /// Gets a string describing the status of the operation. Some typical - /// values are: Started, In progress, Succeeded, Failed, Resolved. - /// - [JsonProperty(PropertyName = "status")] - public LocalizableString Status { get; private set; } - - /// - /// Gets the event sub status. Most of the time, when included, this - /// captures the HTTP status code of the REST call. Common values are: - /// OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), - /// Accepted (HTTP Status Code: 202), No Content (HTTP Status Code: - /// 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status - /// Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error - /// (HTTP Status Code: 500), Service Unavailable (HTTP Status - /// Code:503), Gateway Timeout (HTTP Status Code: 504) - /// - [JsonProperty(PropertyName = "subStatus")] - public LocalizableString SubStatus { get; private set; } - - /// - /// Gets the timestamp of when the event was generated by the Azure - /// service processing the request corresponding the event. It in ISO - /// 8601 format. - /// - [JsonProperty(PropertyName = "eventTimestamp")] - public System.DateTime? EventTimestamp { get; private set; } - - /// - /// Gets the timestamp of when the event became available for querying - /// via this API. It is in ISO 8601 format. This value should not be - /// confused eventTimestamp. As there might be a delay between the - /// occurrence time of the event, and the time that the event is - /// submitted to the Azure logging infrastructure. - /// - [JsonProperty(PropertyName = "submissionTimestamp")] - public System.DateTime? SubmissionTimestamp { get; private set; } - - /// - /// Gets the Azure subscription Id usually a GUID. - /// - [JsonProperty(PropertyName = "subscriptionId")] - public string SubscriptionId { get; private set; } - - /// - /// Gets the Azure tenant Id - /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (EventName != null) - { - EventName.Validate(); - } - if (Category != null) - { - Category.Validate(); - } - if (ResourceProviderName != null) - { - ResourceProviderName.Validate(); - } - if (ResourceType != null) - { - ResourceType.Validate(); - } - if (OperationName != null) - { - OperationName.Validate(); - } - if (Status != null) - { - Status.Validate(); - } - if (SubStatus != null) - { - SubStatus.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EventLevel.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EventLevel.cs deleted file mode 100644 index ac449a2bab878..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/EventLevel.cs +++ /dev/null @@ -1,78 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for EventLevel. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum EventLevel - { - [EnumMember(Value = "Critical")] - Critical, - [EnumMember(Value = "Error")] - Error, - [EnumMember(Value = "Warning")] - Warning, - [EnumMember(Value = "Informational")] - Informational, - [EnumMember(Value = "Verbose")] - Verbose - } - internal static class EventLevelEnumExtension - { - internal static string ToSerializedValue(this EventLevel? value) - { - return value == null ? null : ((EventLevel)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this EventLevel value) - { - switch( value ) - { - case EventLevel.Critical: - return "Critical"; - case EventLevel.Error: - return "Error"; - case EventLevel.Warning: - return "Warning"; - case EventLevel.Informational: - return "Informational"; - case EventLevel.Verbose: - return "Verbose"; - } - return null; - } - - internal static EventLevel? ParseEventLevel(this string value) - { - switch( value ) - { - case "Critical": - return EventLevel.Critical; - case "Error": - return EventLevel.Error; - case "Warning": - return EventLevel.Warning; - case "Informational": - return EventLevel.Informational; - case "Verbose": - return EventLevel.Verbose; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs deleted file mode 100644 index be46e72de05a5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ExtensionDataSource.cs +++ /dev/null @@ -1,110 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of which data will be collected from a separate VM extension - /// that integrates with the Azure Monitor Agent. - /// Collected from either Windows and Linux machines, depending on which - /// extension is defined. - /// - public partial class ExtensionDataSource - { - /// - /// Initializes a new instance of the ExtensionDataSource class. - /// - public ExtensionDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ExtensionDataSource class. - /// - /// List of streams that this data source will be - /// sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent - /// to. - /// The name of the VM extension. - /// A friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - /// The extension settings. The format - /// is specific for particular extension. - public ExtensionDataSource(IList streams, string extensionName, string name, object extensionSettings = default(object)) - { - Streams = streams; - ExtensionName = extensionName; - ExtensionSettings = extensionSettings; - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of streams that this data source will be sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent to. - /// - [JsonProperty(PropertyName = "streams")] - public IList Streams { get; set; } - - /// - /// Gets or sets the name of the VM extension. - /// - [JsonProperty(PropertyName = "extensionName")] - public string ExtensionName { get; set; } - - /// - /// Gets or sets the extension settings. The format is specific for - /// particular extension. - /// - [JsonProperty(PropertyName = "extensionSettings")] - public object ExtensionSettings { get; set; } - - /// - /// Gets or sets a friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Streams == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); - } - if (ExtensionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ExtensionName"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/HttpRequestInfo.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/HttpRequestInfo.cs deleted file mode 100644 index 142ff887d3f5a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/HttpRequestInfo.cs +++ /dev/null @@ -1,75 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The Http request info. - /// - public partial class HttpRequestInfo - { - /// - /// Initializes a new instance of the HttpRequestInfo class. - /// - public HttpRequestInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the HttpRequestInfo class. - /// - /// the client request id. - /// the client Ip Address - /// the Http request method. - /// the Uri. - public HttpRequestInfo(string clientRequestId = default(string), string clientIpAddress = default(string), string method = default(string), string uri = default(string)) - { - ClientRequestId = clientRequestId; - ClientIpAddress = clientIpAddress; - Method = method; - Uri = uri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the client request id. - /// - [JsonProperty(PropertyName = "clientRequestId")] - public string ClientRequestId { get; set; } - - /// - /// Gets or sets the client Ip Address - /// - [JsonProperty(PropertyName = "clientIpAddress")] - public string ClientIpAddress { get; set; } - - /// - /// Gets or sets the Http request method. - /// - [JsonProperty(PropertyName = "method")] - public string Method { get; set; } - - /// - /// Gets or sets the Uri. - /// - [JsonProperty(PropertyName = "uri")] - public string Uri { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Incident.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Incident.cs deleted file mode 100644 index 34d66152f2279..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Incident.cs +++ /dev/null @@ -1,91 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An alert incident indicates the activation status of an alert rule. - /// - public partial class Incident - { - /// - /// Initializes a new instance of the Incident class. - /// - public Incident() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Incident class. - /// - /// Incident name. - /// Rule name that is associated with the - /// incident. - /// A boolean to indicate whether the incident - /// is active or resolved. - /// The time at which the incident was - /// activated in ISO8601 format. - /// The time at which the incident was - /// resolved in ISO8601 format. If null, it means the incident is still - /// active. - public Incident(string name = default(string), string ruleName = default(string), bool? isActive = default(bool?), System.DateTime? activatedTime = default(System.DateTime?), System.DateTime? resolvedTime = default(System.DateTime?)) - { - Name = name; - RuleName = ruleName; - IsActive = isActive; - ActivatedTime = activatedTime; - ResolvedTime = resolvedTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets incident name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets rule name that is associated with the incident. - /// - [JsonProperty(PropertyName = "ruleName")] - public string RuleName { get; private set; } - - /// - /// Gets a boolean to indicate whether the incident is active or - /// resolved. - /// - [JsonProperty(PropertyName = "isActive")] - public bool? IsActive { get; private set; } - - /// - /// Gets the time at which the incident was activated in ISO8601 - /// format. - /// - [JsonProperty(PropertyName = "activatedTime")] - public System.DateTime? ActivatedTime { get; private set; } - - /// - /// Gets the time at which the incident was resolved in ISO8601 format. - /// If null, it means the incident is still active. - /// - [JsonProperty(PropertyName = "resolvedTime")] - public System.DateTime? ResolvedTime { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ItsmReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ItsmReceiver.cs deleted file mode 100644 index cdfc859280054..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ItsmReceiver.cs +++ /dev/null @@ -1,122 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An Itsm receiver. - /// - public partial class ItsmReceiver - { - /// - /// Initializes a new instance of the ItsmReceiver class. - /// - public ItsmReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ItsmReceiver class. - /// - /// The name of the Itsm receiver. Names must be - /// unique across all receivers within an action group. - /// OMS LA instance identifier. - /// Unique identification of ITSM connection - /// among multiple defined in above workspace. - /// JSON blob for the configurations - /// of the ITSM action. CreateMultipleWorkItems option will be part of - /// this blob as well. - /// Region in which workspace resides. Supported - /// values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - public ItsmReceiver(string name, string workspaceId, string connectionId, string ticketConfiguration, string region) - { - Name = name; - WorkspaceId = workspaceId; - ConnectionId = connectionId; - TicketConfiguration = ticketConfiguration; - Region = region; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the Itsm receiver. Names must be unique - /// across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets OMS LA instance identifier. - /// - [JsonProperty(PropertyName = "workspaceId")] - public string WorkspaceId { get; set; } - - /// - /// Gets or sets unique identification of ITSM connection among - /// multiple defined in above workspace. - /// - [JsonProperty(PropertyName = "connectionId")] - public string ConnectionId { get; set; } - - /// - /// Gets or sets JSON blob for the configurations of the ITSM action. - /// CreateMultipleWorkItems option will be part of this blob as well. - /// - [JsonProperty(PropertyName = "ticketConfiguration")] - public string TicketConfiguration { get; set; } - - /// - /// Gets or sets region in which workspace resides. Supported - /// values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - /// - [JsonProperty(PropertyName = "region")] - public string Region { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (WorkspaceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "WorkspaceId"); - } - if (ConnectionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ConnectionId"); - } - if (TicketConfiguration == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TicketConfiguration"); - } - if (Region == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Region"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LocalizableString.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LocalizableString.cs deleted file mode 100644 index 6db03f4d1e610..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LocalizableString.cs +++ /dev/null @@ -1,73 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The localizable string class. - /// - public partial class LocalizableString - { - /// - /// Initializes a new instance of the LocalizableString class. - /// - public LocalizableString() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LocalizableString class. - /// - /// the invariant value. - /// the locale specific value. - public LocalizableString(string value, string localizedValue = default(string)) - { - Value = value; - LocalizedValue = localizedValue; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the invariant value. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets the locale specific value. - /// - [JsonProperty(PropertyName = "localizedValue")] - public string LocalizedValue { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LocationThresholdRuleCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LocationThresholdRuleCondition.cs deleted file mode 100644 index d8cfb0db1d24a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LocationThresholdRuleCondition.cs +++ /dev/null @@ -1,87 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A rule condition based on a certain number of locations failing. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition")] - public partial class LocationThresholdRuleCondition : RuleCondition - { - /// - /// Initializes a new instance of the LocationThresholdRuleCondition - /// class. - /// - public LocationThresholdRuleCondition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LocationThresholdRuleCondition - /// class. - /// - /// the number of locations that must - /// fail to activate the alert. - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. If specified then it must be between 5 minutes and 1 - /// day. - public LocationThresholdRuleCondition(int failedLocationCount, RuleDataSource dataSource = default(RuleDataSource), System.TimeSpan? windowSize = default(System.TimeSpan?)) - : base(dataSource) - { - WindowSize = windowSize; - FailedLocationCount = failedLocationCount; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the period of time (in ISO 8601 duration format) that - /// is used to monitor alert activity based on the threshold. If - /// specified then it must be between 5 minutes and 1 day. - /// - [JsonProperty(PropertyName = "windowSize")] - public System.TimeSpan? WindowSize { get; set; } - - /// - /// Gets or sets the number of locations that must fail to activate the - /// alert. - /// - [JsonProperty(PropertyName = "failedLocationCount")] - public int FailedLocationCount { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (FailedLocationCount < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "FailedLocationCount", 0); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs deleted file mode 100644 index 8d2e2410d2a13..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogAnalyticsDestination.cs +++ /dev/null @@ -1,78 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Log Analytics destination. - /// - public partial class LogAnalyticsDestination - { - /// - /// Initializes a new instance of the LogAnalyticsDestination class. - /// - public LogAnalyticsDestination() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogAnalyticsDestination class. - /// - /// The resource ID of the Log - /// Analytics workspace. - /// A friendly name for the destination. - /// This name should be unique across all destinations (regardless of - /// type) within the data collection rule. - public LogAnalyticsDestination(string workspaceResourceId, string name) - { - WorkspaceResourceId = workspaceResourceId; - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource ID of the Log Analytics workspace. - /// - [JsonProperty(PropertyName = "workspaceResourceId")] - public string WorkspaceResourceId { get; set; } - - /// - /// Gets or sets a friendly name for the destination. - /// This name should be unique across all destinations (regardless of - /// type) within the data collection rule. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (WorkspaceResourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "WorkspaceResourceId"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogMetricTrigger.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogMetricTrigger.cs deleted file mode 100644 index 6c0adfc1c88d9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogMetricTrigger.cs +++ /dev/null @@ -1,83 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A log metrics trigger descriptor. - /// - public partial class LogMetricTrigger - { - /// - /// Initializes a new instance of the LogMetricTrigger class. - /// - public LogMetricTrigger() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogMetricTrigger class. - /// - /// Evaluation operation for Metric - /// -'GreaterThan' or 'LessThan' or 'Equal'. Possible values include: - /// 'GreaterThan', 'LessThan', 'Equal' - /// The threshold of the metric - /// trigger. - /// Metric Trigger Type - 'Consecutive' - /// or 'Total'. Possible values include: 'Consecutive', 'Total' - /// Evaluation of metric on a particular - /// column - public LogMetricTrigger(string thresholdOperator = default(string), double? threshold = default(double?), string metricTriggerType = default(string), string metricColumn = default(string)) - { - ThresholdOperator = thresholdOperator; - Threshold = threshold; - MetricTriggerType = metricTriggerType; - MetricColumn = metricColumn; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets evaluation operation for Metric -'GreaterThan' or - /// 'LessThan' or 'Equal'. Possible values include: 'GreaterThan', - /// 'LessThan', 'Equal' - /// - [JsonProperty(PropertyName = "thresholdOperator")] - public string ThresholdOperator { get; set; } - - /// - /// Gets or sets the threshold of the metric trigger. - /// - [JsonProperty(PropertyName = "threshold")] - public double? Threshold { get; set; } - - /// - /// Gets or sets metric Trigger Type - 'Consecutive' or 'Total'. - /// Possible values include: 'Consecutive', 'Total' - /// - [JsonProperty(PropertyName = "metricTriggerType")] - public string MetricTriggerType { get; set; } - - /// - /// Gets or sets evaluation of metric on a particular column - /// - [JsonProperty(PropertyName = "metricColumn")] - public string MetricColumn { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogProfileResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogProfileResource.cs deleted file mode 100644 index a709d9399b931..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogProfileResource.cs +++ /dev/null @@ -1,138 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The log profile resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class LogProfileResource : Resource - { - /// - /// Initializes a new instance of the LogProfileResource class. - /// - public LogProfileResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogProfileResource class. - /// - /// Resource location - /// List of regions for which Activity Log - /// events should be stored or streamed. It is a comma separated list - /// of valid ARM locations including the 'global' location. - /// the categories of the logs. These - /// categories are created as is convenient to the user. Some values - /// are: 'Write', 'Delete', and/or 'Action.' - /// the retention policy for the events - /// in the log. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// the resource id of the storage - /// account to which you would like to send the Activity Log. - /// The service bus rule ID of the - /// service bus namespace in which you would like to have Event Hubs - /// created for streaming the Activity Log. The rule ID is of the - /// format: '{service bus resource ID}/authorizationrules/{key - /// name}'. - public LogProfileResource(string location, IList locations, IList categories, RetentionPolicy retentionPolicy, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string)) - : base(location, id, name, type, tags) - { - StorageAccountId = storageAccountId; - ServiceBusRuleId = serviceBusRuleId; - Locations = locations; - Categories = categories; - RetentionPolicy = retentionPolicy; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource id of the storage account to which you - /// would like to send the Activity Log. - /// - [JsonProperty(PropertyName = "properties.storageAccountId")] - public string StorageAccountId { get; set; } - - /// - /// Gets or sets the service bus rule ID of the service bus namespace - /// in which you would like to have Event Hubs created for streaming - /// the Activity Log. The rule ID is of the format: '{service bus - /// resource ID}/authorizationrules/{key name}'. - /// - [JsonProperty(PropertyName = "properties.serviceBusRuleId")] - public string ServiceBusRuleId { get; set; } - - /// - /// Gets or sets list of regions for which Activity Log events should - /// be stored or streamed. It is a comma separated list of valid ARM - /// locations including the 'global' location. - /// - [JsonProperty(PropertyName = "properties.locations")] - public IList Locations { get; set; } - - /// - /// Gets or sets the categories of the logs. These categories are - /// created as is convenient to the user. Some values are: 'Write', - /// 'Delete', and/or 'Action.' - /// - [JsonProperty(PropertyName = "properties.categories")] - public IList Categories { get; set; } - - /// - /// Gets or sets the retention policy for the events in the log. - /// - [JsonProperty(PropertyName = "properties.retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (Locations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); - } - if (Categories == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Categories"); - } - if (RetentionPolicy == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RetentionPolicy"); - } - if (RetentionPolicy != null) - { - RetentionPolicy.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogProfileResourcePatch.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogProfileResourcePatch.cs deleted file mode 100644 index a3622df0b0ea7..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogProfileResourcePatch.cs +++ /dev/null @@ -1,139 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The log profile resource for patch operations. - /// - [Rest.Serialization.JsonTransformation] - public partial class LogProfileResourcePatch - { - /// - /// Initializes a new instance of the LogProfileResourcePatch class. - /// - public LogProfileResourcePatch() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogProfileResourcePatch class. - /// - /// List of regions for which Activity Log - /// events should be stored or streamed. It is a comma separated list - /// of valid ARM locations including the 'global' location. - /// the categories of the logs. These - /// categories are created as is convenient to the user. Some values - /// are: 'Write', 'Delete', and/or 'Action.' - /// the retention policy for the events - /// in the log. - /// Resource tags - /// the resource id of the storage - /// account to which you would like to send the Activity Log. - /// The service bus rule ID of the - /// service bus namespace in which you would like to have Event Hubs - /// created for streaming the Activity Log. The rule ID is of the - /// format: '{service bus resource ID}/authorizationrules/{key - /// name}'. - public LogProfileResourcePatch(IList locations, IList categories, RetentionPolicy retentionPolicy, IDictionary tags = default(IDictionary), string storageAccountId = default(string), string serviceBusRuleId = default(string)) - { - Tags = tags; - StorageAccountId = storageAccountId; - ServiceBusRuleId = serviceBusRuleId; - Locations = locations; - Categories = categories; - RetentionPolicy = retentionPolicy; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets the resource id of the storage account to which you - /// would like to send the Activity Log. - /// - [JsonProperty(PropertyName = "properties.storageAccountId")] - public string StorageAccountId { get; set; } - - /// - /// Gets or sets the service bus rule ID of the service bus namespace - /// in which you would like to have Event Hubs created for streaming - /// the Activity Log. The rule ID is of the format: '{service bus - /// resource ID}/authorizationrules/{key name}'. - /// - [JsonProperty(PropertyName = "properties.serviceBusRuleId")] - public string ServiceBusRuleId { get; set; } - - /// - /// Gets or sets list of regions for which Activity Log events should - /// be stored or streamed. It is a comma separated list of valid ARM - /// locations including the 'global' location. - /// - [JsonProperty(PropertyName = "properties.locations")] - public IList Locations { get; set; } - - /// - /// Gets or sets the categories of the logs. These categories are - /// created as is convenient to the user. Some values are: 'Write', - /// 'Delete', and/or 'Action.' - /// - [JsonProperty(PropertyName = "properties.categories")] - public IList Categories { get; set; } - - /// - /// Gets or sets the retention policy for the events in the log. - /// - [JsonProperty(PropertyName = "properties.retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Locations == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Locations"); - } - if (Categories == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Categories"); - } - if (RetentionPolicy == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "RetentionPolicy"); - } - if (RetentionPolicy != null) - { - RetentionPolicy.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSearchRuleResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSearchRuleResource.cs deleted file mode 100644 index e206d0bfb9e6b..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSearchRuleResource.cs +++ /dev/null @@ -1,149 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The Log Search Rule resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class LogSearchRuleResource : Resource - { - /// - /// Initializes a new instance of the LogSearchRuleResource class. - /// - public LogSearchRuleResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogSearchRuleResource class. - /// - /// Resource location - /// Data Source against which rule will Query - /// Data - /// Action needs to be taken on rule - /// execution. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// The description of the Log Search - /// rule. - /// The flag which indicates whether the Log - /// Search rule is enabled. Value should be true or false. Possible - /// values include: 'true', 'false' - /// Last time the rule was updated in - /// IS08601 format. - /// Provisioning state of the scheduled - /// query rule. Possible values include: 'Succeeded', 'Deploying', - /// 'Canceled', 'Failed' - /// Schedule (Frequency, Time Window) for rule. - /// Required for action type - AlertingAction - public LogSearchRuleResource(string location, Source source, Action action, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string description = default(string), string enabled = default(string), System.DateTime? lastUpdatedTime = default(System.DateTime?), string provisioningState = default(string), Schedule schedule = default(Schedule)) - : base(location, id, name, type, tags) - { - Description = description; - Enabled = enabled; - LastUpdatedTime = lastUpdatedTime; - ProvisioningState = provisioningState; - Source = source; - Schedule = schedule; - Action = action; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the description of the Log Search rule. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets the flag which indicates whether the Log Search rule - /// is enabled. Value should be true or false. Possible values include: - /// 'true', 'false' - /// - [JsonProperty(PropertyName = "properties.enabled")] - public string Enabled { get; set; } - - /// - /// Gets last time the rule was updated in IS08601 format. - /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } - - /// - /// Gets provisioning state of the scheduled query rule. Possible - /// values include: 'Succeeded', 'Deploying', 'Canceled', 'Failed' - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Gets or sets data Source against which rule will Query Data - /// - [JsonProperty(PropertyName = "properties.source")] - public Source Source { get; set; } - - /// - /// Gets or sets schedule (Frequency, Time Window) for rule. Required - /// for action type - AlertingAction - /// - [JsonProperty(PropertyName = "properties.schedule")] - public Schedule Schedule { get; set; } - - /// - /// Gets or sets action needs to be taken on rule execution. - /// - [JsonProperty(PropertyName = "properties.action")] - public Action Action { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (Source == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Source"); - } - if (Action == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Action"); - } - if (Source != null) - { - Source.Validate(); - } - if (Schedule != null) - { - Schedule.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSearchRuleResourcePatch.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSearchRuleResourcePatch.cs deleted file mode 100644 index 5b112d1f6893f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSearchRuleResourcePatch.cs +++ /dev/null @@ -1,68 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The log search rule resource for patch operations. - /// - [Rest.Serialization.JsonTransformation] - public partial class LogSearchRuleResourcePatch - { - /// - /// Initializes a new instance of the LogSearchRuleResourcePatch class. - /// - public LogSearchRuleResourcePatch() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogSearchRuleResourcePatch class. - /// - /// Resource tags - /// The flag which indicates whether the Log - /// Search rule is enabled. Value should be true or false. Possible - /// values include: 'true', 'false' - public LogSearchRuleResourcePatch(IDictionary tags = default(IDictionary), string enabled = default(string)) - { - Tags = tags; - Enabled = enabled; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets the flag which indicates whether the Log Search rule - /// is enabled. Value should be true or false. Possible values include: - /// 'true', 'false' - /// - [JsonProperty(PropertyName = "properties.enabled")] - public string Enabled { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSettings.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSettings.cs deleted file mode 100644 index fed0ef407cda6..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogSettings.cs +++ /dev/null @@ -1,89 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Part of MultiTenantDiagnosticSettings. Specifies the settings for a - /// particular log. - /// - public partial class LogSettings - { - /// - /// Initializes a new instance of the LogSettings class. - /// - public LogSettings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogSettings class. - /// - /// a value indicating whether this log is - /// enabled. - /// Name of a Diagnostic Log category for a - /// resource type this setting is applied to. To obtain the list of - /// Diagnostic Log categories for a resource, first perform a GET - /// diagnostic settings operation. - /// the retention policy for this - /// log. - public LogSettings(bool enabled, string category = default(string), RetentionPolicy retentionPolicy = default(RetentionPolicy)) - { - Category = category; - Enabled = enabled; - RetentionPolicy = retentionPolicy; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of a Diagnostic Log category for a resource type - /// this setting is applied to. To obtain the list of Diagnostic Log - /// categories for a resource, first perform a GET diagnostic settings - /// operation. - /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } - - /// - /// Gets or sets a value indicating whether this log is enabled. - /// - [JsonProperty(PropertyName = "enabled")] - public bool Enabled { get; set; } - - /// - /// Gets or sets the retention policy for this log. - /// - [JsonProperty(PropertyName = "retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (RetentionPolicy != null) - { - RetentionPolicy.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogToMetricAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogToMetricAction.cs deleted file mode 100644 index 449398da9c626..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogToMetricAction.cs +++ /dev/null @@ -1,79 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specify action need to be taken when rule type is converting log to - /// metric - /// - [Newtonsoft.Json.JsonObject("Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction")] - public partial class LogToMetricAction : Action - { - /// - /// Initializes a new instance of the LogToMetricAction class. - /// - public LogToMetricAction() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogToMetricAction class. - /// - /// Criteria of Metric - public LogToMetricAction(IList criteria) - { - Criteria = criteria; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets criteria of Metric - /// - [JsonProperty(PropertyName = "criteria")] - public IList Criteria { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Criteria == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Criteria"); - } - if (Criteria != null) - { - foreach (var element in Criteria) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogicAppReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogicAppReceiver.cs deleted file mode 100644 index 862a2a8dd73ff..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/LogicAppReceiver.cs +++ /dev/null @@ -1,102 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A logic app receiver. - /// - public partial class LogicAppReceiver - { - /// - /// Initializes a new instance of the LogicAppReceiver class. - /// - public LogicAppReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the LogicAppReceiver class. - /// - /// The name of the logic app receiver. Names must - /// be unique across all receivers within an action group. - /// The azure resource id of the logic app - /// receiver. - /// The callback url where http request sent - /// to. - /// Indicates whether to use common - /// alert schema. - public LogicAppReceiver(string name, string resourceId, string callbackUrl, bool useCommonAlertSchema) - { - Name = name; - ResourceId = resourceId; - CallbackUrl = callbackUrl; - UseCommonAlertSchema = useCommonAlertSchema; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the logic app receiver. Names must be - /// unique across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the azure resource id of the logic app receiver. - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } - - /// - /// Gets or sets the callback url where http request sent to. - /// - [JsonProperty(PropertyName = "callbackUrl")] - public string CallbackUrl { get; set; } - - /// - /// Gets or sets indicates whether to use common alert schema. - /// - [JsonProperty(PropertyName = "useCommonAlertSchema")] - public bool UseCommonAlertSchema { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (ResourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); - } - if (CallbackUrl == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CallbackUrl"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ManagementEventAggregationCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ManagementEventAggregationCondition.cs deleted file mode 100644 index 0e2b2b3efa683..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ManagementEventAggregationCondition.cs +++ /dev/null @@ -1,78 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// How the data that is collected should be combined over time. - /// - public partial class ManagementEventAggregationCondition - { - /// - /// Initializes a new instance of the - /// ManagementEventAggregationCondition class. - /// - public ManagementEventAggregationCondition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// ManagementEventAggregationCondition class. - /// - /// the condition operator. Possible - /// values include: 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', - /// 'LessThanOrEqual' - /// The threshold value that activates the - /// alert. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. If specified then it must be between 5 minutes and 1 - /// day. - public ManagementEventAggregationCondition(ConditionOperator? operatorProperty = default(ConditionOperator?), double? threshold = default(double?), System.TimeSpan? windowSize = default(System.TimeSpan?)) - { - OperatorProperty = operatorProperty; - Threshold = threshold; - WindowSize = windowSize; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the condition operator. Possible values include: - /// 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - /// - [JsonProperty(PropertyName = "operator")] - public ConditionOperator? OperatorProperty { get; set; } - - /// - /// Gets or sets the threshold value that activates the alert. - /// - [JsonProperty(PropertyName = "threshold")] - public double? Threshold { get; set; } - - /// - /// Gets or sets the period of time (in ISO 8601 duration format) that - /// is used to monitor alert activity based on the threshold. If - /// specified then it must be between 5 minutes and 1 day. - /// - [JsonProperty(PropertyName = "windowSize")] - public System.TimeSpan? WindowSize { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ManagementEventRuleCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ManagementEventRuleCondition.cs deleted file mode 100644 index 4ede5a4111487..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ManagementEventRuleCondition.cs +++ /dev/null @@ -1,64 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A management event rule condition. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition")] - public partial class ManagementEventRuleCondition : RuleCondition - { - /// - /// Initializes a new instance of the ManagementEventRuleCondition - /// class. - /// - public ManagementEventRuleCondition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ManagementEventRuleCondition - /// class. - /// - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. - /// How the data that is collected should be - /// combined over time and when the alert is activated. Note that for - /// management event alerts aggregation is optional – if it is not - /// provided then any event will cause the alert to activate. - public ManagementEventRuleCondition(RuleDataSource dataSource = default(RuleDataSource), ManagementEventAggregationCondition aggregation = default(ManagementEventAggregationCondition)) - : base(dataSource) - { - Aggregation = aggregation; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets how the data that is collected should be combined over - /// time and when the alert is activated. Note that for management - /// event alerts aggregation is optional – if it is not provided then - /// any event will cause the alert to activate. - /// - [JsonProperty(PropertyName = "aggregation")] - public ManagementEventAggregationCondition Aggregation { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetadataValue.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetadataValue.cs deleted file mode 100644 index 84b70cfdc04d0..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetadataValue.cs +++ /dev/null @@ -1,72 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a metric metadata value. - /// - public partial class MetadataValue - { - /// - /// Initializes a new instance of the MetadataValue class. - /// - public MetadataValue() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetadataValue class. - /// - /// the name of the metadata. - /// the value of the metadata. - public MetadataValue(LocalizableString name = default(LocalizableString), string value = default(string)) - { - Name = name; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the metadata. - /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; set; } - - /// - /// Gets or sets the value of the metadata. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name != null) - { - Name.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Metric.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Metric.cs deleted file mode 100644 index c2748c6b6bb0d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Metric.cs +++ /dev/null @@ -1,126 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The result data of a query. - /// - public partial class Metric - { - /// - /// Initializes a new instance of the Metric class. - /// - public Metric() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Metric class. - /// - /// the metric Id. - /// the resource type of the metric - /// resource. - /// the name and the display name of the metric, - /// i.e. it is localizable string. - /// the unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' - /// the time series returned when a data query - /// is performed. - public Metric(string id, string type, LocalizableString name, Unit unit, IList timeseries) - { - Id = id; - Type = type; - Name = name; - Unit = unit; - Timeseries = timeseries; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the metric Id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the resource type of the metric resource. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the name and the display name of the metric, i.e. it - /// is localizable string. - /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; set; } - - /// - /// Gets or sets the unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' - /// - [JsonProperty(PropertyName = "unit")] - public Unit Unit { get; set; } - - /// - /// Gets or sets the time series returned when a data query is - /// performed. - /// - [JsonProperty(PropertyName = "timeseries")] - public IList Timeseries { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Type == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Timeseries == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Timeseries"); - } - if (Name != null) - { - Name.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertAction.cs deleted file mode 100644 index b350094e1de43..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertAction.cs +++ /dev/null @@ -1,63 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An alert action. - /// - public partial class MetricAlertAction - { - /// - /// Initializes a new instance of the MetricAlertAction class. - /// - public MetricAlertAction() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAlertAction class. - /// - /// the id of the action group to - /// use. - /// The properties of a webhook - /// object. - public MetricAlertAction(string actionGroupId = default(string), IDictionary webHookProperties = default(IDictionary)) - { - ActionGroupId = actionGroupId; - WebHookProperties = webHookProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the id of the action group to use. - /// - [JsonProperty(PropertyName = "actionGroupId")] - public string ActionGroupId { get; set; } - - /// - /// Gets or sets the properties of a webhook object. - /// - [JsonProperty(PropertyName = "webHookProperties")] - public IDictionary WebHookProperties { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertCriteria.cs deleted file mode 100644 index a3ba1b45aa0e7..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertCriteria.cs +++ /dev/null @@ -1,55 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The rule criteria that defines the conditions of the alert rule. - /// - public partial class MetricAlertCriteria - { - /// - /// Initializes a new instance of the MetricAlertCriteria class. - /// - public MetricAlertCriteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAlertCriteria class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - public MetricAlertCriteria(IDictionary additionalProperties = default(IDictionary)) - { - AdditionalProperties = additionalProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs deleted file mode 100644 index 105d3f132ee80..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertMultipleResourceMultipleMetricCriteria.cs +++ /dev/null @@ -1,62 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the metric alert criteria for multiple resource that has - /// multiple metric criteria. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria")] - public partial class MetricAlertMultipleResourceMultipleMetricCriteria : MetricAlertCriteria - { - /// - /// Initializes a new instance of the - /// MetricAlertMultipleResourceMultipleMetricCriteria class. - /// - public MetricAlertMultipleResourceMultipleMetricCriteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// MetricAlertMultipleResourceMultipleMetricCriteria class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// the list of multiple metric criteria for this - /// 'all of' operation. - public MetricAlertMultipleResourceMultipleMetricCriteria(IDictionary additionalProperties = default(IDictionary), IList allOf = default(IList)) - : base(additionalProperties) - { - AllOf = allOf; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of multiple metric criteria for this 'all of' - /// operation. - /// - [JsonProperty(PropertyName = "allOf")] - public IList AllOf { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResource.cs deleted file mode 100644 index 1dc4c60ad162d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResource.cs +++ /dev/null @@ -1,194 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The metric alert resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class MetricAlertResource : Resource - { - /// - /// Initializes a new instance of the MetricAlertResource class. - /// - public MetricAlertResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAlertResource class. - /// - /// Resource location - /// the description of the metric alert that - /// will be included in the alert email. - /// Alert severity {0, 1, 2, 3, 4} - /// the flag that indicates whether the metric - /// alert is enabled. - /// how often the metric alert is - /// evaluated represented in ISO 8601 duration format. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. - /// defines the specific alert criteria - /// information. - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - /// the list of resource id's that this metric - /// alert is scoped to. - /// the resource type of the target - /// resource(s) on which the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// the region of the target - /// resource(s) on which the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// the flag that indicates whether the - /// alert should be auto resolved or not. The default is true. - /// the array of actions that are performed when - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - public MetricAlertResource(string location, string description, int severity, bool enabled, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, MetricAlertCriteria criteria, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), IList scopes = default(IList), string targetResourceType = default(string), string targetResourceRegion = default(string), bool? autoMitigate = default(bool?), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) - : base(location, id, name, type, tags) - { - Description = description; - Severity = severity; - Enabled = enabled; - Scopes = scopes; - EvaluationFrequency = evaluationFrequency; - WindowSize = windowSize; - TargetResourceType = targetResourceType; - TargetResourceRegion = targetResourceRegion; - Criteria = criteria; - AutoMitigate = autoMitigate; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the description of the metric alert that will be - /// included in the alert email. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets alert severity {0, 1, 2, 3, 4} - /// - [JsonProperty(PropertyName = "properties.severity")] - public int Severity { get; set; } - - /// - /// Gets or sets the flag that indicates whether the metric alert is - /// enabled. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; set; } - - /// - /// Gets or sets the list of resource id's that this metric alert is - /// scoped to. - /// - [JsonProperty(PropertyName = "properties.scopes")] - public IList Scopes { get; set; } - - /// - /// Gets or sets how often the metric alert is evaluated represented in - /// ISO 8601 duration format. - /// - [JsonProperty(PropertyName = "properties.evaluationFrequency")] - public System.TimeSpan EvaluationFrequency { get; set; } - - /// - /// Gets or sets the period of time (in ISO 8601 duration format) that - /// is used to monitor alert activity based on the threshold. - /// - [JsonProperty(PropertyName = "properties.windowSize")] - public System.TimeSpan WindowSize { get; set; } - - /// - /// Gets or sets the resource type of the target resource(s) on which - /// the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// - [JsonProperty(PropertyName = "properties.targetResourceType")] - public string TargetResourceType { get; set; } - - /// - /// Gets or sets the region of the target resource(s) on which the - /// alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// - [JsonProperty(PropertyName = "properties.targetResourceRegion")] - public string TargetResourceRegion { get; set; } - - /// - /// Gets or sets defines the specific alert criteria information. - /// - [JsonProperty(PropertyName = "properties.criteria")] - public MetricAlertCriteria Criteria { get; set; } - - /// - /// Gets or sets the flag that indicates whether the alert should be - /// auto resolved or not. The default is true. - /// - [JsonProperty(PropertyName = "properties.autoMitigate")] - public bool? AutoMitigate { get; set; } - - /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. - /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } - - /// - /// Gets last time the rule was updated in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (Description == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); - } - if (Criteria == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Criteria"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResourcePatch.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResourcePatch.cs deleted file mode 100644 index 7aaaa76ccfd9f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertResourcePatch.cs +++ /dev/null @@ -1,195 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The metric alert resource for patch operations. - /// - [Rest.Serialization.JsonTransformation] - public partial class MetricAlertResourcePatch - { - /// - /// Initializes a new instance of the MetricAlertResourcePatch class. - /// - public MetricAlertResourcePatch() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAlertResourcePatch class. - /// - /// the description of the metric alert that - /// will be included in the alert email. - /// Alert severity {0, 1, 2, 3, 4} - /// the flag that indicates whether the metric - /// alert is enabled. - /// how often the metric alert is - /// evaluated represented in ISO 8601 duration format. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. - /// defines the specific alert criteria - /// information. - /// Resource tags - /// the list of resource id's that this metric - /// alert is scoped to. - /// the resource type of the target - /// resource(s) on which the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// the region of the target - /// resource(s) on which the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// the flag that indicates whether the - /// alert should be auto resolved or not. The default is true. - /// the array of actions that are performed when - /// the alert rule becomes active, and when an alert condition is - /// resolved. - /// Last time the rule was updated in - /// ISO8601 format. - public MetricAlertResourcePatch(string description, int severity, bool enabled, System.TimeSpan evaluationFrequency, System.TimeSpan windowSize, MetricAlertCriteria criteria, IDictionary tags = default(IDictionary), IList scopes = default(IList), string targetResourceType = default(string), string targetResourceRegion = default(string), bool? autoMitigate = default(bool?), IList actions = default(IList), System.DateTime? lastUpdatedTime = default(System.DateTime?)) - { - Tags = tags; - Description = description; - Severity = severity; - Enabled = enabled; - Scopes = scopes; - EvaluationFrequency = evaluationFrequency; - WindowSize = windowSize; - TargetResourceType = targetResourceType; - TargetResourceRegion = targetResourceRegion; - Criteria = criteria; - AutoMitigate = autoMitigate; - Actions = actions; - LastUpdatedTime = lastUpdatedTime; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Gets or sets the description of the metric alert that will be - /// included in the alert email. - /// - [JsonProperty(PropertyName = "properties.description")] - public string Description { get; set; } - - /// - /// Gets or sets alert severity {0, 1, 2, 3, 4} - /// - [JsonProperty(PropertyName = "properties.severity")] - public int Severity { get; set; } - - /// - /// Gets or sets the flag that indicates whether the metric alert is - /// enabled. - /// - [JsonProperty(PropertyName = "properties.enabled")] - public bool Enabled { get; set; } - - /// - /// Gets or sets the list of resource id's that this metric alert is - /// scoped to. - /// - [JsonProperty(PropertyName = "properties.scopes")] - public IList Scopes { get; set; } - - /// - /// Gets or sets how often the metric alert is evaluated represented in - /// ISO 8601 duration format. - /// - [JsonProperty(PropertyName = "properties.evaluationFrequency")] - public System.TimeSpan EvaluationFrequency { get; set; } - - /// - /// Gets or sets the period of time (in ISO 8601 duration format) that - /// is used to monitor alert activity based on the threshold. - /// - [JsonProperty(PropertyName = "properties.windowSize")] - public System.TimeSpan WindowSize { get; set; } - - /// - /// Gets or sets the resource type of the target resource(s) on which - /// the alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// - [JsonProperty(PropertyName = "properties.targetResourceType")] - public string TargetResourceType { get; set; } - - /// - /// Gets or sets the region of the target resource(s) on which the - /// alert is created/updated. Mandatory for - /// MultipleResourceMultipleMetricCriteria. - /// - [JsonProperty(PropertyName = "properties.targetResourceRegion")] - public string TargetResourceRegion { get; set; } - - /// - /// Gets or sets defines the specific alert criteria information. - /// - [JsonProperty(PropertyName = "properties.criteria")] - public MetricAlertCriteria Criteria { get; set; } - - /// - /// Gets or sets the flag that indicates whether the alert should be - /// auto resolved or not. The default is true. - /// - [JsonProperty(PropertyName = "properties.autoMitigate")] - public bool? AutoMitigate { get; set; } - - /// - /// Gets or sets the array of actions that are performed when the alert - /// rule becomes active, and when an alert condition is resolved. - /// - [JsonProperty(PropertyName = "properties.actions")] - public IList Actions { get; set; } - - /// - /// Gets last time the rule was updated in ISO8601 format. - /// - [JsonProperty(PropertyName = "properties.lastUpdatedTime")] - public System.DateTime? LastUpdatedTime { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Description == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); - } - if (Criteria == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Criteria"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs deleted file mode 100644 index bc38badfd4b55..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertSingleResourceMultipleMetricCriteria.cs +++ /dev/null @@ -1,62 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the metric alert criteria for a single resource that has - /// multiple metric criteria. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria")] - public partial class MetricAlertSingleResourceMultipleMetricCriteria : MetricAlertCriteria - { - /// - /// Initializes a new instance of the - /// MetricAlertSingleResourceMultipleMetricCriteria class. - /// - public MetricAlertSingleResourceMultipleMetricCriteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// MetricAlertSingleResourceMultipleMetricCriteria class. - /// - /// Unmatched properties from the - /// message are deserialized this collection - /// The list of metric criteria for this 'all of' - /// operation. - public MetricAlertSingleResourceMultipleMetricCriteria(IDictionary additionalProperties = default(IDictionary), IList allOf = default(IList)) - : base(additionalProperties) - { - AllOf = allOf; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of metric criteria for this 'all of' - /// operation. - /// - [JsonProperty(PropertyName = "allOf")] - public IList AllOf { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatus.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatus.cs deleted file mode 100644 index f09809a7535e2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatus.cs +++ /dev/null @@ -1,77 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// An alert status. - /// - public partial class MetricAlertStatus - { - /// - /// Initializes a new instance of the MetricAlertStatus class. - /// - public MetricAlertStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAlertStatus class. - /// - /// The status name. - /// The alert rule arm id. - /// The extended resource type name. - /// The alert status properties of the metric - /// alert status. - public MetricAlertStatus(string name = default(string), string id = default(string), string type = default(string), MetricAlertStatusProperties properties = default(MetricAlertStatusProperties)) - { - Name = name; - Id = id; - Type = type; - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the status name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the alert rule arm id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the extended resource type name. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the alert status properties of the metric alert - /// status. - /// - [JsonProperty(PropertyName = "properties")] - public MetricAlertStatusProperties Properties { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatusCollection.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatusCollection.cs deleted file mode 100644 index 461d2b441d0b9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatusCollection.cs +++ /dev/null @@ -1,56 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Represents a collection of alert rule resources. - /// - public partial class MetricAlertStatusCollection - { - /// - /// Initializes a new instance of the MetricAlertStatusCollection - /// class. - /// - public MetricAlertStatusCollection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAlertStatusCollection - /// class. - /// - /// the values for the alert rule - /// resources. - public MetricAlertStatusCollection(IList value = default(IList)) - { - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the values for the alert rule resources. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatusProperties.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatusProperties.cs deleted file mode 100644 index ba3dedbad37d9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAlertStatusProperties.cs +++ /dev/null @@ -1,73 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An alert status properties. - /// - public partial class MetricAlertStatusProperties - { - /// - /// Initializes a new instance of the MetricAlertStatusProperties - /// class. - /// - public MetricAlertStatusProperties() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAlertStatusProperties - /// class. - /// - /// An object describing the type of the - /// dimensions. - /// status value - /// UTC time when the status was - /// checked. - public MetricAlertStatusProperties(IDictionary dimensions = default(IDictionary), string status = default(string), System.DateTime? timestamp = default(System.DateTime?)) - { - Dimensions = dimensions; - Status = status; - Timestamp = timestamp; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets an object describing the type of the dimensions. - /// - [JsonProperty(PropertyName = "dimensions")] - public IDictionary Dimensions { get; set; } - - /// - /// Gets or sets status value - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets UTC time when the status was checked. - /// - [JsonProperty(PropertyName = "timestamp")] - public System.DateTime? Timestamp { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAvailability.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAvailability.cs deleted file mode 100644 index c60ef65fd5e16..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricAvailability.cs +++ /dev/null @@ -1,66 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Metric availability specifies the time grain (aggregation interval or - /// frequency) and the retention period for that time grain. - /// - public partial class MetricAvailability - { - /// - /// Initializes a new instance of the MetricAvailability class. - /// - public MetricAvailability() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricAvailability class. - /// - /// the time grain specifies the aggregation - /// interval for the metric. Expressed as a duration 'PT1M', 'P1D', - /// etc. - /// the retention period for the metric at the - /// specified timegrain. Expressed as a duration 'PT1M', 'P1D', - /// etc. - public MetricAvailability(System.TimeSpan? timeGrain = default(System.TimeSpan?), System.TimeSpan? retention = default(System.TimeSpan?)) - { - TimeGrain = timeGrain; - Retention = retention; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the time grain specifies the aggregation interval for - /// the metric. Expressed as a duration 'PT1M', 'P1D', etc. - /// - [JsonProperty(PropertyName = "timeGrain")] - public System.TimeSpan? TimeGrain { get; set; } - - /// - /// Gets or sets the retention period for the metric at the specified - /// timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - /// - [JsonProperty(PropertyName = "retention")] - public System.TimeSpan? Retention { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricCriteria.cs deleted file mode 100644 index d595365129bcd..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricCriteria.cs +++ /dev/null @@ -1,94 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Criterion to filter metrics. - /// - [Newtonsoft.Json.JsonObject("StaticThresholdCriterion")] - public partial class MetricCriteria : MultiMetricCriteria - { - /// - /// Initializes a new instance of the MetricCriteria class. - /// - public MetricCriteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricCriteria class. - /// - /// Name of the criteria. - /// Name of the metric. - /// the criteria time aggregation - /// types. - /// the criteria operator. Possible - /// values include: 'Equals', 'NotEquals', 'GreaterThan', - /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - /// the criteria threshold value that activates - /// the alert. - /// Unmatched properties from the - /// message are deserialized this collection - /// Namespace of the metric. - /// List of dimension conditions. - /// Allows creating an alert rule on - /// a custom metric that isn't yet emitted, by causing the metric - /// validation to be skipped. - public MetricCriteria(string name, string metricName, object timeAggregation, string operatorProperty, double threshold, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) - : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions, skipMetricValidation) - { - OperatorProperty = operatorProperty; - Threshold = threshold; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the criteria operator. Possible values include: - /// 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', - /// 'LessThan', 'LessThanOrEqual' - /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } - - /// - /// Gets or sets the criteria threshold value that activates the alert. - /// - [JsonProperty(PropertyName = "threshold")] - public double Threshold { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public override void Validate() - { - base.Validate(); - if (OperatorProperty == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricDefinition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricDefinition.cs deleted file mode 100644 index c94bb5f8bafec..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricDefinition.cs +++ /dev/null @@ -1,172 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Metric definition class specifies the metadata for a metric. - /// - public partial class MetricDefinition - { - /// - /// Initializes a new instance of the MetricDefinition class. - /// - public MetricDefinition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricDefinition class. - /// - /// Flag to indicate whether the - /// dimension is required. - /// the resource identifier of the resource - /// that emitted the metric. - /// the namespace the metric belongs - /// to. - /// the name and the display name of the metric, - /// i.e. it is a localizable string. - /// the unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' - /// the primary aggregation type - /// value defining how to use the values for display. Possible values - /// include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', - /// 'Total' - /// the collection of what - /// aggregation types are supported. - /// the collection of what - /// aggregation intervals are available to be queried. - /// the resource identifier of the metric - /// definition. - /// the name and the display name of the - /// dimension, i.e. it is a localizable string. - public MetricDefinition(bool? isDimensionRequired = default(bool?), string resourceId = default(string), string namespaceProperty = default(string), LocalizableString name = default(LocalizableString), Unit? unit = default(Unit?), AggregationType? primaryAggregationType = default(AggregationType?), IList supportedAggregationTypes = default(IList), IList metricAvailabilities = default(IList), string id = default(string), IList dimensions = default(IList)) - { - IsDimensionRequired = isDimensionRequired; - ResourceId = resourceId; - NamespaceProperty = namespaceProperty; - Name = name; - Unit = unit; - PrimaryAggregationType = primaryAggregationType; - SupportedAggregationTypes = supportedAggregationTypes; - MetricAvailabilities = metricAvailabilities; - Id = id; - Dimensions = dimensions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets flag to indicate whether the dimension is required. - /// - [JsonProperty(PropertyName = "isDimensionRequired")] - public bool? IsDimensionRequired { get; set; } - - /// - /// Gets or sets the resource identifier of the resource that emitted - /// the metric. - /// - [JsonProperty(PropertyName = "resourceId")] - public string ResourceId { get; set; } - - /// - /// Gets or sets the namespace the metric belongs to. - /// - [JsonProperty(PropertyName = "namespace")] - public string NamespaceProperty { get; set; } - - /// - /// Gets or sets the name and the display name of the metric, i.e. it - /// is a localizable string. - /// - [JsonProperty(PropertyName = "name")] - public LocalizableString Name { get; set; } - - /// - /// Gets or sets the unit of the metric. Possible values include: - /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', - /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified', 'Cores', - /// 'MilliCores', 'NanoCores', 'BitsPerSecond' - /// - [JsonProperty(PropertyName = "unit")] - public Unit? Unit { get; set; } - - /// - /// Gets or sets the primary aggregation type value defining how to use - /// the values for display. Possible values include: 'None', 'Average', - /// 'Count', 'Minimum', 'Maximum', 'Total' - /// - [JsonProperty(PropertyName = "primaryAggregationType")] - public AggregationType? PrimaryAggregationType { get; set; } - - /// - /// Gets or sets the collection of what aggregation types are - /// supported. - /// - [JsonProperty(PropertyName = "supportedAggregationTypes")] - public IList SupportedAggregationTypes { get; set; } - - /// - /// Gets or sets the collection of what aggregation intervals are - /// available to be queried. - /// - [JsonProperty(PropertyName = "metricAvailabilities")] - public IList MetricAvailabilities { get; set; } - - /// - /// Gets or sets the resource identifier of the metric definition. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the name and the display name of the dimension, i.e. - /// it is a localizable string. - /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name != null) - { - Name.Validate(); - } - if (Dimensions != null) - { - foreach (var element in Dimensions) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricDimension.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricDimension.cs deleted file mode 100644 index 89e83546e09f2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricDimension.cs +++ /dev/null @@ -1,93 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies a metric dimension. - /// - public partial class MetricDimension - { - /// - /// Initializes a new instance of the MetricDimension class. - /// - public MetricDimension() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricDimension class. - /// - /// Name of the dimension. - /// the dimension operator. Only - /// 'Include' and 'Exclude' are supported - /// list of dimension values. - public MetricDimension(string name, string operatorProperty, IList values) - { - Name = name; - OperatorProperty = operatorProperty; - Values = values; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the dimension. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the dimension operator. Only 'Include' and 'Exclude' - /// are supported - /// - [JsonProperty(PropertyName = "operator")] - public string OperatorProperty { get; set; } - - /// - /// Gets or sets list of dimension values. - /// - [JsonProperty(PropertyName = "values")] - public IList Values { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (OperatorProperty == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); - } - if (Values == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Values"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricNamespace.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricNamespace.cs deleted file mode 100644 index 6180e56c91f1f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricNamespace.cs +++ /dev/null @@ -1,77 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Metric namespace class specifies the metadata for a metric namespace. - /// - public partial class MetricNamespace - { - /// - /// Initializes a new instance of the MetricNamespace class. - /// - public MetricNamespace() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricNamespace class. - /// - /// The ID of the metricNamespace. - /// The type of the namespace. - /// The name of the namespace. - /// Properties which include the fully - /// qualified namespace name. - public MetricNamespace(string id = default(string), string type = default(string), string name = default(string), MetricNamespaceName properties = default(MetricNamespaceName)) - { - Id = id; - Type = type; - Name = name; - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the ID of the metricNamespace. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the type of the namespace. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the name of the namespace. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets properties which include the fully qualified namespace - /// name. - /// - [JsonProperty(PropertyName = "properties")] - public MetricNamespaceName Properties { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricNamespaceName.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricNamespaceName.cs deleted file mode 100644 index 1415eb1300a4c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricNamespaceName.cs +++ /dev/null @@ -1,52 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The fully qualified metric namespace name. - /// - public partial class MetricNamespaceName - { - /// - /// Initializes a new instance of the MetricNamespaceName class. - /// - public MetricNamespaceName() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricNamespaceName class. - /// - /// The metric namespace - /// name. - public MetricNamespaceName(string metricNamespaceNameProperty = default(string)) - { - MetricNamespaceNameProperty = metricNamespaceNameProperty; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the metric namespace name. - /// - [JsonProperty(PropertyName = "metricNamespaceName")] - public string MetricNamespaceNameProperty { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricSettings.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricSettings.cs deleted file mode 100644 index bf7657b2a3b84..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricSettings.cs +++ /dev/null @@ -1,98 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Part of MultiTenantDiagnosticSettings. Specifies the settings for a - /// particular metric. - /// - public partial class MetricSettings - { - /// - /// Initializes a new instance of the MetricSettings class. - /// - public MetricSettings() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricSettings class. - /// - /// a value indicating whether this category is - /// enabled. - /// the timegrain of the metric in ISO8601 - /// format. - /// Name of a Diagnostic Metric category for a - /// resource type this setting is applied to. To obtain the list of - /// Diagnostic metric categories for a resource, first perform a GET - /// diagnostic settings operation. - /// the retention policy for this - /// category. - public MetricSettings(bool enabled, System.TimeSpan? timeGrain = default(System.TimeSpan?), string category = default(string), RetentionPolicy retentionPolicy = default(RetentionPolicy)) - { - TimeGrain = timeGrain; - Category = category; - Enabled = enabled; - RetentionPolicy = retentionPolicy; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the timegrain of the metric in ISO8601 format. - /// - [JsonProperty(PropertyName = "timeGrain")] - public System.TimeSpan? TimeGrain { get; set; } - - /// - /// Gets or sets name of a Diagnostic Metric category for a resource - /// type this setting is applied to. To obtain the list of Diagnostic - /// metric categories for a resource, first perform a GET diagnostic - /// settings operation. - /// - [JsonProperty(PropertyName = "category")] - public string Category { get; set; } - - /// - /// Gets or sets a value indicating whether this category is enabled. - /// - [JsonProperty(PropertyName = "enabled")] - public bool Enabled { get; set; } - - /// - /// Gets or sets the retention policy for this category. - /// - [JsonProperty(PropertyName = "retentionPolicy")] - public RetentionPolicy RetentionPolicy { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (RetentionPolicy != null) - { - RetentionPolicy.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricSingleDimension.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricSingleDimension.cs deleted file mode 100644 index b80789586206c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricSingleDimension.cs +++ /dev/null @@ -1,77 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The metric dimension name and value. - /// - public partial class MetricSingleDimension - { - /// - /// Initializes a new instance of the MetricSingleDimension class. - /// - public MetricSingleDimension() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricSingleDimension class. - /// - /// Name of the dimension. - /// Value of the dimension. - public MetricSingleDimension(string name, string value) - { - Name = name; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the dimension. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets value of the dimension. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricStatisticType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricStatisticType.cs deleted file mode 100644 index a216b1bf4555f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricStatisticType.cs +++ /dev/null @@ -1,72 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for MetricStatisticType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum MetricStatisticType - { - [EnumMember(Value = "Average")] - Average, - [EnumMember(Value = "Min")] - Min, - [EnumMember(Value = "Max")] - Max, - [EnumMember(Value = "Sum")] - Sum - } - internal static class MetricStatisticTypeEnumExtension - { - internal static string ToSerializedValue(this MetricStatisticType? value) - { - return value == null ? null : ((MetricStatisticType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this MetricStatisticType value) - { - switch( value ) - { - case MetricStatisticType.Average: - return "Average"; - case MetricStatisticType.Min: - return "Min"; - case MetricStatisticType.Max: - return "Max"; - case MetricStatisticType.Sum: - return "Sum"; - } - return null; - } - - internal static MetricStatisticType? ParseMetricStatisticType(this string value) - { - switch( value ) - { - case "Average": - return MetricStatisticType.Average; - case "Min": - return MetricStatisticType.Min; - case "Max": - return MetricStatisticType.Max; - case "Sum": - return MetricStatisticType.Sum; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricTrigger.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricTrigger.cs deleted file mode 100644 index 03738b6e53bf5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricTrigger.cs +++ /dev/null @@ -1,189 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The trigger that results in a scaling action. - /// - public partial class MetricTrigger - { - /// - /// Initializes a new instance of the MetricTrigger class. - /// - public MetricTrigger() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricTrigger class. - /// - /// the name of the metric that defines what - /// the rule monitors. - /// the resource identifier of the - /// resource the rule monitors. - /// the granularity of metrics the rule - /// monitors. Must be one of the predefined values returned from metric - /// definitions for the metric. Must be between 12 hours and 1 - /// minute. - /// the metric statistic type. How the metrics - /// from multiple instances are combined. Possible values include: - /// 'Average', 'Min', 'Max', 'Sum' - /// the range of time in which instance data - /// is collected. This value must be greater than the delay in metric - /// collection, which can vary from resource-to-resource. Must be - /// between 12 hours and 5 minutes. - /// time aggregation type. How the data - /// that is collected should be combined over time. The default value - /// is Average. Possible values include: 'Average', 'Minimum', - /// 'Maximum', 'Total', 'Count', 'Last' - /// the operator that is used to compare - /// the metric data and the threshold. Possible values include: - /// 'Equals', 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', - /// 'LessThan', 'LessThanOrEqual' - /// the threshold of the metric that triggers - /// the scale action. - /// the namespace of the metric that - /// defines what the rule monitors. - /// List of dimension conditions. For example: - /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - public MetricTrigger(string metricName, string metricResourceUri, System.TimeSpan timeGrain, MetricStatisticType statistic, System.TimeSpan timeWindow, TimeAggregationType timeAggregation, ComparisonOperationType operatorProperty, double threshold, string metricNamespace = default(string), IList dimensions = default(IList)) - { - MetricName = metricName; - MetricNamespace = metricNamespace; - MetricResourceUri = metricResourceUri; - TimeGrain = timeGrain; - Statistic = statistic; - TimeWindow = timeWindow; - TimeAggregation = timeAggregation; - OperatorProperty = operatorProperty; - Threshold = threshold; - Dimensions = dimensions; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the metric that defines what the rule - /// monitors. - /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } - - /// - /// Gets or sets the namespace of the metric that defines what the rule - /// monitors. - /// - [JsonProperty(PropertyName = "metricNamespace")] - public string MetricNamespace { get; set; } - - /// - /// Gets or sets the resource identifier of the resource the rule - /// monitors. - /// - [JsonProperty(PropertyName = "metricResourceUri")] - public string MetricResourceUri { get; set; } - - /// - /// Gets or sets the granularity of metrics the rule monitors. Must be - /// one of the predefined values returned from metric definitions for - /// the metric. Must be between 12 hours and 1 minute. - /// - [JsonProperty(PropertyName = "timeGrain")] - public System.TimeSpan TimeGrain { get; set; } - - /// - /// Gets or sets the metric statistic type. How the metrics from - /// multiple instances are combined. Possible values include: - /// 'Average', 'Min', 'Max', 'Sum' - /// - [JsonProperty(PropertyName = "statistic")] - public MetricStatisticType Statistic { get; set; } - - /// - /// Gets or sets the range of time in which instance data is collected. - /// This value must be greater than the delay in metric collection, - /// which can vary from resource-to-resource. Must be between 12 hours - /// and 5 minutes. - /// - [JsonProperty(PropertyName = "timeWindow")] - public System.TimeSpan TimeWindow { get; set; } - - /// - /// Gets or sets time aggregation type. How the data that is collected - /// should be combined over time. The default value is Average. - /// Possible values include: 'Average', 'Minimum', 'Maximum', 'Total', - /// 'Count', 'Last' - /// - [JsonProperty(PropertyName = "timeAggregation")] - public TimeAggregationType TimeAggregation { get; set; } - - /// - /// Gets or sets the operator that is used to compare the metric data - /// and the threshold. Possible values include: 'Equals', 'NotEquals', - /// 'GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - /// - [JsonProperty(PropertyName = "operator")] - public ComparisonOperationType OperatorProperty { get; set; } - - /// - /// Gets or sets the threshold of the metric that triggers the scale - /// action. - /// - [JsonProperty(PropertyName = "threshold")] - public double Threshold { get; set; } - - /// - /// Gets or sets list of dimension conditions. For example: - /// [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (MetricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); - } - if (MetricResourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricResourceUri"); - } - if (Dimensions != null) - { - foreach (var element in Dimensions) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricTriggerType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricTriggerType.cs deleted file mode 100644 index 24af791a1b584..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricTriggerType.cs +++ /dev/null @@ -1,22 +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.Monitor.Models -{ - - /// - /// Defines values for MetricTriggerType. - /// - public static class MetricTriggerType - { - public const string Consecutive = "Consecutive"; - public const string Total = "Total"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricValue.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricValue.cs deleted file mode 100644 index 01180a7f26344..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MetricValue.cs +++ /dev/null @@ -1,107 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Represents a metric value. - /// - public partial class MetricValue - { - /// - /// Initializes a new instance of the MetricValue class. - /// - public MetricValue() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MetricValue class. - /// - /// the timestamp for the metric value in ISO - /// 8601 format. - /// the average value in the time range. - /// the least value in the time range. - /// the greatest value in the time range. - /// the sum of all of the values in the time - /// range. - /// the number of samples in the time range. Can be - /// used to determine the number of values that contributed to the - /// average value. - public MetricValue(System.DateTime timeStamp, double? average = default(double?), double? minimum = default(double?), double? maximum = default(double?), double? total = default(double?), double? count = default(double?)) - { - TimeStamp = timeStamp; - Average = average; - Minimum = minimum; - Maximum = maximum; - Total = total; - Count = count; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the timestamp for the metric value in ISO 8601 format. - /// - [JsonProperty(PropertyName = "timeStamp")] - public System.DateTime TimeStamp { get; set; } - - /// - /// Gets or sets the average value in the time range. - /// - [JsonProperty(PropertyName = "average")] - public double? Average { get; set; } - - /// - /// Gets or sets the least value in the time range. - /// - [JsonProperty(PropertyName = "minimum")] - public double? Minimum { get; set; } - - /// - /// Gets or sets the greatest value in the time range. - /// - [JsonProperty(PropertyName = "maximum")] - public double? Maximum { get; set; } - - /// - /// Gets or sets the sum of all of the values in the time range. - /// - [JsonProperty(PropertyName = "total")] - public double? Total { get; set; } - - /// - /// Gets or sets the number of samples in the time range. Can be used - /// to determine the number of values that contributed to the average - /// value. - /// - [JsonProperty(PropertyName = "count")] - public double? Count { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MultiMetricCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MultiMetricCriteria.cs deleted file mode 100644 index f83400684fce2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/MultiMetricCriteria.cs +++ /dev/null @@ -1,139 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The types of conditions for a multi resource alert. - /// - public partial class MultiMetricCriteria - { - /// - /// Initializes a new instance of the MultiMetricCriteria class. - /// - public MultiMetricCriteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the MultiMetricCriteria class. - /// - /// Name of the criteria. - /// Name of the metric. - /// the criteria time aggregation - /// types. - /// Unmatched properties from the - /// message are deserialized this collection - /// Namespace of the metric. - /// List of dimension conditions. - /// Allows creating an alert rule on - /// a custom metric that isn't yet emitted, by causing the metric - /// validation to be skipped. - public MultiMetricCriteria(string name, string metricName, object timeAggregation, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), bool? skipMetricValidation = default(bool?)) - { - AdditionalProperties = additionalProperties; - Name = name; - MetricName = metricName; - MetricNamespace = metricNamespace; - TimeAggregation = timeAggregation; - Dimensions = dimensions; - SkipMetricValidation = skipMetricValidation; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets unmatched properties from the message are deserialized - /// this collection - /// - [JsonExtensionData] - public IDictionary AdditionalProperties { get; set; } - - /// - /// Gets or sets name of the criteria. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets name of the metric. - /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } - - /// - /// Gets or sets namespace of the metric. - /// - [JsonProperty(PropertyName = "metricNamespace")] - public string MetricNamespace { get; set; } - - /// - /// Gets or sets the criteria time aggregation types. - /// - [JsonProperty(PropertyName = "timeAggregation")] - public object TimeAggregation { get; set; } - - /// - /// Gets or sets list of dimension conditions. - /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } - - /// - /// Gets or sets allows creating an alert rule on a custom metric that - /// isn't yet emitted, by causing the metric validation to be skipped. - /// - [JsonProperty(PropertyName = "skipMetricValidation")] - public bool? SkipMetricValidation { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (MetricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); - } - if (TimeAggregation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TimeAggregation"); - } - if (Dimensions != null) - { - foreach (var element in Dimensions) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OnboardingStatus.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OnboardingStatus.cs deleted file mode 100644 index fe77b339b6df9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OnboardingStatus.cs +++ /dev/null @@ -1,23 +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.Monitor.Models -{ - - /// - /// Defines values for OnboardingStatus. - /// - public static class OnboardingStatus - { - public const string Onboarded = "onboarded"; - public const string NotOnboarded = "notOnboarded"; - public const string Unknown = "unknown"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Operation.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Operation.cs deleted file mode 100644 index 36aaffbdcbcba..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Operation.cs +++ /dev/null @@ -1,61 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Microsoft Insights API operation definition. - /// - 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationDisplay.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationDisplay.cs deleted file mode 100644 index 5276f6f486215..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationDisplay.cs +++ /dev/null @@ -1,70 +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.Monitor.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.Insights - /// Resource on which the operation is - /// performed: AlertRules, Autoscale, etc. - /// Operation type: Read, write, 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.Insights - /// - [JsonProperty(PropertyName = "provider")] - public string Provider { get; set; } - - /// - /// Gets or sets resource on which the operation is performed: - /// AlertRules, Autoscale, etc. - /// - [JsonProperty(PropertyName = "resource")] - public string Resource { get; set; } - - /// - /// Gets or sets operation type: Read, write, delete, etc. - /// - [JsonProperty(PropertyName = "operation")] - public string Operation { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationListResult.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationListResult.cs deleted file mode 100644 index 010df5c4c1926..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationListResult.cs +++ /dev/null @@ -1,67 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Result of the request to list Microsoft.Insights operations. It - /// contains a list of operations and a URL link to get the next set of - /// results. - /// - public partial class OperationListResult - { - /// - /// Initializes a new instance of the OperationListResult class. - /// - public OperationListResult() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationListResult class. - /// - /// List of operations supported by the - /// Microsoft.Insights provider. - /// URL to get the next set of operation list - /// results if there are any. - public OperationListResult(IList value = default(IList), string nextLink = default(string)) - { - Value = value; - NextLink = nextLink; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of operations supported by the Microsoft.Insights - /// provider. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - /// - /// Gets or sets URL to get the next set of operation list results if - /// there are any. - /// - [JsonProperty(PropertyName = "nextLink")] - public string NextLink { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationStatus.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationStatus.cs deleted file mode 100644 index 083acf9836947..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperationStatus.cs +++ /dev/null @@ -1,94 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The status of operation. - /// - public partial class OperationStatus - { - /// - /// Initializes a new instance of the OperationStatus class. - /// - public OperationStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the OperationStatus class. - /// - /// The operation Id. - /// The operation name. - /// Start time of the job in standard ISO8601 - /// format. - /// End time of the job in standard ISO8601 - /// format. - /// The status of the operation. - /// The error detail of the operation if - /// any. - public OperationStatus(string id = default(string), string name = default(string), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string status = default(string), ErrorResponseCommon error = default(ErrorResponseCommon)) - { - Id = id; - Name = name; - StartTime = startTime; - EndTime = endTime; - Status = status; - Error = error; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the operation Id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the operation name. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets start time of the job in standard ISO8601 format. - /// - [JsonProperty(PropertyName = "startTime")] - public System.DateTime? StartTime { get; set; } - - /// - /// Gets or sets end time of the job in standard ISO8601 format. - /// - [JsonProperty(PropertyName = "endTime")] - public System.DateTime? EndTime { get; set; } - - /// - /// Gets or sets the status of the operation. - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets the error detail of the operation if any. - /// - [JsonProperty(PropertyName = "error")] - public ErrorResponseCommon Error { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperatorModel.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperatorModel.cs deleted file mode 100644 index eff94a69a45d3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/OperatorModel.cs +++ /dev/null @@ -1,26 +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.Monitor.Models -{ - - /// - /// Defines values for OperatorModel. - /// - public static class OperatorModel - { - public const string Equals = "Equals"; - public const string NotEquals = "NotEquals"; - public const string GreaterThan = "GreaterThan"; - public const string GreaterThanOrEqual = "GreaterThanOrEqual"; - public const string LessThan = "LessThan"; - public const string LessThanOrEqual = "LessThanOrEqual"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Page1.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Page1.cs deleted file mode 100644 index 8eb5b9de7c3e8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Page1.cs +++ /dev/null @@ -1,53 +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.Monitor.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 - [JsonObject] - public class Page1 : IPage - { - /// - /// Gets the link to the next page. - /// - [JsonProperty("")] - public string NextPageLink { get; private 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 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. - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs deleted file mode 100644 index 6d519443ccec2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PerfCounterDataSource.cs +++ /dev/null @@ -1,143 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of which performance counters will be collected and how they - /// will be collected by this data collection rule. - /// Collected from both Windows and Linux machines where the counter is - /// present. - /// - public partial class PerfCounterDataSource - { - /// - /// Initializes a new instance of the PerfCounterDataSource class. - /// - public PerfCounterDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PerfCounterDataSource class. - /// - /// List of streams that this data source will be - /// sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent - /// to. - /// The interval between data - /// uploads (scheduled transfers), rounded up to the nearest minute. - /// Possible values include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', - /// 'PT60M' - /// The number of seconds - /// between consecutive counter measurements (samples). - /// A list of specifier names of the - /// performance counters you want to collect. - /// Use a wildcard (*) to collect a counter for all instances. - /// To get a list of performance counters on Windows, run the command - /// 'typeperf'. - /// A friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - public PerfCounterDataSource(IList streams, string scheduledTransferPeriod, int samplingFrequencyInSeconds, IList counterSpecifiers, string name) - { - Streams = streams; - ScheduledTransferPeriod = scheduledTransferPeriod; - SamplingFrequencyInSeconds = samplingFrequencyInSeconds; - CounterSpecifiers = counterSpecifiers; - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of streams that this data source will be sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent to. - /// - [JsonProperty(PropertyName = "streams")] - public IList Streams { get; set; } - - /// - /// Gets or sets the interval between data uploads (scheduled - /// transfers), rounded up to the nearest minute. Possible values - /// include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', 'PT60M' - /// - [JsonProperty(PropertyName = "scheduledTransferPeriod")] - public string ScheduledTransferPeriod { get; set; } - - /// - /// Gets or sets the number of seconds between consecutive counter - /// measurements (samples). - /// - [JsonProperty(PropertyName = "samplingFrequencyInSeconds")] - public int SamplingFrequencyInSeconds { get; set; } - - /// - /// Gets or sets a list of specifier names of the performance counters - /// you want to collect. - /// Use a wildcard (*) to collect a counter for all instances. - /// To get a list of performance counters on Windows, run the command - /// 'typeperf'. - /// - [JsonProperty(PropertyName = "counterSpecifiers")] - public IList CounterSpecifiers { get; set; } - - /// - /// Gets or sets a friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Streams == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); - } - if (ScheduledTransferPeriod == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ScheduledTransferPeriod"); - } - if (CounterSpecifiers == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CounterSpecifiers"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (SamplingFrequencyInSeconds > 30) - { - throw new ValidationException(ValidationRules.InclusiveMaximum, "SamplingFrequencyInSeconds", 30); - } - if (SamplingFrequencyInSeconds < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "SamplingFrequencyInSeconds", 1); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointConnection.cs deleted file mode 100644 index 92815fd0af437..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointConnection.cs +++ /dev/null @@ -1,90 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A private endpoint connection - /// - [Rest.Serialization.JsonTransformation] - public partial class PrivateEndpointConnection : ProxyResource - { - /// - /// Initializes a new instance of the PrivateEndpointConnection class. - /// - public PrivateEndpointConnection() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateEndpointConnection class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Private endpoint which the connection - /// belongs to. - /// Connection state of - /// the private endpoint connection. - /// State of the private endpoint - /// connection. - public PrivateEndpointConnection(string id = default(string), string name = default(string), string type = default(string), PrivateEndpointProperty privateEndpoint = default(PrivateEndpointProperty), PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = default(PrivateLinkServiceConnectionStateProperty), string provisioningState = default(string)) - : base(id, name, type) - { - PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets private endpoint which the connection belongs to. - /// - [JsonProperty(PropertyName = "properties.privateEndpoint")] - public PrivateEndpointProperty PrivateEndpoint { get; set; } - - /// - /// Gets or sets connection state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] - public PrivateLinkServiceConnectionStateProperty PrivateLinkServiceConnectionState { get; set; } - - /// - /// Gets state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (PrivateLinkServiceConnectionState != null) - { - PrivateLinkServiceConnectionState.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointProperty.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointProperty.cs deleted file mode 100644 index 58ffe77bb549d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateEndpointProperty.cs +++ /dev/null @@ -1,51 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Private endpoint which the connection belongs to. - /// - public partial class PrivateEndpointProperty - { - /// - /// Initializes a new instance of the PrivateEndpointProperty class. - /// - public PrivateEndpointProperty() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateEndpointProperty class. - /// - /// Resource id of the private endpoint. - public PrivateEndpointProperty(string id = default(string)) - { - Id = id; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource id of the private endpoint. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkResource.cs deleted file mode 100644 index 7c2dae65de48f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkResource.cs +++ /dev/null @@ -1,69 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A private link resource - /// - [Rest.Serialization.JsonTransformation] - public partial class PrivateLinkResource : ProxyResource - { - /// - /// Initializes a new instance of the PrivateLinkResource class. - /// - public PrivateLinkResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateLinkResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// The private link resource group id. - /// The private link resource required - /// member names. - public PrivateLinkResource(string id = default(string), string name = default(string), string type = default(string), string groupId = default(string), IList requiredMembers = default(IList)) - : base(id, name, type) - { - GroupId = groupId; - RequiredMembers = requiredMembers; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets the private link resource group id. - /// - [JsonProperty(PropertyName = "properties.groupId")] - public string GroupId { get; private set; } - - /// - /// Gets the private link resource required member names. - /// - [JsonProperty(PropertyName = "properties.requiredMembers")] - public IList RequiredMembers { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkScopesResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkScopesResource.cs deleted file mode 100644 index ef895d3807606..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkScopesResource.cs +++ /dev/null @@ -1,100 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// An azure resource object - /// - public partial class PrivateLinkScopesResource : IResource - { - /// - /// Initializes a new instance of the PrivateLinkScopesResource class. - /// - public PrivateLinkScopesResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the PrivateLinkScopesResource class. - /// - /// Resource location - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Resource tags - public PrivateLinkScopesResource(string location, string id = default(string), string name = default(string), string type = 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 azure resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets azure resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets azure resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - /// - /// Gets or sets resource location - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs deleted file mode 100644 index 887acba7f23a4..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/PrivateLinkServiceConnectionStateProperty.cs +++ /dev/null @@ -1,90 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// State of the private endpoint connection. - /// - public partial class PrivateLinkServiceConnectionStateProperty - { - /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. - /// - public PrivateLinkServiceConnectionStateProperty() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// PrivateLinkServiceConnectionStateProperty class. - /// - /// The private link service connection - /// status. - /// The private link service connection - /// description. - /// The actions required for private link - /// service connection. - public PrivateLinkServiceConnectionStateProperty(string status, string description, string actionsRequired = default(string)) - { - Status = status; - Description = description; - ActionsRequired = actionsRequired; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the private link service connection status. - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets the private link service connection description. - /// - [JsonProperty(PropertyName = "description")] - public string Description { get; set; } - - /// - /// Gets the actions required for private link service connection. - /// - [JsonProperty(PropertyName = "actionsRequired")] - public string ActionsRequired { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Status == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Status"); - } - if (Description == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Description"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProvisioningState.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProvisioningState.cs deleted file mode 100644 index 2ee59caf6da64..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProvisioningState.cs +++ /dev/null @@ -1,24 +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.Monitor.Models -{ - - /// - /// Defines values for ProvisioningState. - /// - public static class ProvisioningState - { - public const string Succeeded = "Succeeded"; - public const string Deploying = "Deploying"; - public const string Canceled = "Canceled"; - public const string Failed = "Failed"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProxyOnlyResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProxyOnlyResource.cs deleted file mode 100644 index cd2757f49843c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProxyOnlyResource.cs +++ /dev/null @@ -1,69 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A proxy only azure resource object - /// - public partial class ProxyOnlyResource : IResource - { - /// - /// Initializes a new instance of the ProxyOnlyResource class. - /// - public ProxyOnlyResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProxyOnlyResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - public ProxyOnlyResource(string id = default(string), string name = default(string), string type = default(string)) - { - Id = id; - Name = name; - Type = type; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets azure resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets azure resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProxyResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProxyResource.cs deleted file mode 100644 index 18a5c4e49cde8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ProxyResource.cs +++ /dev/null @@ -1,69 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An azure resource object - /// - public partial class ProxyResource : IResource - { - /// - /// Initializes a new instance of the ProxyResource class. - /// - public ProxyResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ProxyResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) - { - Id = id; - Name = name; - Type = type; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets azure resource Id - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; private set; } - - /// - /// Gets azure resource name - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; private set; } - - /// - /// Gets azure resource type - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/QueryType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/QueryType.cs deleted file mode 100644 index 0902482ca98a3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/QueryType.cs +++ /dev/null @@ -1,21 +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.Monitor.Models -{ - - /// - /// Defines values for QueryType. - /// - public static class QueryType - { - public const string ResultCount = "ResultCount"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ReceiverStatus.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ReceiverStatus.cs deleted file mode 100644 index 1cfd443df30ea..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ReceiverStatus.cs +++ /dev/null @@ -1,66 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ReceiverStatus. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ReceiverStatus - { - [EnumMember(Value = "NotSpecified")] - NotSpecified, - [EnumMember(Value = "Enabled")] - Enabled, - [EnumMember(Value = "Disabled")] - Disabled - } - internal static class ReceiverStatusEnumExtension - { - internal static string ToSerializedValue(this ReceiverStatus? value) - { - return value == null ? null : ((ReceiverStatus)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ReceiverStatus value) - { - switch( value ) - { - case ReceiverStatus.NotSpecified: - return "NotSpecified"; - case ReceiverStatus.Enabled: - return "Enabled"; - case ReceiverStatus.Disabled: - return "Disabled"; - } - return null; - } - - internal static ReceiverStatus? ParseReceiverStatus(this string value) - { - switch( value ) - { - case "NotSpecified": - return ReceiverStatus.NotSpecified; - case "Enabled": - return ReceiverStatus.Enabled; - case "Disabled": - return ReceiverStatus.Disabled; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Recurrence.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Recurrence.cs deleted file mode 100644 index 040810a5ece6f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Recurrence.cs +++ /dev/null @@ -1,92 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The repeating times at which this profile begins. This element is not - /// used if the FixedDate element is used. - /// - public partial class Recurrence - { - /// - /// Initializes a new instance of the Recurrence class. - /// - public Recurrence() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Recurrence class. - /// - /// the recurrence frequency. How often the - /// schedule profile should take effect. This value must be Week, - /// meaning each week will have the same set of profiles. For example, - /// to set a daily schedule, set **schedule** to every day of the week. - /// The frequency property specifies that the schedule is repeated - /// weekly. Possible values include: 'None', 'Second', 'Minute', - /// 'Hour', 'Day', 'Week', 'Month', 'Year' - /// the scheduling constraints for when the - /// profile begins. - public Recurrence(RecurrenceFrequency frequency, RecurrentSchedule schedule) - { - Frequency = frequency; - Schedule = schedule; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the recurrence frequency. How often the schedule - /// profile should take effect. This value must be Week, meaning each - /// week will have the same set of profiles. For example, to set a - /// daily schedule, set **schedule** to every day of the week. The - /// frequency property specifies that the schedule is repeated weekly. - /// Possible values include: 'None', 'Second', 'Minute', 'Hour', 'Day', - /// 'Week', 'Month', 'Year' - /// - [JsonProperty(PropertyName = "frequency")] - public RecurrenceFrequency Frequency { get; set; } - - /// - /// Gets or sets the scheduling constraints for when the profile - /// begins. - /// - [JsonProperty(PropertyName = "schedule")] - public RecurrentSchedule Schedule { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Schedule == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Schedule"); - } - if (Schedule != null) - { - Schedule.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RecurrenceFrequency.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RecurrenceFrequency.cs deleted file mode 100644 index 27b48299752aa..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RecurrenceFrequency.cs +++ /dev/null @@ -1,96 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for RecurrenceFrequency. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum RecurrenceFrequency - { - [EnumMember(Value = "None")] - None, - [EnumMember(Value = "Second")] - Second, - [EnumMember(Value = "Minute")] - Minute, - [EnumMember(Value = "Hour")] - Hour, - [EnumMember(Value = "Day")] - Day, - [EnumMember(Value = "Week")] - Week, - [EnumMember(Value = "Month")] - Month, - [EnumMember(Value = "Year")] - Year - } - internal static class RecurrenceFrequencyEnumExtension - { - internal static string ToSerializedValue(this RecurrenceFrequency? value) - { - return value == null ? null : ((RecurrenceFrequency)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this RecurrenceFrequency value) - { - switch( value ) - { - case RecurrenceFrequency.None: - return "None"; - case RecurrenceFrequency.Second: - return "Second"; - case RecurrenceFrequency.Minute: - return "Minute"; - case RecurrenceFrequency.Hour: - return "Hour"; - case RecurrenceFrequency.Day: - return "Day"; - case RecurrenceFrequency.Week: - return "Week"; - case RecurrenceFrequency.Month: - return "Month"; - case RecurrenceFrequency.Year: - return "Year"; - } - return null; - } - - internal static RecurrenceFrequency? ParseRecurrenceFrequency(this string value) - { - switch( value ) - { - case "None": - return RecurrenceFrequency.None; - case "Second": - return RecurrenceFrequency.Second; - case "Minute": - return RecurrenceFrequency.Minute; - case "Hour": - return RecurrenceFrequency.Hour; - case "Day": - return RecurrenceFrequency.Day; - case "Week": - return RecurrenceFrequency.Week; - case "Month": - return RecurrenceFrequency.Month; - case "Year": - return RecurrenceFrequency.Year; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RecurrentSchedule.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RecurrentSchedule.cs deleted file mode 100644 index 5003472be5035..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RecurrentSchedule.cs +++ /dev/null @@ -1,194 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The scheduling constraints for when the profile begins. - /// - public partial class RecurrentSchedule - { - /// - /// Initializes a new instance of the RecurrentSchedule class. - /// - public RecurrentSchedule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RecurrentSchedule class. - /// - /// the timezone for the hours of the profile. - /// Some examples of valid time zones are: Dateline Standard Time, - /// UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific - /// Standard Time (Mexico), Pacific Standard Time, US Mountain Standard - /// Time, Mountain Standard Time (Mexico), Mountain Standard Time, - /// Central America Standard Time, Central Standard Time, Central - /// Standard Time (Mexico), Canada Central Standard Time, SA Pacific - /// Standard Time, Eastern Standard Time, US Eastern Standard Time, - /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard - /// Time, Central Brazilian Standard Time, SA Western Standard Time, - /// Pacific SA Standard Time, Newfoundland Standard Time, E. South - /// America Standard Time, Argentina Standard Time, SA Eastern Standard - /// Time, Greenland Standard Time, Montevideo Standard Time, Bahia - /// Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard - /// Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT - /// Standard Time, Greenwich Standard Time, W. Europe Standard Time, - /// Central Europe Standard Time, Romance Standard Time, Central - /// European Standard Time, W. Central Africa Standard Time, Namibia - /// Standard Time, Jordan Standard Time, GTB Standard Time, Middle East - /// Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe - /// Standard Time, South Africa Standard Time, FLE Standard Time, - /// Turkey Standard Time, Israel Standard Time, Kaliningrad Standard - /// Time, Libya Standard Time, Arabic Standard Time, Arab Standard - /// Time, Belarus Standard Time, Russian Standard Time, E. Africa - /// Standard Time, Iran Standard Time, Arabian Standard Time, - /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard - /// Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan - /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, - /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard - /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh - /// Standard Time, N. Central Asia Standard Time, Myanmar Standard - /// Time, SE Asia Standard Time, North Asia Standard Time, China - /// Standard Time, North Asia East Standard Time, Singapore Standard - /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar - /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk - /// Standard Time, Cen. Australia Standard Time, AUS Central Standard - /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West - /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard - /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central - /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - /// Standard Time, Samoa Standard Time, Line Islands Standard - /// Time - /// the collection of days that the profile takes - /// effect on. Possible values are Sunday through Saturday. - /// A collection of hours that the profile takes - /// effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM - /// times are not supported). - /// A collection of minutes at which the profile - /// takes effect at. - public RecurrentSchedule(string timeZone, IList days, IList hours, IList minutes) - { - TimeZone = timeZone; - Days = days; - Hours = hours; - Minutes = minutes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the timezone for the hours of the profile. Some - /// examples of valid time zones are: Dateline Standard Time, UTC-11, - /// Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard - /// Time (Mexico), Pacific Standard Time, US Mountain Standard Time, - /// Mountain Standard Time (Mexico), Mountain Standard Time, Central - /// America Standard Time, Central Standard Time, Central Standard Time - /// (Mexico), Canada Central Standard Time, SA Pacific Standard Time, - /// Eastern Standard Time, US Eastern Standard Time, Venezuela Standard - /// Time, Paraguay Standard Time, Atlantic Standard Time, Central - /// Brazilian Standard Time, SA Western Standard Time, Pacific SA - /// Standard Time, Newfoundland Standard Time, E. South America - /// Standard Time, Argentina Standard Time, SA Eastern Standard Time, - /// Greenland Standard Time, Montevideo Standard Time, Bahia Standard - /// Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, - /// Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard - /// Time, Greenwich Standard Time, W. Europe Standard Time, Central - /// Europe Standard Time, Romance Standard Time, Central European - /// Standard Time, W. Central Africa Standard Time, Namibia Standard - /// Time, Jordan Standard Time, GTB Standard Time, Middle East Standard - /// Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard - /// Time, South Africa Standard Time, FLE Standard Time, Turkey - /// Standard Time, Israel Standard Time, Kaliningrad Standard Time, - /// Libya Standard Time, Arabic Standard Time, Arab Standard Time, - /// Belarus Standard Time, Russian Standard Time, E. Africa Standard - /// Time, Iran Standard Time, Arabian Standard Time, Azerbaijan - /// Standard Time, Russia Time Zone 3, Mauritius Standard Time, - /// Georgian Standard Time, Caucasus Standard Time, Afghanistan - /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, - /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard - /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh - /// Standard Time, N. Central Asia Standard Time, Myanmar Standard - /// Time, SE Asia Standard Time, North Asia Standard Time, China - /// Standard Time, North Asia East Standard Time, Singapore Standard - /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar - /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk - /// Standard Time, Cen. Australia Standard Time, AUS Central Standard - /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West - /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard - /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central - /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - /// Standard Time, Samoa Standard Time, Line Islands Standard Time - /// - [JsonProperty(PropertyName = "timeZone")] - public string TimeZone { get; set; } - - /// - /// Gets or sets the collection of days that the profile takes effect - /// on. Possible values are Sunday through Saturday. - /// - [JsonProperty(PropertyName = "days")] - public IList Days { get; set; } - - /// - /// Gets or sets a collection of hours that the profile takes effect - /// on. Values supported are 0 to 23 on the 24-hour clock (AM/PM times - /// are not supported). - /// - [JsonProperty(PropertyName = "hours")] - public IList Hours { get; set; } - - /// - /// Gets or sets a collection of minutes at which the profile takes - /// effect at. - /// - [JsonProperty(PropertyName = "minutes")] - public IList Minutes { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (TimeZone == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TimeZone"); - } - if (Days == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Days"); - } - if (Hours == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Hours"); - } - if (Minutes == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Minutes"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs deleted file mode 100644 index 5c42e64be82b1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResourceForUpdate.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of ARM tracked top level resource properties for update - /// operation. - /// - public partial class ResourceForUpdate - { - /// - /// Initializes a new instance of the ResourceForUpdate class. - /// - public ResourceForUpdate() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResourceForUpdate class. - /// - /// Resource tags. - public ResourceForUpdate(IDictionary tags = default(IDictionary)) - { - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Response.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Response.cs deleted file mode 100644 index 93627a8a00db1..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Response.cs +++ /dev/null @@ -1,141 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The response to a metrics query. - /// - public partial class Response - { - /// - /// Initializes a new instance of the Response class. - /// - public Response() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Response class. - /// - /// The timespan for which the data was - /// retrieved. Its value consists of two datetimes concatenated, - /// separated by '/'. This may be adjusted in the future and returned - /// back from what was originally requested. - /// the value of the collection. - /// The integer value representing the cost of the - /// query, for data case. - /// The interval (window size) for which the - /// metric data was returned in. This may be adjusted in the future - /// and returned back from what was originally requested. This is not - /// present if a metadata request was made. - /// The namespace of the metrics been - /// queried - /// The region of the resource been - /// queried for metrics. - public Response(string timespan, IList value, double? cost = default(double?), System.TimeSpan? interval = default(System.TimeSpan?), string namespaceProperty = default(string), string resourceregion = default(string)) - { - Cost = cost; - Timespan = timespan; - Interval = interval; - NamespaceProperty = namespaceProperty; - Resourceregion = resourceregion; - Value = value; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the integer value representing the cost of the query, - /// for data case. - /// - [JsonProperty(PropertyName = "cost")] - public double? Cost { get; set; } - - /// - /// Gets or sets the timespan for which the data was retrieved. Its - /// value consists of two datetimes concatenated, separated by '/'. - /// This may be adjusted in the future and returned back from what was - /// originally requested. - /// - [JsonProperty(PropertyName = "timespan")] - public string Timespan { get; set; } - - /// - /// Gets or sets the interval (window size) for which the metric data - /// was returned in. This may be adjusted in the future and returned - /// back from what was originally requested. This is not present if a - /// metadata request was made. - /// - [JsonProperty(PropertyName = "interval")] - public System.TimeSpan? Interval { get; set; } - - /// - /// Gets or sets the namespace of the metrics been queried - /// - [JsonProperty(PropertyName = "namespace")] - public string NamespaceProperty { get; set; } - - /// - /// Gets or sets the region of the resource been queried for metrics. - /// - [JsonProperty(PropertyName = "resourceregion")] - public string Resourceregion { get; set; } - - /// - /// Gets or sets the value of the collection. - /// - [JsonProperty(PropertyName = "value")] - public IList Value { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Timespan == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Timespan"); - } - if (Value == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Value"); - } - if (Cost < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Cost", 0); - } - if (Value != null) - { - foreach (var element in Value) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResponseWithError.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResponseWithError.cs deleted file mode 100644 index 833cc30f86bd4..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResponseWithError.cs +++ /dev/null @@ -1,69 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An error response from the API. - /// - public partial class ResponseWithError - { - /// - /// Initializes a new instance of the ResponseWithError class. - /// - public ResponseWithError() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ResponseWithError class. - /// - /// Error information. - public ResponseWithError(Error error) - { - Error = error; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets error information. - /// - [JsonProperty(PropertyName = "error")] - public Error Error { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Error == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Error"); - } - if (Error != null) - { - Error.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResponseWithErrorException.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResponseWithErrorException.cs deleted file mode 100644 index 967932a47a430..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResponseWithErrorException.cs +++ /dev/null @@ -1,62 +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.Monitor.Models -{ - using Microsoft.Rest; - - /// - /// Exception thrown for an invalid response with ResponseWithError - /// information. - /// - public partial class ResponseWithErrorException : RestException - { - /// - /// Gets information about the associated HTTP request. - /// - public HttpRequestMessageWrapper Request { get; set; } - - /// - /// Gets information about the associated HTTP response. - /// - public HttpResponseMessageWrapper Response { get; set; } - - /// - /// Gets or sets the body object. - /// - public ResponseWithError Body { get; set; } - - /// - /// Initializes a new instance of the ResponseWithErrorException class. - /// - public ResponseWithErrorException() - { - } - - /// - /// Initializes a new instance of the ResponseWithErrorException class. - /// - /// The exception message. - public ResponseWithErrorException(string message) - : this(message, null) - { - } - - /// - /// Initializes a new instance of the ResponseWithErrorException class. - /// - /// The exception message. - /// Inner exception. - public ResponseWithErrorException(string message, System.Exception innerException) - : base(message, innerException) - { - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResultType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResultType.cs deleted file mode 100644 index d0133162a5210..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ResultType.cs +++ /dev/null @@ -1,60 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ResultType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ResultType - { - [EnumMember(Value = "Data")] - Data, - [EnumMember(Value = "Metadata")] - Metadata - } - internal static class ResultTypeEnumExtension - { - internal static string ToSerializedValue(this ResultType? value) - { - return value == null ? null : ((ResultType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ResultType value) - { - switch( value ) - { - case ResultType.Data: - return "Data"; - case ResultType.Metadata: - return "Metadata"; - } - return null; - } - - internal static ResultType? ParseResultType(this string value) - { - switch( value ) - { - case "Data": - return ResultType.Data; - case "Metadata": - return ResultType.Metadata; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RetentionPolicy.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RetentionPolicy.cs deleted file mode 100644 index 683b0b6aa07a5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RetentionPolicy.cs +++ /dev/null @@ -1,77 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Specifies the retention policy for the log. - /// - public partial class RetentionPolicy - { - /// - /// Initializes a new instance of the RetentionPolicy class. - /// - public RetentionPolicy() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RetentionPolicy class. - /// - /// a value indicating whether the retention - /// policy is enabled. - /// the number of days for the retention in days. A - /// value of 0 will retain the events indefinitely. - public RetentionPolicy(bool enabled, int days) - { - Enabled = enabled; - Days = days; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets a value indicating whether the retention policy is - /// enabled. - /// - [JsonProperty(PropertyName = "enabled")] - public bool Enabled { get; set; } - - /// - /// Gets or sets the number of days for the retention in days. A value - /// of 0 will retain the events indefinitely. - /// - [JsonProperty(PropertyName = "days")] - public int Days { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Days < 0) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "Days", 0); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleAction.cs deleted file mode 100644 index 5343ce85fdd69..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleAction.cs +++ /dev/null @@ -1,36 +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.Monitor.Models -{ - using System.Linq; - - /// - /// The action that is performed when the alert rule becomes active, and - /// when an alert condition is resolved. - /// - public partial class RuleAction - { - /// - /// Initializes a new instance of the RuleAction class. - /// - public RuleAction() - { - CustomInit(); - } - - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleCondition.cs deleted file mode 100644 index a784e064f69b8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleCondition.cs +++ /dev/null @@ -1,55 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The condition that results in the alert rule being activated. - /// - public partial class RuleCondition - { - /// - /// Initializes a new instance of the RuleCondition class. - /// - public RuleCondition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleCondition class. - /// - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. - public RuleCondition(RuleDataSource dataSource = default(RuleDataSource)) - { - DataSource = dataSource; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource from which the rule collects its data. - /// For this type dataSource will always be of type - /// RuleMetricDataSource. - /// - [JsonProperty(PropertyName = "dataSource")] - public RuleDataSource DataSource { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleDataSource.cs deleted file mode 100644 index 64f93af629caa..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleDataSource.cs +++ /dev/null @@ -1,55 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The resource from which the rule collects its data. - /// - public partial class RuleDataSource - { - /// - /// Initializes a new instance of the RuleDataSource class. - /// - public RuleDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleDataSource class. - /// - /// the resource identifier of the resource - /// the rule monitors. **NOTE**: this property cannot be updated for an - /// existing rule. - public RuleDataSource(string resourceUri = default(string)) - { - ResourceUri = resourceUri; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource identifier of the resource the rule - /// monitors. **NOTE**: this property cannot be updated for an existing - /// rule. - /// - [JsonProperty(PropertyName = "resourceUri")] - public string ResourceUri { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleEmailAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleEmailAction.cs deleted file mode 100644 index 5c8972fa6decb..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleEmailAction.cs +++ /dev/null @@ -1,69 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the action to send email when the rule condition is - /// evaluated. The discriminator is always RuleEmailAction in this case. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleEmailAction")] - public partial class RuleEmailAction : RuleAction - { - /// - /// Initializes a new instance of the RuleEmailAction class. - /// - public RuleEmailAction() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleEmailAction class. - /// - /// Whether the administrators - /// (service and co-administrators) of the service should be notified - /// when the alert is activated. - /// the list of administrator's custom email - /// addresses to notify of the activation of the alert. - public RuleEmailAction(bool? sendToServiceOwners = default(bool?), IList customEmails = default(IList)) - { - SendToServiceOwners = sendToServiceOwners; - CustomEmails = customEmails; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets whether the administrators (service and - /// co-administrators) of the service should be notified when the alert - /// is activated. - /// - [JsonProperty(PropertyName = "sendToServiceOwners")] - public bool? SendToServiceOwners { get; set; } - - /// - /// Gets or sets the list of administrator's custom email addresses to - /// notify of the activation of the alert. - /// - [JsonProperty(PropertyName = "customEmails")] - public IList CustomEmails { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleManagementEventClaimsDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleManagementEventClaimsDataSource.cs deleted file mode 100644 index d2acb8d1268c6..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleManagementEventClaimsDataSource.cs +++ /dev/null @@ -1,53 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The claims for a rule management event data source. - /// - public partial class RuleManagementEventClaimsDataSource - { - /// - /// Initializes a new instance of the - /// RuleManagementEventClaimsDataSource class. - /// - public RuleManagementEventClaimsDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// RuleManagementEventClaimsDataSource class. - /// - /// the email address. - public RuleManagementEventClaimsDataSource(string emailAddress = default(string)) - { - EmailAddress = emailAddress; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the email address. - /// - [JsonProperty(PropertyName = "emailAddress")] - public string EmailAddress { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleManagementEventDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleManagementEventDataSource.cs deleted file mode 100644 index f63b7fb514fe5..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleManagementEventDataSource.cs +++ /dev/null @@ -1,130 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A rule management event data source. The discriminator fields is always - /// RuleManagementEventDataSource in this case. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource")] - public partial class RuleManagementEventDataSource : RuleDataSource - { - /// - /// Initializes a new instance of the RuleManagementEventDataSource - /// class. - /// - public RuleManagementEventDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleManagementEventDataSource - /// class. - /// - /// the resource identifier of the resource - /// the rule monitors. **NOTE**: this property cannot be updated for an - /// existing rule. - /// the event name. - /// the event source. - /// the level. - /// The name of the operation that should - /// be checked for. If no name is provided, any operation will - /// match. - /// the resource group name. - /// the resource provider - /// name. - /// The status of the operation that should be - /// checked for. If no status is provided, any status will - /// match. - /// the substatus. - /// the claims. - public RuleManagementEventDataSource(string resourceUri = default(string), string eventName = default(string), string eventSource = default(string), string level = default(string), string operationName = default(string), string resourceGroupName = default(string), string resourceProviderName = default(string), string status = default(string), string subStatus = default(string), RuleManagementEventClaimsDataSource claims = default(RuleManagementEventClaimsDataSource)) - : base(resourceUri) - { - EventName = eventName; - EventSource = eventSource; - Level = level; - OperationName = operationName; - ResourceGroupName = resourceGroupName; - ResourceProviderName = resourceProviderName; - Status = status; - SubStatus = subStatus; - Claims = claims; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the event name. - /// - [JsonProperty(PropertyName = "eventName")] - public string EventName { get; set; } - - /// - /// Gets or sets the event source. - /// - [JsonProperty(PropertyName = "eventSource")] - public string EventSource { get; set; } - - /// - /// Gets or sets the level. - /// - [JsonProperty(PropertyName = "level")] - public string Level { get; set; } - - /// - /// Gets or sets the name of the operation that should be checked for. - /// If no name is provided, any operation will match. - /// - [JsonProperty(PropertyName = "operationName")] - public string OperationName { get; set; } - - /// - /// Gets or sets the resource group name. - /// - [JsonProperty(PropertyName = "resourceGroupName")] - public string ResourceGroupName { get; set; } - - /// - /// Gets or sets the resource provider name. - /// - [JsonProperty(PropertyName = "resourceProviderName")] - public string ResourceProviderName { get; set; } - - /// - /// Gets or sets the status of the operation that should be checked - /// for. If no status is provided, any status will match. - /// - [JsonProperty(PropertyName = "status")] - public string Status { get; set; } - - /// - /// Gets or sets the substatus. - /// - [JsonProperty(PropertyName = "subStatus")] - public string SubStatus { get; set; } - - /// - /// Gets or sets the claims. - /// - [JsonProperty(PropertyName = "claims")] - public RuleManagementEventClaimsDataSource Claims { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleMetricDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleMetricDataSource.cs deleted file mode 100644 index d9a2e97448e75..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleMetricDataSource.cs +++ /dev/null @@ -1,59 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A rule metric data source. The discriminator value is always - /// RuleMetricDataSource in this case. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource")] - public partial class RuleMetricDataSource : RuleDataSource - { - /// - /// Initializes a new instance of the RuleMetricDataSource class. - /// - public RuleMetricDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleMetricDataSource class. - /// - /// the resource identifier of the resource - /// the rule monitors. **NOTE**: this property cannot be updated for an - /// existing rule. - /// the name of the metric that defines what - /// the rule monitors. - public RuleMetricDataSource(string resourceUri = default(string), string metricName = default(string)) - : base(resourceUri) - { - MetricName = metricName; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the metric that defines what the rule - /// monitors. - /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleWebhookAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleWebhookAction.cs deleted file mode 100644 index b70d12e5444bc..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/RuleWebhookAction.cs +++ /dev/null @@ -1,68 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the action to post to service when the rule condition is - /// evaluated. The discriminator is always RuleWebhookAction in this case. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.RuleWebhookAction")] - public partial class RuleWebhookAction : RuleAction - { - /// - /// Initializes a new instance of the RuleWebhookAction class. - /// - public RuleWebhookAction() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the RuleWebhookAction class. - /// - /// the service uri to Post the notification - /// when the alert activates or resolves. - /// the dictionary of custom properties to - /// include with the post operation. These data are appended to the - /// webhook payload. - public RuleWebhookAction(string serviceUri = default(string), IDictionary properties = default(IDictionary)) - { - ServiceUri = serviceUri; - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the service uri to Post the notification when the - /// alert activates or resolves. - /// - [JsonProperty(PropertyName = "serviceUri")] - public string ServiceUri { get; set; } - - /// - /// Gets or sets the dictionary of custom properties to include with - /// the post operation. These data are appended to the webhook payload. - /// - [JsonProperty(PropertyName = "properties")] - public IDictionary Properties { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleAction.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleAction.cs deleted file mode 100644 index f8e59a53dc7f8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleAction.cs +++ /dev/null @@ -1,100 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// The parameters for the scaling action. - /// - public partial class ScaleAction - { - /// - /// Initializes a new instance of the ScaleAction class. - /// - public ScaleAction() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScaleAction class. - /// - /// the scale direction. Whether the scaling - /// action increases or decreases the number of instances. Possible - /// values include: 'None', 'Increase', 'Decrease' - /// the type of action that should occur when the - /// scale rule fires. Possible values include: 'ChangeCount', - /// 'PercentChangeCount', 'ExactCount' - /// the amount of time to wait since the last - /// scaling action before this action occurs. It must be between 1 week - /// and 1 minute in ISO 8601 format. - /// the number of instances that are involved in - /// the scaling action. This value must be 1 or greater. The default - /// value is 1. - public ScaleAction(ScaleDirection direction, ScaleType type, System.TimeSpan cooldown, string value = default(string)) - { - Direction = direction; - Type = type; - Value = value; - Cooldown = cooldown; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the scale direction. Whether the scaling action - /// increases or decreases the number of instances. Possible values - /// include: 'None', 'Increase', 'Decrease' - /// - [JsonProperty(PropertyName = "direction")] - public ScaleDirection Direction { get; set; } - - /// - /// Gets or sets the type of action that should occur when the scale - /// rule fires. Possible values include: 'ChangeCount', - /// 'PercentChangeCount', 'ExactCount' - /// - [JsonProperty(PropertyName = "type")] - public ScaleType Type { get; set; } - - /// - /// Gets or sets the number of instances that are involved in the - /// scaling action. This value must be 1 or greater. The default value - /// is 1. - /// - [JsonProperty(PropertyName = "value")] - public string Value { get; set; } - - /// - /// Gets or sets the amount of time to wait since the last scaling - /// action before this action occurs. It must be between 1 week and 1 - /// minute in ISO 8601 format. - /// - [JsonProperty(PropertyName = "cooldown")] - public System.TimeSpan Cooldown { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleCapacity.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleCapacity.cs deleted file mode 100644 index 755f92253b1fa..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleCapacity.cs +++ /dev/null @@ -1,99 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The number of instances that can be used during this profile. - /// - public partial class ScaleCapacity - { - /// - /// Initializes a new instance of the ScaleCapacity class. - /// - public ScaleCapacity() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScaleCapacity class. - /// - /// the minimum number of instances for the - /// resource. - /// the maximum number of instances for the - /// resource. The actual maximum number of instances is limited by the - /// cores that are available in the subscription. - /// the number of instances that will be - /// set if metrics are not available for evaluation. The default is - /// only used if the current instance count is lower than the - /// default. - public ScaleCapacity(string minimum, string maximum, string defaultProperty) - { - Minimum = minimum; - Maximum = maximum; - DefaultProperty = defaultProperty; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the minimum number of instances for the resource. - /// - [JsonProperty(PropertyName = "minimum")] - public string Minimum { get; set; } - - /// - /// Gets or sets the maximum number of instances for the resource. The - /// actual maximum number of instances is limited by the cores that are - /// available in the subscription. - /// - [JsonProperty(PropertyName = "maximum")] - public string Maximum { get; set; } - - /// - /// Gets or sets the number of instances that will be set if metrics - /// are not available for evaluation. The default is only used if the - /// current instance count is lower than the default. - /// - [JsonProperty(PropertyName = "default")] - public string DefaultProperty { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Minimum == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Minimum"); - } - if (Maximum == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Maximum"); - } - if (DefaultProperty == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DefaultProperty"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleDirection.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleDirection.cs deleted file mode 100644 index 858c37739fdbf..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleDirection.cs +++ /dev/null @@ -1,66 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ScaleDirection. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ScaleDirection - { - [EnumMember(Value = "None")] - None, - [EnumMember(Value = "Increase")] - Increase, - [EnumMember(Value = "Decrease")] - Decrease - } - internal static class ScaleDirectionEnumExtension - { - internal static string ToSerializedValue(this ScaleDirection? value) - { - return value == null ? null : ((ScaleDirection)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ScaleDirection value) - { - switch( value ) - { - case ScaleDirection.None: - return "None"; - case ScaleDirection.Increase: - return "Increase"; - case ScaleDirection.Decrease: - return "Decrease"; - } - return null; - } - - internal static ScaleDirection? ParseScaleDirection(this string value) - { - switch( value ) - { - case "None": - return ScaleDirection.None; - case "Increase": - return ScaleDirection.Increase; - case "Decrease": - return ScaleDirection.Decrease; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRule.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRule.cs deleted file mode 100644 index 2f061a1523d5d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRule.cs +++ /dev/null @@ -1,87 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A rule that provide the triggers and parameters for the scaling action. - /// - public partial class ScaleRule - { - /// - /// Initializes a new instance of the ScaleRule class. - /// - public ScaleRule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScaleRule class. - /// - /// the trigger that results in a scaling - /// action. - /// the parameters for the scaling - /// action. - public ScaleRule(MetricTrigger metricTrigger, ScaleAction scaleAction) - { - MetricTrigger = metricTrigger; - ScaleAction = scaleAction; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the trigger that results in a scaling action. - /// - [JsonProperty(PropertyName = "metricTrigger")] - public MetricTrigger MetricTrigger { get; set; } - - /// - /// Gets or sets the parameters for the scaling action. - /// - [JsonProperty(PropertyName = "scaleAction")] - public ScaleAction ScaleAction { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (MetricTrigger == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricTrigger"); - } - if (ScaleAction == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ScaleAction"); - } - if (MetricTrigger != null) - { - MetricTrigger.Validate(); - } - if (ScaleAction != null) - { - ScaleAction.Validate(); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRuleMetricDimension.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRuleMetricDimension.cs deleted file mode 100644 index 9cb036d6fed22..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRuleMetricDimension.cs +++ /dev/null @@ -1,99 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies an auto scale rule metric dimension. - /// - public partial class ScaleRuleMetricDimension - { - /// - /// Initializes a new instance of the ScaleRuleMetricDimension class. - /// - public ScaleRuleMetricDimension() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScaleRuleMetricDimension class. - /// - /// Name of the dimension. - /// the dimension operator. Only - /// 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any - /// of the values. 'NotEquals' being not equal to all of the values. - /// Possible values include: 'Equals', 'NotEquals' - /// list of dimension values. For example: - /// ["App1","App2"]. - public ScaleRuleMetricDimension(string dimensionName, string operatorProperty, IList values) - { - DimensionName = dimensionName; - OperatorProperty = operatorProperty; - Values = values; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets name of the dimension. - /// - [JsonProperty(PropertyName = "DimensionName")] - public string DimensionName { get; set; } - - /// - /// Gets or sets the dimension operator. Only 'Equals' and 'NotEquals' - /// are supported. 'Equals' being equal to any of the values. - /// 'NotEquals' being not equal to all of the values. Possible values - /// include: 'Equals', 'NotEquals' - /// - [JsonProperty(PropertyName = "Operator")] - public string OperatorProperty { get; set; } - - /// - /// Gets or sets list of dimension values. For example: - /// ["App1","App2"]. - /// - [JsonProperty(PropertyName = "Values")] - public IList Values { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DimensionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DimensionName"); - } - if (OperatorProperty == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); - } - if (Values == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Values"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRuleMetricDimensionOperationType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRuleMetricDimensionOperationType.cs deleted file mode 100644 index 3ff0455f3c4ed..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleRuleMetricDimensionOperationType.cs +++ /dev/null @@ -1,22 +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.Monitor.Models -{ - - /// - /// Defines values for ScaleRuleMetricDimensionOperationType. - /// - public static class ScaleRuleMetricDimensionOperationType - { - public const string Equals = "Equals"; - public const string NotEquals = "NotEquals"; - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleType.cs deleted file mode 100644 index 14e8b058ef787..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScaleType.cs +++ /dev/null @@ -1,66 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for ScaleType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum ScaleType - { - [EnumMember(Value = "ChangeCount")] - ChangeCount, - [EnumMember(Value = "PercentChangeCount")] - PercentChangeCount, - [EnumMember(Value = "ExactCount")] - ExactCount - } - internal static class ScaleTypeEnumExtension - { - internal static string ToSerializedValue(this ScaleType? value) - { - return value == null ? null : ((ScaleType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this ScaleType value) - { - switch( value ) - { - case ScaleType.ChangeCount: - return "ChangeCount"; - case ScaleType.PercentChangeCount: - return "PercentChangeCount"; - case ScaleType.ExactCount: - return "ExactCount"; - } - return null; - } - - internal static ScaleType? ParseScaleType(this string value) - { - switch( value ) - { - case "ChangeCount": - return ScaleType.ChangeCount; - case "PercentChangeCount": - return ScaleType.PercentChangeCount; - case "ExactCount": - return ScaleType.ExactCount; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Schedule.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Schedule.cs deleted file mode 100644 index 0afc58da2f73d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Schedule.cs +++ /dev/null @@ -1,74 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// Defines how often to run the search and the time interval. - /// - public partial class Schedule - { - /// - /// Initializes a new instance of the Schedule class. - /// - public Schedule() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Schedule class. - /// - /// frequency (in minutes) at which - /// rule condition should be evaluated. - /// Time window for which data needs - /// to be fetched for query (should be greater than or equal to - /// frequencyInMinutes). - public Schedule(int frequencyInMinutes, int timeWindowInMinutes) - { - FrequencyInMinutes = frequencyInMinutes; - TimeWindowInMinutes = timeWindowInMinutes; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets frequency (in minutes) at which rule condition should - /// be evaluated. - /// - [JsonProperty(PropertyName = "frequencyInMinutes")] - public int FrequencyInMinutes { get; set; } - - /// - /// Gets or sets time window for which data needs to be fetched for - /// query (should be greater than or equal to frequencyInMinutes). - /// - [JsonProperty(PropertyName = "timeWindowInMinutes")] - public int TimeWindowInMinutes { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScopedResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScopedResource.cs deleted file mode 100644 index bbfe8c1a2fad9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ScopedResource.cs +++ /dev/null @@ -1,68 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A private link scoped resource - /// - [Rest.Serialization.JsonTransformation] - public partial class ScopedResource : ProxyResource - { - /// - /// Initializes a new instance of the ScopedResource class. - /// - public ScopedResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ScopedResource class. - /// - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// The resource id of the scoped Azure - /// monitor resource. - /// State of the private endpoint - /// connection. - public ScopedResource(string id = default(string), string name = default(string), string type = default(string), string linkedResourceId = default(string), string provisioningState = default(string)) - : base(id, name, type) - { - LinkedResourceId = linkedResourceId; - ProvisioningState = provisioningState; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resource id of the scoped Azure monitor resource. - /// - [JsonProperty(PropertyName = "properties.linkedResourceId")] - public string LinkedResourceId { get; set; } - - /// - /// Gets state of the private endpoint connection. - /// - [JsonProperty(PropertyName = "properties.provisioningState")] - public string ProvisioningState { get; private set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SenderAuthorization.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SenderAuthorization.cs deleted file mode 100644 index b039c91346ddf..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SenderAuthorization.cs +++ /dev/null @@ -1,72 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// the authorization used by the user who has performed the operation that - /// led to this event. This captures the RBAC properties of the event. - /// These usually include the 'action', 'role' and the 'scope' - /// - public partial class SenderAuthorization - { - /// - /// Initializes a new instance of the SenderAuthorization class. - /// - public SenderAuthorization() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SenderAuthorization class. - /// - /// the permissible actions. For instance: - /// microsoft.support/supporttickets/write - /// the role of the user. For instance: Subscription - /// Admin - /// the scope. - public SenderAuthorization(string action = default(string), string role = default(string), string scope = default(string)) - { - Action = action; - Role = role; - Scope = scope; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the permissible actions. For instance: - /// microsoft.support/supporttickets/write - /// - [JsonProperty(PropertyName = "action")] - public string Action { get; set; } - - /// - /// Gets or sets the role of the user. For instance: Subscription Admin - /// - [JsonProperty(PropertyName = "role")] - public string Role { get; set; } - - /// - /// Gets or sets the scope. - /// - [JsonProperty(PropertyName = "scope")] - public string Scope { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Sensitivity.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Sensitivity.cs deleted file mode 100644 index 44e3f73a03876..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Sensitivity.cs +++ /dev/null @@ -1,66 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for Sensitivity. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum Sensitivity - { - [EnumMember(Value = "Low")] - Low, - [EnumMember(Value = "Medium")] - Medium, - [EnumMember(Value = "High")] - High - } - internal static class SensitivityEnumExtension - { - internal static string ToSerializedValue(this Sensitivity? value) - { - return value == null ? null : ((Sensitivity)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this Sensitivity value) - { - switch( value ) - { - case Sensitivity.Low: - return "Low"; - case Sensitivity.Medium: - return "Medium"; - case Sensitivity.High: - return "High"; - } - return null; - } - - internal static Sensitivity? ParseSensitivity(this string value) - { - switch( value ) - { - case "Low": - return Sensitivity.Low; - case "Medium": - return Sensitivity.Medium; - case "High": - return Sensitivity.High; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SingleBaseline.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SingleBaseline.cs deleted file mode 100644 index 8959f4d061eb4..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SingleBaseline.cs +++ /dev/null @@ -1,95 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The baseline values for a single sensitivity value. - /// - public partial class SingleBaseline - { - /// - /// Initializes a new instance of the SingleBaseline class. - /// - public SingleBaseline() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SingleBaseline class. - /// - /// the sensitivity of the baseline. Possible - /// values include: 'Low', 'Medium', 'High' - /// The low thresholds of the - /// baseline. - /// The high thresholds of the - /// baseline. - public SingleBaseline(string sensitivity, IList lowThresholds, IList highThresholds) - { - Sensitivity = sensitivity; - LowThresholds = lowThresholds; - HighThresholds = highThresholds; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the sensitivity of the baseline. Possible values - /// include: 'Low', 'Medium', 'High' - /// - [JsonProperty(PropertyName = "sensitivity")] - public string Sensitivity { get; set; } - - /// - /// Gets or sets the low thresholds of the baseline. - /// - [JsonProperty(PropertyName = "lowThresholds")] - public IList LowThresholds { get; set; } - - /// - /// Gets or sets the high thresholds of the baseline. - /// - [JsonProperty(PropertyName = "highThresholds")] - public IList HighThresholds { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Sensitivity == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Sensitivity"); - } - if (LowThresholds == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "LowThresholds"); - } - if (HighThresholds == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "HighThresholds"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SingleMetricBaseline.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SingleMetricBaseline.cs deleted file mode 100644 index d7d36f282e52c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SingleMetricBaseline.cs +++ /dev/null @@ -1,160 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The baseline results of a single metric. - /// - [Rest.Serialization.JsonTransformation] - public partial class SingleMetricBaseline - { - /// - /// Initializes a new instance of the SingleMetricBaseline class. - /// - public SingleMetricBaseline() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SingleMetricBaseline class. - /// - /// The metric baseline Id. - /// The resource type of the metric baseline - /// resource. - /// The name of the metric for which the baselines - /// were retrieved. - /// The timespan for which the data was - /// retrieved. Its value consists of two datetimes concatenated, - /// separated by '/'. This may be adjusted in the future and returned - /// back from what was originally requested. - /// The interval (window size) for which the - /// metric data was returned in. This may be adjusted in the future - /// and returned back from what was originally requested. This is not - /// present if a metadata request was made. - /// The baseline for each time series that was - /// queried. - /// The namespace of the metrics been - /// queried. - public SingleMetricBaseline(string id, string type, string name, string timespan, System.TimeSpan interval, IList baselines, string namespaceProperty = default(string)) - { - Id = id; - Type = type; - Name = name; - Timespan = timespan; - Interval = interval; - NamespaceProperty = namespaceProperty; - Baselines = baselines; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the metric baseline Id. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets the resource type of the metric baseline resource. - /// - [JsonProperty(PropertyName = "type")] - public string Type { get; set; } - - /// - /// Gets or sets the name of the metric for which the baselines were - /// retrieved. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the timespan for which the data was retrieved. Its - /// value consists of two datetimes concatenated, separated by '/'. - /// This may be adjusted in the future and returned back from what was - /// originally requested. - /// - [JsonProperty(PropertyName = "properties.timespan")] - public string Timespan { get; set; } - - /// - /// Gets or sets the interval (window size) for which the metric data - /// was returned in. This may be adjusted in the future and returned - /// back from what was originally requested. This is not present if a - /// metadata request was made. - /// - [JsonProperty(PropertyName = "properties.interval")] - public System.TimeSpan Interval { get; set; } - - /// - /// Gets or sets the namespace of the metrics been queried. - /// - [JsonProperty(PropertyName = "properties.namespace")] - public string NamespaceProperty { get; set; } - - /// - /// Gets or sets the baseline for each time series that was queried. - /// - [JsonProperty(PropertyName = "properties.baselines")] - public IList Baselines { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Type == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Type"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (Timespan == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Timespan"); - } - if (Baselines == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Baselines"); - } - if (Baselines != null) - { - foreach (var element in Baselines) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SmsReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SmsReceiver.cs deleted file mode 100644 index 53fe83945f359..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SmsReceiver.cs +++ /dev/null @@ -1,103 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// An SMS receiver. - /// - public partial class SmsReceiver - { - /// - /// Initializes a new instance of the SmsReceiver class. - /// - public SmsReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SmsReceiver class. - /// - /// The name of the SMS receiver. Names must be - /// unique across all receivers within an action group. - /// The country code of the SMS - /// receiver. - /// The phone number of the SMS - /// receiver. - /// The status of the receiver. Possible values - /// include: 'NotSpecified', 'Enabled', 'Disabled' - public SmsReceiver(string name, string countryCode, string phoneNumber, ReceiverStatus? status = default(ReceiverStatus?)) - { - Name = name; - CountryCode = countryCode; - PhoneNumber = phoneNumber; - Status = status; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the SMS receiver. Names must be unique - /// across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the country code of the SMS receiver. - /// - [JsonProperty(PropertyName = "countryCode")] - public string CountryCode { get; set; } - - /// - /// Gets or sets the phone number of the SMS receiver. - /// - [JsonProperty(PropertyName = "phoneNumber")] - public string PhoneNumber { get; set; } - - /// - /// Gets the status of the receiver. Possible values include: - /// 'NotSpecified', 'Enabled', 'Disabled' - /// - [JsonProperty(PropertyName = "status")] - public ReceiverStatus? Status { get; private set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (CountryCode == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CountryCode"); - } - if (PhoneNumber == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PhoneNumber"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Source.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Source.cs deleted file mode 100644 index 065bdce85e150..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Source.cs +++ /dev/null @@ -1,98 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the log search query. - /// - public partial class Source - { - /// - /// Initializes a new instance of the Source class. - /// - public Source() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the Source class. - /// - /// The resource uri over which log search - /// query is to be run. - /// Log search query. Required for action type - - /// AlertingAction - /// List of Resource referred into - /// query - /// Set value to 'ResultCount'. Possible values - /// include: 'ResultCount' - public Source(string dataSourceId, string query = default(string), IList authorizedResources = default(IList), string queryType = default(string)) - { - Query = query; - AuthorizedResources = authorizedResources; - DataSourceId = dataSourceId; - QueryType = queryType; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets log search query. Required for action type - - /// AlertingAction - /// - [JsonProperty(PropertyName = "query")] - public string Query { get; set; } - - /// - /// Gets or sets list of Resource referred into query - /// - [JsonProperty(PropertyName = "authorizedResources")] - public IList AuthorizedResources { get; set; } - - /// - /// Gets or sets the resource uri over which log search query is to be - /// run. - /// - [JsonProperty(PropertyName = "dataSourceId")] - public string DataSourceId { get; set; } - - /// - /// Gets or sets set value to 'ResultCount'. Possible values include: - /// 'ResultCount' - /// - [JsonProperty(PropertyName = "queryType")] - public string QueryType { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (DataSourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceId"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs deleted file mode 100644 index f3106d2c8e3df..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/SyslogDataSource.cs +++ /dev/null @@ -1,107 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of which syslog data will be collected and how it will be - /// collected. - /// Only collected from Linux machines. - /// - public partial class SyslogDataSource - { - /// - /// Initializes a new instance of the SyslogDataSource class. - /// - public SyslogDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the SyslogDataSource class. - /// - /// List of streams that this data source will be - /// sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent - /// to. - /// The list of facility names. - /// A friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - /// The log levels to collect. - public SyslogDataSource(IList streams, IList facilityNames, string name, IList logLevels = default(IList)) - { - Streams = streams; - FacilityNames = facilityNames; - LogLevels = logLevels; - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of streams that this data source will be sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent to. - /// - [JsonProperty(PropertyName = "streams")] - public IList Streams { get; set; } - - /// - /// Gets or sets the list of facility names. - /// - [JsonProperty(PropertyName = "facilityNames")] - public IList FacilityNames { get; set; } - - /// - /// Gets or sets the log levels to collect. - /// - [JsonProperty(PropertyName = "logLevels")] - public IList LogLevels { get; set; } - - /// - /// Gets or sets a friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Streams == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); - } - if (FacilityNames == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "FacilityNames"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TagsResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TagsResource.cs deleted file mode 100644 index 3dc9207c30c3f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TagsResource.cs +++ /dev/null @@ -1,54 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A container holding only the Tags for a resource, allowing the user to - /// update the tags on a PrivateLinkScope instance. - /// - public partial class TagsResource - { - /// - /// Initializes a new instance of the TagsResource class. - /// - public TagsResource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TagsResource class. - /// - /// Resource tags - public TagsResource(IDictionary tags = default(IDictionary)) - { - Tags = tags; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets resource tags - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ThresholdRuleCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ThresholdRuleCondition.cs deleted file mode 100644 index e376a972718da..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ThresholdRuleCondition.cs +++ /dev/null @@ -1,106 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A rule condition based on a metric crossing a threshold. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition")] - public partial class ThresholdRuleCondition : RuleCondition - { - /// - /// Initializes a new instance of the ThresholdRuleCondition class. - /// - public ThresholdRuleCondition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ThresholdRuleCondition class. - /// - /// the operator used to compare the - /// data and the threshold. Possible values include: 'GreaterThan', - /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - /// the threshold value that activates the - /// alert. - /// the resource from which the rule collects - /// its data. For this type dataSource will always be of type - /// RuleMetricDataSource. - /// the period of time (in ISO 8601 duration - /// format) that is used to monitor alert activity based on the - /// threshold. If specified then it must be between 5 minutes and 1 - /// day. - /// the time aggregation operator. How - /// the data that are collected should be combined over time. The - /// default value is the PrimaryAggregationType of the Metric. Possible - /// values include: 'Average', 'Minimum', 'Maximum', 'Total', - /// 'Last' - public ThresholdRuleCondition(ConditionOperator operatorProperty, double threshold, RuleDataSource dataSource = default(RuleDataSource), System.TimeSpan? windowSize = default(System.TimeSpan?), TimeAggregationOperator? timeAggregation = default(TimeAggregationOperator?)) - : base(dataSource) - { - OperatorProperty = operatorProperty; - Threshold = threshold; - WindowSize = windowSize; - TimeAggregation = timeAggregation; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the operator used to compare the data and the - /// threshold. Possible values include: 'GreaterThan', - /// 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual' - /// - [JsonProperty(PropertyName = "operator")] - public ConditionOperator OperatorProperty { get; set; } - - /// - /// Gets or sets the threshold value that activates the alert. - /// - [JsonProperty(PropertyName = "threshold")] - public double Threshold { get; set; } - - /// - /// Gets or sets the period of time (in ISO 8601 duration format) that - /// is used to monitor alert activity based on the threshold. If - /// specified then it must be between 5 minutes and 1 day. - /// - [JsonProperty(PropertyName = "windowSize")] - public System.TimeSpan? WindowSize { get; set; } - - /// - /// Gets or sets the time aggregation operator. How the data that are - /// collected should be combined over time. The default value is the - /// PrimaryAggregationType of the Metric. Possible values include: - /// 'Average', 'Minimum', 'Maximum', 'Total', 'Last' - /// - [JsonProperty(PropertyName = "timeAggregation")] - public TimeAggregationOperator? TimeAggregation { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeAggregationOperator.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeAggregationOperator.cs deleted file mode 100644 index 863bbac3ce8a6..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeAggregationOperator.cs +++ /dev/null @@ -1,78 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for TimeAggregationOperator. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum TimeAggregationOperator - { - [EnumMember(Value = "Average")] - Average, - [EnumMember(Value = "Minimum")] - Minimum, - [EnumMember(Value = "Maximum")] - Maximum, - [EnumMember(Value = "Total")] - Total, - [EnumMember(Value = "Last")] - Last - } - internal static class TimeAggregationOperatorEnumExtension - { - internal static string ToSerializedValue(this TimeAggregationOperator? value) - { - return value == null ? null : ((TimeAggregationOperator)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this TimeAggregationOperator value) - { - switch( value ) - { - case TimeAggregationOperator.Average: - return "Average"; - case TimeAggregationOperator.Minimum: - return "Minimum"; - case TimeAggregationOperator.Maximum: - return "Maximum"; - case TimeAggregationOperator.Total: - return "Total"; - case TimeAggregationOperator.Last: - return "Last"; - } - return null; - } - - internal static TimeAggregationOperator? ParseTimeAggregationOperator(this string value) - { - switch( value ) - { - case "Average": - return TimeAggregationOperator.Average; - case "Minimum": - return TimeAggregationOperator.Minimum; - case "Maximum": - return TimeAggregationOperator.Maximum; - case "Total": - return TimeAggregationOperator.Total; - case "Last": - return TimeAggregationOperator.Last; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeAggregationType.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeAggregationType.cs deleted file mode 100644 index 771c356ab52e4..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeAggregationType.cs +++ /dev/null @@ -1,84 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for TimeAggregationType. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum TimeAggregationType - { - [EnumMember(Value = "Average")] - Average, - [EnumMember(Value = "Minimum")] - Minimum, - [EnumMember(Value = "Maximum")] - Maximum, - [EnumMember(Value = "Total")] - Total, - [EnumMember(Value = "Count")] - Count, - [EnumMember(Value = "Last")] - Last - } - internal static class TimeAggregationTypeEnumExtension - { - internal static string ToSerializedValue(this TimeAggregationType? value) - { - return value == null ? null : ((TimeAggregationType)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this TimeAggregationType value) - { - switch( value ) - { - case TimeAggregationType.Average: - return "Average"; - case TimeAggregationType.Minimum: - return "Minimum"; - case TimeAggregationType.Maximum: - return "Maximum"; - case TimeAggregationType.Total: - return "Total"; - case TimeAggregationType.Count: - return "Count"; - case TimeAggregationType.Last: - return "Last"; - } - return null; - } - - internal static TimeAggregationType? ParseTimeAggregationType(this string value) - { - switch( value ) - { - case "Average": - return TimeAggregationType.Average; - case "Minimum": - return TimeAggregationType.Minimum; - case "Maximum": - return TimeAggregationType.Maximum; - case "Total": - return TimeAggregationType.Total; - case "Count": - return TimeAggregationType.Count; - case "Last": - return TimeAggregationType.Last; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesBaseline.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesBaseline.cs deleted file mode 100644 index 24a82423f3121..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesBaseline.cs +++ /dev/null @@ -1,141 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The baseline values for a single time series. - /// - public partial class TimeSeriesBaseline - { - /// - /// Initializes a new instance of the TimeSeriesBaseline class. - /// - public TimeSeriesBaseline() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TimeSeriesBaseline class. - /// - /// The aggregation type of the - /// metric. - /// The list of timestamps of the - /// baselines. - /// The baseline values for each - /// sensitivity. - /// The dimensions of this time - /// series. - /// The baseline metadata values. - public TimeSeriesBaseline(string aggregation, IList timestamps, IList data, IList dimensions = default(IList), IList metadata = default(IList)) - { - Aggregation = aggregation; - Dimensions = dimensions; - Timestamps = timestamps; - Data = data; - Metadata = metadata; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the aggregation type of the metric. - /// - [JsonProperty(PropertyName = "aggregation")] - public string Aggregation { get; set; } - - /// - /// Gets or sets the dimensions of this time series. - /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } - - /// - /// Gets or sets the list of timestamps of the baselines. - /// - [JsonProperty(PropertyName = "timestamps")] - public IList Timestamps { get; set; } - - /// - /// Gets or sets the baseline values for each sensitivity. - /// - [JsonProperty(PropertyName = "data")] - public IList Data { get; set; } - - /// - /// Gets or sets the baseline metadata values. - /// - [JsonProperty(PropertyName = "metadata")] - public IList Metadata { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Aggregation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Aggregation"); - } - if (Timestamps == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Timestamps"); - } - if (Data == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Data"); - } - if (Dimensions != null) - { - foreach (var element in Dimensions) - { - if (element != null) - { - element.Validate(); - } - } - } - if (Data != null) - { - foreach (var element1 in Data) - { - if (element1 != null) - { - element1.Validate(); - } - } - } - if (Metadata != null) - { - foreach (var element2 in Metadata) - { - if (element2 != null) - { - element2.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesElement.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesElement.cs deleted file mode 100644 index 6d30fba03f4f0..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesElement.cs +++ /dev/null @@ -1,68 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A time series result type. The discriminator value is always TimeSeries - /// in this case. - /// - public partial class TimeSeriesElement - { - /// - /// Initializes a new instance of the TimeSeriesElement class. - /// - public TimeSeriesElement() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TimeSeriesElement class. - /// - /// the metadata values returned if - /// $filter was specified in the call. - /// An array of data points representing the metric - /// values. This is only returned if a result type of data is - /// specified. - public TimeSeriesElement(IList metadatavalues = default(IList), IList data = default(IList)) - { - Metadatavalues = metadatavalues; - Data = data; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the metadata values returned if $filter was specified - /// in the call. - /// - [JsonProperty(PropertyName = "metadatavalues")] - public IList Metadatavalues { get; set; } - - /// - /// Gets or sets an array of data points representing the metric - /// values. This is only returned if a result type of data is - /// specified. - /// - [JsonProperty(PropertyName = "data")] - public IList Data { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesInformation.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesInformation.cs deleted file mode 100644 index 4e6eb4bb17b55..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeSeriesInformation.cs +++ /dev/null @@ -1,91 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// The time series info needed for calculating the baseline. - /// - public partial class TimeSeriesInformation - { - /// - /// Initializes a new instance of the TimeSeriesInformation class. - /// - public TimeSeriesInformation() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TimeSeriesInformation class. - /// - /// the list of sensitivities for - /// calculating the baseline. - /// The metric values to calculate the - /// baseline. - /// the array of timestamps of the - /// baselines. - public TimeSeriesInformation(IList sensitivities, IList values, IList timestamps = default(IList)) - { - Sensitivities = sensitivities; - Values = values; - Timestamps = timestamps; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the list of sensitivities for calculating the - /// baseline. - /// - [JsonProperty(PropertyName = "sensitivities")] - public IList Sensitivities { get; set; } - - /// - /// Gets or sets the metric values to calculate the baseline. - /// - [JsonProperty(PropertyName = "values")] - public IList Values { get; set; } - - /// - /// Gets or sets the array of timestamps of the baselines. - /// - [JsonProperty(PropertyName = "timestamps")] - public IList Timestamps { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Sensitivities == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Sensitivities"); - } - if (Values == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Values"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeWindow.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeWindow.cs deleted file mode 100644 index 6eba68156e24c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TimeWindow.cs +++ /dev/null @@ -1,162 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Linq; - - /// - /// A specific date-time for the profile. - /// - public partial class TimeWindow - { - /// - /// Initializes a new instance of the TimeWindow class. - /// - public TimeWindow() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TimeWindow class. - /// - /// the start time for the profile in ISO 8601 - /// format. - /// the end time for the profile in ISO 8601 - /// format. - /// the timezone of the start and end times for - /// the profile. Some examples of valid time zones are: Dateline - /// Standard Time, UTC-11, Hawaiian Standard Time, Alaskan Standard - /// Time, Pacific Standard Time (Mexico), Pacific Standard Time, US - /// Mountain Standard Time, Mountain Standard Time (Mexico), Mountain - /// Standard Time, Central America Standard Time, Central Standard - /// Time, Central Standard Time (Mexico), Canada Central Standard Time, - /// SA Pacific Standard Time, Eastern Standard Time, US Eastern - /// Standard Time, Venezuela Standard Time, Paraguay Standard Time, - /// Atlantic Standard Time, Central Brazilian Standard Time, SA Western - /// Standard Time, Pacific SA Standard Time, Newfoundland Standard - /// Time, E. South America Standard Time, Argentina Standard Time, SA - /// Eastern Standard Time, Greenland Standard Time, Montevideo Standard - /// Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, - /// Azores Standard Time, Cape Verde Standard Time, Morocco Standard - /// Time, UTC, GMT Standard Time, Greenwich Standard Time, W. Europe - /// Standard Time, Central Europe Standard Time, Romance Standard Time, - /// Central European Standard Time, W. Central Africa Standard Time, - /// Namibia Standard Time, Jordan Standard Time, GTB Standard Time, - /// Middle East Standard Time, Egypt Standard Time, Syria Standard - /// Time, E. Europe Standard Time, South Africa Standard Time, FLE - /// Standard Time, Turkey Standard Time, Israel Standard Time, - /// Kaliningrad Standard Time, Libya Standard Time, Arabic Standard - /// Time, Arab Standard Time, Belarus Standard Time, Russian Standard - /// Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard - /// Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius - /// Standard Time, Georgian Standard Time, Caucasus Standard Time, - /// Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg - /// Standard Time, Pakistan Standard Time, India Standard Time, Sri - /// Lanka Standard Time, Nepal Standard Time, Central Asia Standard - /// Time, Bangladesh Standard Time, N. Central Asia Standard Time, - /// Myanmar Standard Time, SE Asia Standard Time, North Asia Standard - /// Time, China Standard Time, North Asia East Standard Time, Singapore - /// Standard Time, W. Australia Standard Time, Taipei Standard Time, - /// Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard - /// Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS - /// Central Standard Time, E. Australia Standard Time, AUS Eastern - /// Standard Time, West Pacific Standard Time, Tasmania Standard Time, - /// Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone - /// 10, Central Pacific Standard Time, Russia Time Zone 11, New Zealand - /// Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, - /// Tonga Standard Time, Samoa Standard Time, Line Islands Standard - /// Time - public TimeWindow(System.DateTime start, System.DateTime end, string timeZone = default(string)) - { - TimeZone = timeZone; - Start = start; - End = end; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the timezone of the start and end times for the - /// profile. Some examples of valid time zones are: Dateline Standard - /// Time, UTC-11, Hawaiian Standard Time, Alaskan Standard Time, - /// Pacific Standard Time (Mexico), Pacific Standard Time, US Mountain - /// Standard Time, Mountain Standard Time (Mexico), Mountain Standard - /// Time, Central America Standard Time, Central Standard Time, Central - /// Standard Time (Mexico), Canada Central Standard Time, SA Pacific - /// Standard Time, Eastern Standard Time, US Eastern Standard Time, - /// Venezuela Standard Time, Paraguay Standard Time, Atlantic Standard - /// Time, Central Brazilian Standard Time, SA Western Standard Time, - /// Pacific SA Standard Time, Newfoundland Standard Time, E. South - /// America Standard Time, Argentina Standard Time, SA Eastern Standard - /// Time, Greenland Standard Time, Montevideo Standard Time, Bahia - /// Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard - /// Time, Cape Verde Standard Time, Morocco Standard Time, UTC, GMT - /// Standard Time, Greenwich Standard Time, W. Europe Standard Time, - /// Central Europe Standard Time, Romance Standard Time, Central - /// European Standard Time, W. Central Africa Standard Time, Namibia - /// Standard Time, Jordan Standard Time, GTB Standard Time, Middle East - /// Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe - /// Standard Time, South Africa Standard Time, FLE Standard Time, - /// Turkey Standard Time, Israel Standard Time, Kaliningrad Standard - /// Time, Libya Standard Time, Arabic Standard Time, Arab Standard - /// Time, Belarus Standard Time, Russian Standard Time, E. Africa - /// Standard Time, Iran Standard Time, Arabian Standard Time, - /// Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard - /// Time, Georgian Standard Time, Caucasus Standard Time, Afghanistan - /// Standard Time, West Asia Standard Time, Ekaterinburg Standard Time, - /// Pakistan Standard Time, India Standard Time, Sri Lanka Standard - /// Time, Nepal Standard Time, Central Asia Standard Time, Bangladesh - /// Standard Time, N. Central Asia Standard Time, Myanmar Standard - /// Time, SE Asia Standard Time, North Asia Standard Time, China - /// Standard Time, North Asia East Standard Time, Singapore Standard - /// Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar - /// Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk - /// Standard Time, Cen. Australia Standard Time, AUS Central Standard - /// Time, E. Australia Standard Time, AUS Eastern Standard Time, West - /// Pacific Standard Time, Tasmania Standard Time, Magadan Standard - /// Time, Vladivostok Standard Time, Russia Time Zone 10, Central - /// Pacific Standard Time, Russia Time Zone 11, New Zealand Standard - /// Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga - /// Standard Time, Samoa Standard Time, Line Islands Standard Time - /// - [JsonProperty(PropertyName = "timeZone")] - public string TimeZone { get; set; } - - /// - /// Gets or sets the start time for the profile in ISO 8601 format. - /// - [JsonProperty(PropertyName = "start")] - public System.DateTime Start { get; set; } - - /// - /// Gets or sets the end time for the profile in ISO 8601 format. - /// - [JsonProperty(PropertyName = "end")] - public System.DateTime End { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - //Nothing to validate - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TriggerCondition.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TriggerCondition.cs deleted file mode 100644 index c14ebe65e7309..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/TriggerCondition.cs +++ /dev/null @@ -1,88 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// The condition that results in the Log Search rule. - /// - public partial class TriggerCondition - { - /// - /// Initializes a new instance of the TriggerCondition class. - /// - public TriggerCondition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the TriggerCondition class. - /// - /// Evaluation operation for rule - - /// 'GreaterThan' or 'LessThan. Possible values include: 'GreaterThan', - /// 'LessThan', 'Equal' - /// Result or count threshold based on which - /// rule should be triggered. - /// Trigger condition for metric query - /// rule - public TriggerCondition(string thresholdOperator, double threshold, LogMetricTrigger metricTrigger = default(LogMetricTrigger)) - { - ThresholdOperator = thresholdOperator; - Threshold = threshold; - MetricTrigger = metricTrigger; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets evaluation operation for rule - 'GreaterThan' or - /// 'LessThan. Possible values include: 'GreaterThan', 'LessThan', - /// 'Equal' - /// - [JsonProperty(PropertyName = "thresholdOperator")] - public string ThresholdOperator { get; set; } - - /// - /// Gets or sets result or count threshold based on which rule should - /// be triggered. - /// - [JsonProperty(PropertyName = "threshold")] - public double Threshold { get; set; } - - /// - /// Gets or sets trigger condition for metric query rule - /// - [JsonProperty(PropertyName = "metricTrigger")] - public LogMetricTrigger MetricTrigger { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ThresholdOperator == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ThresholdOperator"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Unit.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Unit.cs deleted file mode 100644 index 285e6bd05001f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/Unit.cs +++ /dev/null @@ -1,126 +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.Monitor.Models -{ - using Newtonsoft.Json; - using Newtonsoft.Json.Converters; - using System.Runtime; - using System.Runtime.Serialization; - - /// - /// Defines values for Unit. - /// - [JsonConverter(typeof(StringEnumConverter))] - public enum Unit - { - [EnumMember(Value = "Count")] - Count, - [EnumMember(Value = "Bytes")] - Bytes, - [EnumMember(Value = "Seconds")] - Seconds, - [EnumMember(Value = "CountPerSecond")] - CountPerSecond, - [EnumMember(Value = "BytesPerSecond")] - BytesPerSecond, - [EnumMember(Value = "Percent")] - Percent, - [EnumMember(Value = "MilliSeconds")] - MilliSeconds, - [EnumMember(Value = "ByteSeconds")] - ByteSeconds, - [EnumMember(Value = "Unspecified")] - Unspecified, - [EnumMember(Value = "Cores")] - Cores, - [EnumMember(Value = "MilliCores")] - MilliCores, - [EnumMember(Value = "NanoCores")] - NanoCores, - [EnumMember(Value = "BitsPerSecond")] - BitsPerSecond - } - internal static class UnitEnumExtension - { - internal static string ToSerializedValue(this Unit? value) - { - return value == null ? null : ((Unit)value).ToSerializedValue(); - } - - internal static string ToSerializedValue(this Unit value) - { - switch( value ) - { - case Unit.Count: - return "Count"; - case Unit.Bytes: - return "Bytes"; - case Unit.Seconds: - return "Seconds"; - case Unit.CountPerSecond: - return "CountPerSecond"; - case Unit.BytesPerSecond: - return "BytesPerSecond"; - case Unit.Percent: - return "Percent"; - case Unit.MilliSeconds: - return "MilliSeconds"; - case Unit.ByteSeconds: - return "ByteSeconds"; - case Unit.Unspecified: - return "Unspecified"; - case Unit.Cores: - return "Cores"; - case Unit.MilliCores: - return "MilliCores"; - case Unit.NanoCores: - return "NanoCores"; - case Unit.BitsPerSecond: - return "BitsPerSecond"; - } - return null; - } - - internal static Unit? ParseUnit(this string value) - { - switch( value ) - { - case "Count": - return Unit.Count; - case "Bytes": - return Unit.Bytes; - case "Seconds": - return Unit.Seconds; - case "CountPerSecond": - return Unit.CountPerSecond; - case "BytesPerSecond": - return Unit.BytesPerSecond; - case "Percent": - return Unit.Percent; - case "MilliSeconds": - return Unit.MilliSeconds; - case "ByteSeconds": - return Unit.ByteSeconds; - case "Unspecified": - return Unit.Unspecified; - case "Cores": - return Unit.Cores; - case "MilliCores": - return Unit.MilliCores; - case "NanoCores": - return Unit.NanoCores; - case "BitsPerSecond": - return Unit.BitsPerSecond; - } - return null; - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/VMInsightsOnboardingStatus.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/VMInsightsOnboardingStatus.cs deleted file mode 100644 index d49ea50f62ff9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/VMInsightsOnboardingStatus.cs +++ /dev/null @@ -1,134 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// VM Insights onboarding status for a resource. - /// - [Rest.Serialization.JsonTransformation] - public partial class VMInsightsOnboardingStatus : ProxyResource - { - /// - /// Initializes a new instance of the VMInsightsOnboardingStatus class. - /// - public VMInsightsOnboardingStatus() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VMInsightsOnboardingStatus class. - /// - /// Azure Resource Manager identifier of the - /// resource whose onboarding status is being represented. - /// The onboarding status for the - /// resource. Note that, a higher level scope, e.g., resource group or - /// subscription, is considered onboarded if at least one resource - /// under it is onboarded. Possible values include: 'onboarded', - /// 'notOnboarded', 'unknown' - /// The status of VM Insights data from the - /// resource. When reported as `present` the data array will contain - /// information about the data containers to which data for the - /// specified resource is being routed. Possible values include: - /// 'present', 'notPresent' - /// Azure resource Id - /// Azure resource name - /// Azure resource type - /// Containers that currently store VM Insights data - /// for the specified resource. - public VMInsightsOnboardingStatus(string resourceId, string onboardingStatus, string dataStatus, string id = default(string), string name = default(string), string type = default(string), IList data = default(IList)) - : base(id, name, type) - { - ResourceId = resourceId; - OnboardingStatus = onboardingStatus; - DataStatus = dataStatus; - Data = data; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets azure Resource Manager identifier of the resource - /// whose onboarding status is being represented. - /// - [JsonProperty(PropertyName = "properties.resourceId")] - public string ResourceId { get; set; } - - /// - /// Gets or sets the onboarding status for the resource. Note that, a - /// higher level scope, e.g., resource group or subscription, is - /// considered onboarded if at least one resource under it is - /// onboarded. Possible values include: 'onboarded', 'notOnboarded', - /// 'unknown' - /// - [JsonProperty(PropertyName = "properties.onboardingStatus")] - public string OnboardingStatus { get; set; } - - /// - /// Gets or sets the status of VM Insights data from the resource. When - /// reported as `present` the data array will contain information about - /// the data containers to which data for the specified resource is - /// being routed. Possible values include: 'present', 'notPresent' - /// - [JsonProperty(PropertyName = "properties.dataStatus")] - public string DataStatus { get; set; } - - /// - /// Gets or sets containers that currently store VM Insights data for - /// the specified resource. - /// - [JsonProperty(PropertyName = "properties.data")] - public IList Data { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ResourceId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); - } - if (OnboardingStatus == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "OnboardingStatus"); - } - if (DataStatus == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "DataStatus"); - } - if (Data != null) - { - foreach (var element in Data) - { - if (element != null) - { - element.Validate(); - } - } - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/VoiceReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/VoiceReceiver.cs deleted file mode 100644 index b2940329206c3..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/VoiceReceiver.cs +++ /dev/null @@ -1,93 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A voice receiver. - /// - public partial class VoiceReceiver - { - /// - /// Initializes a new instance of the VoiceReceiver class. - /// - public VoiceReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the VoiceReceiver class. - /// - /// The name of the voice receiver. Names must be - /// unique across all receivers within an action group. - /// The country code of the voice - /// receiver. - /// The phone number of the voice - /// receiver. - public VoiceReceiver(string name, string countryCode, string phoneNumber) - { - Name = name; - CountryCode = countryCode; - PhoneNumber = phoneNumber; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the voice receiver. Names must be unique - /// across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the country code of the voice receiver. - /// - [JsonProperty(PropertyName = "countryCode")] - public string CountryCode { get; set; } - - /// - /// Gets or sets the phone number of the voice receiver. - /// - [JsonProperty(PropertyName = "phoneNumber")] - public string PhoneNumber { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (CountryCode == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CountryCode"); - } - if (PhoneNumber == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "PhoneNumber"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebhookNotification.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebhookNotification.cs deleted file mode 100644 index fb61f55197176..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebhookNotification.cs +++ /dev/null @@ -1,63 +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.Monitor.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Webhook notification of an autoscale event. - /// - public partial class WebhookNotification - { - /// - /// Initializes a new instance of the WebhookNotification class. - /// - public WebhookNotification() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WebhookNotification class. - /// - /// the service address to receive the - /// notification. - /// a property bag of settings. This value can - /// be empty. - public WebhookNotification(string serviceUri = default(string), IDictionary properties = default(IDictionary)) - { - ServiceUri = serviceUri; - Properties = properties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the service address to receive the notification. - /// - [JsonProperty(PropertyName = "serviceUri")] - public string ServiceUri { get; set; } - - /// - /// Gets or sets a property bag of settings. This value can be empty. - /// - [JsonProperty(PropertyName = "properties")] - public IDictionary Properties { get; set; } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebhookReceiver.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebhookReceiver.cs deleted file mode 100644 index 6f157dfc42afc..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebhookReceiver.cs +++ /dev/null @@ -1,125 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Linq; - - /// - /// A webhook receiver. - /// - public partial class WebhookReceiver - { - /// - /// Initializes a new instance of the WebhookReceiver class. - /// - public WebhookReceiver() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WebhookReceiver class. - /// - /// The name of the webhook receiver. Names must be - /// unique across all receivers within an action group. - /// The URI where webhooks should be - /// sent. - /// Indicates whether to use common - /// alert schema. - /// Indicates whether or not use AAD - /// authentication. - /// Indicates the webhook app object Id for aad - /// auth. - /// Indicates the identifier uri for aad - /// auth. - /// Indicates the tenant id for aad - /// auth. - public WebhookReceiver(string name, string serviceUri, bool useCommonAlertSchema, bool? useAadAuth = default(bool?), string objectId = default(string), string identifierUri = default(string), string tenantId = default(string)) - { - Name = name; - ServiceUri = serviceUri; - UseCommonAlertSchema = useCommonAlertSchema; - UseAadAuth = useAadAuth; - ObjectId = objectId; - IdentifierUri = identifierUri; - TenantId = tenantId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the name of the webhook receiver. Names must be unique - /// across all receivers within an action group. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets the URI where webhooks should be sent. - /// - [JsonProperty(PropertyName = "serviceUri")] - public string ServiceUri { get; set; } - - /// - /// Gets or sets indicates whether to use common alert schema. - /// - [JsonProperty(PropertyName = "useCommonAlertSchema")] - public bool UseCommonAlertSchema { get; set; } - - /// - /// Gets or sets indicates whether or not use AAD authentication. - /// - [JsonProperty(PropertyName = "useAadAuth")] - public bool? UseAadAuth { get; set; } - - /// - /// Gets or sets indicates the webhook app object Id for aad auth. - /// - [JsonProperty(PropertyName = "objectId")] - public string ObjectId { get; set; } - - /// - /// Gets or sets indicates the identifier uri for aad auth. - /// - [JsonProperty(PropertyName = "identifierUri")] - public string IdentifierUri { get; set; } - - /// - /// Gets or sets indicates the tenant id for aad auth. - /// - [JsonProperty(PropertyName = "tenantId")] - public string TenantId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (ServiceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ServiceUri"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebtestLocationAvailabilityCriteria.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebtestLocationAvailabilityCriteria.cs deleted file mode 100644 index 9ade80267628d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WebtestLocationAvailabilityCriteria.cs +++ /dev/null @@ -1,96 +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.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Specifies the metric alert rule criteria for a web test resource. - /// - [Newtonsoft.Json.JsonObject("Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria")] - public partial class WebtestLocationAvailabilityCriteria : MetricAlertCriteria - { - /// - /// Initializes a new instance of the - /// WebtestLocationAvailabilityCriteria class. - /// - public WebtestLocationAvailabilityCriteria() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the - /// WebtestLocationAvailabilityCriteria class. - /// - /// The Application Insights web test - /// Id. - /// The Application Insights resource - /// Id. - /// The number of failed - /// locations. - /// Unmatched properties from the - /// message are deserialized this collection - public WebtestLocationAvailabilityCriteria(string webTestId, string componentId, double failedLocationCount, IDictionary additionalProperties = default(IDictionary)) - : base(additionalProperties) - { - WebTestId = webTestId; - ComponentId = componentId; - FailedLocationCount = failedLocationCount; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the Application Insights web test Id. - /// - [JsonProperty(PropertyName = "webTestId")] - public string WebTestId { get; set; } - - /// - /// Gets or sets the Application Insights resource Id. - /// - [JsonProperty(PropertyName = "componentId")] - public string ComponentId { get; set; } - - /// - /// Gets or sets the number of failed locations. - /// - [JsonProperty(PropertyName = "failedLocationCount")] - public double FailedLocationCount { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (WebTestId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "WebTestId"); - } - if (ComponentId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ComponentId"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs deleted file mode 100644 index 61f6f218370f7..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WindowsEventLogDataSource.cs +++ /dev/null @@ -1,117 +0,0 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.Monitor.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Definition of which Windows Event Log events will be collected and how - /// they will be collected. - /// Only collected from Windows machines. - /// - public partial class WindowsEventLogDataSource - { - /// - /// Initializes a new instance of the WindowsEventLogDataSource class. - /// - public WindowsEventLogDataSource() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WindowsEventLogDataSource class. - /// - /// List of streams that this data source will be - /// sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent - /// to. - /// The interval between data - /// uploads (scheduled transfers), rounded up to the nearest minute. - /// Possible values include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', - /// 'PT60M' - /// A list of Windows Event Log queries in - /// XPATH format. - /// A friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - public WindowsEventLogDataSource(IList streams, string scheduledTransferPeriod, IList xPathQueries, string name) - { - Streams = streams; - ScheduledTransferPeriod = scheduledTransferPeriod; - XPathQueries = xPathQueries; - Name = name; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets list of streams that this data source will be sent to. - /// A stream indicates what schema will be used for this data and - /// usually what table in Log Analytics the data will be sent to. - /// - [JsonProperty(PropertyName = "streams")] - public IList Streams { get; set; } - - /// - /// Gets or sets the interval between data uploads (scheduled - /// transfers), rounded up to the nearest minute. Possible values - /// include: 'PT1M', 'PT5M', 'PT15M', 'PT30M', 'PT60M' - /// - [JsonProperty(PropertyName = "scheduledTransferPeriod")] - public string ScheduledTransferPeriod { get; set; } - - /// - /// Gets or sets a list of Windows Event Log queries in XPATH format. - /// - [JsonProperty(PropertyName = "xPathQueries")] - public IList XPathQueries { get; set; } - - /// - /// Gets or sets a friendly name for the data source. - /// This name should be unique across all data sources (regardless of - /// type) within the data collection rule. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Streams == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Streams"); - } - if (ScheduledTransferPeriod == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ScheduledTransferPeriod"); - } - if (XPathQueries == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "XPathQueries"); - } - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WorkspaceInfo.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WorkspaceInfo.cs deleted file mode 100644 index e2a70bce08f20..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/WorkspaceInfo.cs +++ /dev/null @@ -1,95 +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.Monitor.Models -{ - using Microsoft.Rest; - using Microsoft.Rest.Serialization; - using Newtonsoft.Json; - using System.Linq; - - /// - /// Information about a Log Analytics Workspace. - /// - [Rest.Serialization.JsonTransformation] - public partial class WorkspaceInfo - { - /// - /// Initializes a new instance of the WorkspaceInfo class. - /// - public WorkspaceInfo() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the WorkspaceInfo class. - /// - /// Azure Resource Manager identifier of the Log - /// Analytics Workspace. - /// Location of the Log Analytics - /// workspace. - /// Log Analytics workspace - /// identifier. - public WorkspaceInfo(string id, string location, string customerId) - { - Id = id; - Location = location; - CustomerId = customerId; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets azure Resource Manager identifier of the Log Analytics - /// Workspace. - /// - [JsonProperty(PropertyName = "id")] - public string Id { get; set; } - - /// - /// Gets or sets location of the Log Analytics workspace. - /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } - - /// - /// Gets or sets log Analytics workspace identifier. - /// - [JsonProperty(PropertyName = "properties.customerId")] - public string CustomerId { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Id == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Id"); - } - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - if (CustomerId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "CustomerId"); - } - } - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs index aedbcd71c6ab5..7986eae4a1c6e 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/MonitorManagementClient.cs @@ -47,7 +47,12 @@ public partial class MonitorManagementClient : ServiceClient - /// The Azure subscription Id. + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// The ID of the target subscription. /// public string SubscriptionId { get; set; } @@ -69,147 +74,11 @@ public partial class MonitorManagementClient : ServiceClient public bool? GenerateClientRequestId { get; set; } - /// - /// Gets the IAutoscaleSettingsOperations. - /// - public virtual IAutoscaleSettingsOperations AutoscaleSettings { get; private set; } - - /// - /// Gets the IOperations. - /// - public virtual IOperations Operations { get; private set; } - - /// - /// Gets the IAlertRuleIncidentsOperations. - /// - public virtual IAlertRuleIncidentsOperations AlertRuleIncidents { get; private set; } - - /// - /// Gets the IAlertRulesOperations. - /// - public virtual IAlertRulesOperations AlertRules { get; private set; } - - /// - /// Gets the ILogProfilesOperations. - /// - public virtual ILogProfilesOperations LogProfiles { get; private set; } - - /// - /// Gets the IDiagnosticSettingsOperations. - /// - public virtual IDiagnosticSettingsOperations DiagnosticSettings { get; private set; } - - /// - /// Gets the IDiagnosticSettingsCategoryOperations. - /// - public virtual IDiagnosticSettingsCategoryOperations DiagnosticSettingsCategory { get; private set; } - - /// - /// Gets the IActionGroupsOperations. - /// - public virtual IActionGroupsOperations ActionGroups { get; private set; } - /// /// Gets the IActivityLogAlertsOperations. /// public virtual IActivityLogAlertsOperations ActivityLogAlerts { get; private set; } - /// - /// Gets the IActivityLogsOperations. - /// - public virtual IActivityLogsOperations ActivityLogs { get; private set; } - - /// - /// Gets the IEventCategoriesOperations. - /// - public virtual IEventCategoriesOperations EventCategories { get; private set; } - - /// - /// Gets the ITenantActivityLogsOperations. - /// - public virtual ITenantActivityLogsOperations TenantActivityLogs { get; private set; } - - /// - /// Gets the IMetricDefinitionsOperations. - /// - public virtual IMetricDefinitionsOperations MetricDefinitions { get; private set; } - - /// - /// Gets the IMetricsOperations. - /// - public virtual IMetricsOperations Metrics { get; private set; } - - /// - /// Gets the IMetricBaselineOperations. - /// - public virtual IMetricBaselineOperations MetricBaseline { get; private set; } - - /// - /// Gets the IBaselinesOperations. - /// - public virtual IBaselinesOperations Baselines { get; private set; } - - /// - /// Gets the IMetricAlertsOperations. - /// - public virtual IMetricAlertsOperations MetricAlerts { get; private set; } - - /// - /// Gets the IMetricAlertsStatusOperations. - /// - public virtual IMetricAlertsStatusOperations MetricAlertsStatus { get; private set; } - - /// - /// Gets the IScheduledQueryRulesOperations. - /// - public virtual IScheduledQueryRulesOperations ScheduledQueryRules { get; private set; } - - /// - /// Gets the IMetricNamespacesOperations. - /// - public virtual IMetricNamespacesOperations MetricNamespaces { get; private set; } - - /// - /// Gets the IVMInsightsOperations. - /// - public virtual IVMInsightsOperations VMInsights { get; private set; } - - /// - /// Gets the IPrivateLinkScopesOperations. - /// - public virtual IPrivateLinkScopesOperations PrivateLinkScopes { get; private set; } - - /// - /// Gets the IPrivateLinkScopeOperationStatusOperations. - /// - public virtual IPrivateLinkScopeOperationStatusOperations PrivateLinkScopeOperationStatus { get; private set; } - - /// - /// Gets the IPrivateLinkResourcesOperations. - /// - public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } - - /// - /// Gets the IPrivateEndpointConnectionsOperations. - /// - public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } - - /// - /// Gets the IPrivateLinkScopedResourcesOperations. - /// - public virtual IPrivateLinkScopedResourcesOperations PrivateLinkScopedResources { get; private set; } - - /// - /// Gets the IDataCollectionRules. - /// - public virtual IDataCollectionRules DataCollectionRules { get; private set; } - - /// - /// Gets the IDataCollectionRuleAssociations. - /// - public virtual IDataCollectionRuleAssociations DataCollectionRuleAssociations { get; private set; } - - /// /// Initializes a new instance of the MonitorManagementClient class. /// @@ -451,35 +320,9 @@ public MonitorManagementClient(System.Uri baseUri, ServiceClientCredentials cred /// private void Initialize() { - AutoscaleSettings = new AutoscaleSettingsOperations(this); - Operations = new Operations(this); - AlertRuleIncidents = new AlertRuleIncidentsOperations(this); - AlertRules = new AlertRulesOperations(this); - LogProfiles = new LogProfilesOperations(this); - DiagnosticSettings = new DiagnosticSettingsOperations(this); - DiagnosticSettingsCategory = new DiagnosticSettingsCategoryOperations(this); - ActionGroups = new ActionGroupsOperations(this); ActivityLogAlerts = new ActivityLogAlertsOperations(this); - ActivityLogs = new ActivityLogsOperations(this); - EventCategories = new EventCategoriesOperations(this); - TenantActivityLogs = new TenantActivityLogsOperations(this); - MetricDefinitions = new MetricDefinitionsOperations(this); - Metrics = new MetricsOperations(this); - MetricBaseline = new MetricBaselineOperations(this); - Baselines = new BaselinesOperations(this); - MetricAlerts = new MetricAlertsOperations(this); - MetricAlertsStatus = new MetricAlertsStatusOperations(this); - ScheduledQueryRules = new ScheduledQueryRulesOperations(this); - MetricNamespaces = new MetricNamespacesOperations(this); - VMInsights = new VMInsightsOperations(this); - PrivateLinkScopes = new PrivateLinkScopesOperations(this); - PrivateLinkScopeOperationStatus = new PrivateLinkScopeOperationStatusOperations(this); - PrivateLinkResources = new PrivateLinkResourcesOperations(this); - PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); - PrivateLinkScopedResources = new PrivateLinkScopedResourcesOperations(this); - DataCollectionRules = new DataCollectionRules(this); - DataCollectionRuleAssociations = new DataCollectionRuleAssociations(this); BaseUri = new System.Uri("https://management.azure.com"); + ApiVersion = "2020-10-01"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; @@ -509,18 +352,6 @@ private void Initialize() new Iso8601TimeSpanConverter() } }; - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("criterionType")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("criterionType")); - SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter("odata.type")); - DeserializationSettings.Converters.Add(new PolymorphicDeserializeJsonConverter("odata.type")); CustomInitialize(); DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Operations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Operations.cs deleted file mode 100644 index 8e15790a2f9b0..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Operations.cs +++ /dev/null @@ -1,219 +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.Monitor -{ - 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(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Lists all of the available operations from Microsoft.Insights provider. - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/microsoft.insights/operations").ToString(); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/OperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/OperationsExtensions.cs deleted file mode 100644 index 20dca99b5bd73..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/OperationsExtensions.cs +++ /dev/null @@ -1,53 +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.Monitor -{ - 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 operations from Microsoft.Insights provider. - /// - /// - /// The operations group for this extension method. - /// - public static OperationListResult List(this IOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Lists all of the available operations from Microsoft.Insights provider. - /// - /// - /// 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; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperations.cs deleted file mode 100644 index b7707970f58d2..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperations.cs +++ /dev/null @@ -1,1078 +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.Monitor -{ - 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; - - /// - /// PrivateEndpointConnectionsOperations operations. - /// - internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations - { - /// - /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateEndpointConnectionsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets a private endpoint connection. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - 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; - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (privateEndpointConnectionName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// 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>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(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, "ListByPrivateLinkScopeNext", 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs deleted file mode 100644 index d07f38630a449..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs +++ /dev/null @@ -1,331 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateEndpointConnectionsOperations. - /// - public static partial class PrivateEndpointConnectionsOperationsExtensions - { - /// - /// Gets a private endpoint connection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName) - { - return operations.GetAsync(resourceGroupName, scopeName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Gets a private endpoint connection. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - public static void Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName) - { - operations.DeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName) - { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - public static PrivateEndpointConnection BeginCreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, PrivateEndpointConnection parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - public static void BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName) - { - operations.BeginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private endpoint connection. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string scopeName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByPrivateLinkScopeNext(this IPrivateEndpointConnectionsOperations operations, string nextPageLink) - { - return operations.ListByPrivateLinkScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeNextAsync(this IPrivateEndpointConnectionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperations.cs deleted file mode 100644 index 62700162013ce..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperations.cs +++ /dev/null @@ -1,627 +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.Monitor -{ - 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; - - /// - /// PrivateLinkResourcesOperations operations. - /// - internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations - { - /// - /// Initializes a new instance of the PrivateLinkResourcesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkResourcesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string groupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (groupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "groupName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("groupName", groupName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{groupName}", System.Uri.EscapeDataString(groupName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// 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>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(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, "ListByPrivateLinkScopeNext", 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperationsExtensions.cs deleted file mode 100644 index dafb85e58f418..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkResourcesOperationsExtensions.cs +++ /dev/null @@ -1,151 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkResourcesOperations. - /// - public static partial class PrivateLinkResourcesOperationsExtensions - { - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName) - { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link resource. - /// - public static PrivateLinkResource Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, string groupName) - { - return operations.GetAsync(resourceGroupName, scopeName, groupName).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the private link resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string scopeName, string groupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, groupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByPrivateLinkScopeNext(this IPrivateLinkResourcesOperations operations, string nextPageLink) - { - return operations.ListByPrivateLinkScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the private link resources that need to be created for a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeNextAsync(this IPrivateLinkResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperations.cs deleted file mode 100644 index 9fdbfc3bdff8a..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperations.cs +++ /dev/null @@ -1,249 +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.Monitor -{ - 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; - - /// - /// PrivateLinkScopeOperationStatusOperations operations. - /// - internal partial class PrivateLinkScopeOperationStatusOperations : IServiceOperations, IPrivateLinkScopeOperationStatusOperations - { - /// - /// Initializes a new instance of the PrivateLinkScopeOperationStatusOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkScopeOperationStatusOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Get the status of an azure asynchronous operation associated with a private - /// link scope operation. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string asyncOperationId, string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (asyncOperationId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "asyncOperationId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("asyncOperationId", asyncOperationId); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}").ToString(); - _url = _url.Replace("{asyncOperationId}", System.Uri.EscapeDataString(asyncOperationId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs deleted file mode 100644 index e462cde5e7b67..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopeOperationStatusOperationsExtensions.cs +++ /dev/null @@ -1,67 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkScopeOperationStatusOperations. - /// - public static partial class PrivateLinkScopeOperationStatusOperationsExtensions - { - /// - /// Get the status of an azure asynchronous operation associated with a private - /// link scope operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - public static OperationStatus Get(this IPrivateLinkScopeOperationStatusOperations operations, string asyncOperationId, string resourceGroupName) - { - return operations.GetAsync(asyncOperationId, resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Get the status of an azure asynchronous operation associated with a private - /// link scope operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The operation Id. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkScopeOperationStatusOperations operations, string asyncOperationId, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(asyncOperationId, resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperations.cs deleted file mode 100644 index d95c8489f5dce..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperations.cs +++ /dev/null @@ -1,1095 +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.Monitor -{ - 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; - - /// - /// PrivateLinkScopedResourcesOperations operations. - /// - internal partial class PrivateLinkScopedResourcesOperations : IServiceOperations, IPrivateLinkScopedResourcesOperations - { - /// - /// Initializes a new instance of the PrivateLinkScopedResourcesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkScopedResourcesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListByPrivateLinkScopeWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByPrivateLinkScope", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2019-10-17-preview"; - ScopedResource parameters = new ScopedResource(); - if (linkedResourceId != null) - { - parameters.LinkedResourceId = linkedResourceId; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("name", name); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) - { - 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); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, string name, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "name"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("name", name); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - _url = _url.Replace("{name}", System.Uri.EscapeDataString(name)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// 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>> ListByPrivateLinkScopeNextWithHttpMessagesAsync(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, "ListByPrivateLinkScopeNext", 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs deleted file mode 100644 index 3347d287b5359..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopedResourcesOperationsExtensions.cs +++ /dev/null @@ -1,335 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkScopedResourcesOperations. - /// - public static partial class PrivateLinkScopedResourcesOperationsExtensions - { - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - public static ScopedResource Get(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name) - { - return operations.GetAsync(resourceGroupName, scopeName, name).GetAwaiter().GetResult(); - } - - /// - /// Gets a scoped resource in a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - public static ScopedResource CreateOrUpdate(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string)) - { - return operations.CreateOrUpdateAsync(resourceGroupName, scopeName, name, linkedResourceId).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - public static void Delete(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name) - { - operations.DeleteAsync(resourceGroupName, scopeName, name).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static IPage ListByPrivateLinkScope(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName) - { - return operations.ListByPrivateLinkScopeAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - public static ScopedResource BeginCreateOrUpdate(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string)) - { - return operations.BeginCreateOrUpdateAsync(resourceGroupName, scopeName, name, linkedResourceId).GetAwaiter().GetResult(); - } - - /// - /// Approve or reject a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The resource id of the scoped Azure monitor resource. - /// - /// - /// The cancellation token. - /// - public static async Task BeginCreateOrUpdateAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, string linkedResourceId = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, name, linkedResourceId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - public static void BeginDelete(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name) - { - operations.BeginDeleteAsync(resourceGroupName, scopeName, name).GetAwaiter().GetResult(); - } - - /// - /// Deletes a private endpoint connection with a given name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The name of the scoped resource object. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IPrivateLinkScopedResourcesOperations operations, string resourceGroupName, string scopeName, string name, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, name, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByPrivateLinkScopeNext(this IPrivateLinkScopedResourcesOperations operations, string nextPageLink) - { - return operations.ListByPrivateLinkScopeNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets all private endpoint connections on a private link scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByPrivateLinkScopeNextAsync(this IPrivateLinkScopedResourcesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByPrivateLinkScopeNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperations.cs deleted file mode 100644 index 31ebf39a4d7b9..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperations.cs +++ /dev/null @@ -1,1593 +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.Monitor -{ - 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; - - /// - /// PrivateLinkScopesOperations operations. - /// - internal partial class PrivateLinkScopesOperations : IServiceOperations, IPrivateLinkScopesOperations - { - /// - /// Initializes a new instance of the PrivateLinkScopesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal PrivateLinkScopesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, customHeaders, cancellationToken).ConfigureAwait(false); - return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); - } - - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot - /// specify a different value for InstrumentationKey nor AppId in the Put - /// operation. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - if (azureMonitorPrivateLinkScopePayload == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "azureMonitorPrivateLinkScopePayload"); - } - if (azureMonitorPrivateLinkScopePayload != null) - { - azureMonitorPrivateLinkScopePayload.Validate(); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("azureMonitorPrivateLinkScopePayload", azureMonitorPrivateLinkScopePayload); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(azureMonitorPrivateLinkScopePayload != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(azureMonitorPrivateLinkScopePayload, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - 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); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - /// - /// 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> UpdateTagsWithHttpMessagesAsync(string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-preview"; - TagsResource privateLinkScopeTags = new TagsResource(); - if (tags != null) - { - privateLinkScopeTags.Tags = tags; - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("privateLinkScopeTags", privateLinkScopeTags); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateTags", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(privateLinkScopeTags != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateLinkScopeTags, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope 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 - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string scopeName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (scopeName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "scopeName"); - } - string apiVersion = "2019-10-17-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("scopeName", scopeName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{scopeName}", System.Uri.EscapeDataString(scopeName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) - { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex = new CloudException(_errorBody.Message); - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new 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; - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// 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>> ListByResourceGroupNextWithHttpMessagesAsync(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, "ListByResourceGroupNext", 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/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperationsExtensions.cs deleted file mode 100644 index 9ef341324e7c8..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/PrivateLinkScopesOperationsExtensions.cs +++ /dev/null @@ -1,371 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for PrivateLinkScopesOperations. - /// - public static partial class PrivateLinkScopesOperationsExtensions - { - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - public static IPage List(this IPrivateLinkScopesOperations operations) - { - return operations.ListAsync().GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this IPrivateLinkScopesOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - public static IPage ListByResourceGroup(this IPrivateLinkScopesOperations operations, string resourceGroupName) - { - return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static void Delete(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) - { - operations.DeleteAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static AzureMonitorPrivateLinkScope Get(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) - { - return operations.GetAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Returns a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot - /// specify a different value for InstrumentationKey nor AppId in the Put - /// operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure Monitor - /// PrivateLinkScope. - /// - public static AzureMonitorPrivateLinkScope CreateOrUpdate(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload) - { - return operations.CreateOrUpdateAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload).GetAwaiter().GetResult(); - } - - /// - /// Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot - /// specify a different value for InstrumentationKey nor AppId in the Put - /// operation. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Properties that need to be specified to create or update a Azure Monitor - /// PrivateLinkScope. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, AzureMonitorPrivateLinkScope azureMonitorPrivateLinkScopePayload, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - public static AzureMonitorPrivateLinkScope UpdateTags(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary)) - { - return operations.UpdateTagsAsync(resourceGroupName, scopeName, tags).GetAwaiter().GetResult(); - } - - /// - /// Updates an existing PrivateLinkScope's tags. To update other fields use the - /// CreateOrUpdate method. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// Resource tags - /// - /// - /// The cancellation token. - /// - public static async Task UpdateTagsAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateTagsWithHttpMessagesAsync(resourceGroupName, scopeName, tags, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - public static void BeginDelete(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName) - { - operations.BeginDeleteAsync(resourceGroupName, scopeName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a Azure Monitor PrivateLinkScope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the Azure Monitor PrivateLinkScope resource. - /// - /// - /// The cancellation token. - /// - public static async Task BeginDeleteAsync(this IPrivateLinkScopesOperations operations, string resourceGroupName, string scopeName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, scopeName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this IPrivateLinkScopesOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListNextAsync(this IPrivateLinkScopesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListByResourceGroupNext(this IPrivateLinkScopesOperations operations, string nextPageLink) - { - return operations.ListByResourceGroupNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets a list of Azure Monitor PrivateLinkScopes within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupNextAsync(this IPrivateLinkScopesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperations.cs deleted file mode 100644 index 7f8e047880016..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperations.cs +++ /dev/null @@ -1,1215 +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.Monitor -{ - 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; - - /// - /// ScheduledQueryRulesOperations operations. - /// - internal partial class ScheduledQueryRulesOperations : IServiceOperations, IScheduledQueryRulesOperations - { - /// - /// Initializes a new instance of the ScheduledQueryRulesOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal ScheduledQueryRulesOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Creates or updates an log search rule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, LogSearchRuleResource parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - string apiVersion = "2018-04-16"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CreateOrUpdate", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PUT"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets an Log Search rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-04-16"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Update log search Rule. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - /// - /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string ruleName, LogSearchRuleResourcePatch parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - string apiVersion = "2018-04-16"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("PATCH"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - if(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes a Log Search rule - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string ruleName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (ruleName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ruleName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-04-16"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("ruleName", ruleName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Delete", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules/{ruleName}").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{ruleName}", System.Uri.EscapeDataString(ruleName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("DELETE"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 204) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List the Log Search rules within a subscription group. - /// - /// - /// OData parameters to apply to the 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>> ListBySubscriptionWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-04-16"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/microsoft.insights/scheduledQueryRules").ToString(); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// List the Log Search rules within a resource group. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the 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>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceGroupName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); - } - if (Client.SubscriptionId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); - } - string apiVersion = "2018-04-16"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("resourceGroupName", resourceGroupName); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/scheduledQueryRules").ToString(); - _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); - _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperationsExtensions.cs deleted file mode 100644 index d654ec4b19562..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/ScheduledQueryRulesOperationsExtensions.cs +++ /dev/null @@ -1,271 +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.Monitor -{ - 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; - - /// - /// Extension methods for ScheduledQueryRulesOperations. - /// - public static partial class ScheduledQueryRulesOperationsExtensions - { - /// - /// Creates or updates an log search rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - public static LogSearchRuleResource CreateOrUpdate(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName, LogSearchRuleResource parameters) - { - return operations.CreateOrUpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Creates or updates an log search rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to create or update. - /// - /// - /// The cancellation token. - /// - public static async Task CreateOrUpdateAsync(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName, LogSearchRuleResource parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets an Log Search rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static LogSearchRuleResource Get(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName) - { - return operations.GetAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Gets an Log Search rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task GetAsync(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Update log search Rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - public static LogSearchRuleResource Update(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName, LogSearchRuleResourcePatch parameters) - { - return operations.UpdateAsync(resourceGroupName, ruleName, parameters).GetAwaiter().GetResult(); - } - - /// - /// Update log search Rule. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The parameters of the rule to update. - /// - /// - /// The cancellation token. - /// - public static async Task UpdateAsync(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName, LogSearchRuleResourcePatch parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, ruleName, parameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Deletes a Log Search rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - public static void Delete(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName) - { - operations.DeleteAsync(resourceGroupName, ruleName).GetAwaiter().GetResult(); - } - - /// - /// Deletes a Log Search rule - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// The name of the rule. - /// - /// - /// The cancellation token. - /// - public static async Task DeleteAsync(this IScheduledQueryRulesOperations operations, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, ruleName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// List the Log Search rules within a subscription group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IEnumerable ListBySubscription(this IScheduledQueryRulesOperations operations, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListBySubscriptionAsync(odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List the Log Search rules within a subscription group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionAsync(this IScheduledQueryRulesOperations operations, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// List the Log Search rules within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the operation. - /// - public static IEnumerable ListByResourceGroup(this IScheduledQueryRulesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery)) - { - return operations.ListByResourceGroupAsync(resourceGroupName, odataQuery).GetAwaiter().GetResult(); - } - - /// - /// List the Log Search rules within a resource group. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The name of the resource group. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListByResourceGroupAsync(this IScheduledQueryRulesOperations operations, string resourceGroupName, ODataQuery odataQuery = default(ODataQuery), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, odataQuery, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs index 25d90d1590b2e..f961df6c21c2d 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs @@ -19,47 +19,9 @@ public static IEnumerable> ApiInfo_MonitorClient { return new Tuple[] { - new Tuple("Insights", "DataCollectionRules", "2019-11-01-preview"), - new Tuple("Insights", "DataCollectionRuleAssociations", "2019-11-01-preview"), - new Tuple("Insights", "MetricAlerts", "2018-03-01"), - new Tuple("Insights", "MetricAlertsStatus", "2018-03-01"), - new Tuple("Insights", "PrivateEndpointConnections", "2019-10-17-preview"), - new Tuple("Insights", "PrivateLinkResources", "2019-10-17-preview"), - new Tuple("Insights", "PrivateLinkScopedResources", "2019-10-17-preview"), - new Tuple("Insights", "VMInsights", "2018-11-27-preview"), - new Tuple("insights", "ActionGroups", "2019-06-01"), - new Tuple("insights", "ActivityLogAlerts", "2017-04-01"), - new Tuple("insights", "ActivityLogs", "2015-04-01"), - new Tuple("insights", "AlertRuleIncidents", "2016-03-01"), - new Tuple("insights", "AlertRules", "2016-03-01"), - new Tuple("insights", "AutoscaleSettings", "2015-04-01"), - new Tuple("insights", "Baselines", "2019-03-01"), - new Tuple("insights", "DiagnosticSettings", "2017-05-01-preview"), - new Tuple("insights", "DiagnosticSettingsCategory", "2017-05-01-preview"), - new Tuple("insights", "EventCategories", "2015-04-01"), - new Tuple("insights", "LogProfiles", "2016-03-01"), - new Tuple("insights", "MetricBaseline", "2017-11-01-preview"), - new Tuple("insights", "MetricDefinitions", "2018-01-01"), - new Tuple("insights", "MetricNamespaces", "2017-12-01-preview"), - new Tuple("insights", "Metrics", "2018-01-01"), - new Tuple("insights", "Operations", "2015-04-01"), - new Tuple("insights", "PrivateLinkScopeOperationStatus", "2019-10-17-preview"), - new Tuple("insights", "PrivateLinkScopes", "2019-10-17-preview"), - new Tuple("insights", "ScheduledQueryRules", "2018-04-16"), - new Tuple("insights", "TenantActivityLogs", "2015-04-01"), + new Tuple("Insights", "ActivityLogAlerts", "2020-10-01"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/monitor/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=C:\\Repos\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "27cc07ddd294d98e05cb301e07a72378df9f87e8"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } - diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/TenantActivityLogsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/TenantActivityLogsOperations.cs deleted file mode 100644 index ed9e35a8f8e10..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/TenantActivityLogsOperations.cs +++ /dev/null @@ -1,419 +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.Monitor -{ - 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; - - /// - /// TenantActivityLogsOperations operations. - /// - internal partial class TenantActivityLogsOperations : IServiceOperations, ITenantActivityLogsOperations - { - /// - /// Initializes a new instance of the TenantActivityLogsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal TenantActivityLogsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription is - /// applicable to this API (the parameters, $filter, etc.).<br>One thing - /// to point out here is that this API does *not* retrieve the logs at the - /// individual subscription of the tenant but only surfaces the logs that were - /// generated at the tenant level. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListWithHttpMessagesAsync(ODataQuery odataQuery = default(ODataQuery), string select = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - string apiVersion = "2015-04-01"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("odataQuery", odataQuery); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("select", select); - 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.insights/eventtypes/management/values").ToString(); - List _queryParameters = new List(); - if (odataQuery != null) - { - var _odataFilter = odataQuery.ToString(); - if (!string.IsNullOrEmpty(_odataFilter)) - { - _queryParameters.Add(_odataFilter); - } - } - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (select != null) - { - _queryParameters.Add(string.Format("$select={0}", System.Uri.EscapeDataString(select))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription is - /// applicable to this API (the parameters, $filter, etc.).<br>One thing - /// to point out here is that this API does *not* retrieve the logs at the - /// individual subscription of the tenant but only surfaces the logs that were - /// generated at the tenant level. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse>(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/TenantActivityLogsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/TenantActivityLogsOperationsExtensions.cs deleted file mode 100644 index c604bbc8afd4f..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/TenantActivityLogsOperationsExtensions.cs +++ /dev/null @@ -1,132 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Microsoft.Rest.Azure.OData; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for TenantActivityLogsOperations. - /// - public static partial class TenantActivityLogsOperationsExtensions - { - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription is - /// applicable to this API (the parameters, $filter, etc.).<br>One thing - /// to point out here is that this API does *not* retrieve the logs at the - /// individual subscription of the tenant but only surfaces the logs that were - /// generated at the tenant level. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - public static IPage List(this ITenantActivityLogsOperations operations, ODataQuery odataQuery = default(ODataQuery), string select = default(string)) - { - return operations.ListAsync(odataQuery, select).GetAwaiter().GetResult(); - } - - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription is - /// applicable to this API (the parameters, $filter, etc.).<br>One thing - /// to point out here is that this API does *not* retrieve the logs at the - /// individual subscription of the tenant but only surfaces the logs that were - /// generated at the tenant level. - /// - /// - /// The operations group for this extension method. - /// - /// - /// OData parameters to apply to the operation. - /// - /// - /// Used to fetch events with only the given properties.<br>The - /// **$select** argument is a comma separated list of property names to be - /// returned. Possible values are: *authorization*, *claims*, *correlationId*, - /// *description*, *eventDataId*, *eventName*, *eventTimestamp*, *httpRequest*, - /// *level*, *operationId*, *operationName*, *properties*, *resourceGroupName*, - /// *resourceProviderName*, *resourceId*, *status*, *submissionTimestamp*, - /// *subStatus*, *subscriptionId* - /// - /// - /// The cancellation token. - /// - public static async Task> ListAsync(this ITenantActivityLogsOperations operations, ODataQuery odataQuery = default(ODataQuery), string select = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListWithHttpMessagesAsync(odataQuery, select, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription is - /// applicable to this API (the parameters, $filter, etc.).<br>One thing - /// to point out here is that this API does *not* retrieve the logs at the - /// individual subscription of the tenant but only surfaces the logs that were - /// generated at the tenant level. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListNext(this ITenantActivityLogsOperations operations, string nextPageLink) - { - return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Gets the Activity Logs for the Tenant.<br>Everything that is - /// applicable to the API to get the Activity Logs for the subscription is - /// applicable to this API (the parameters, $filter, etc.).<br>One thing - /// to point out here is that this API does *not* retrieve the logs at the - /// individual subscription of the tenant but only surfaces the logs that were - /// generated at the tenant level. - /// - /// - /// 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 ITenantActivityLogsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/VMInsightsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/VMInsightsOperations.cs deleted file mode 100644 index ff4927195499d..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/VMInsightsOperations.cs +++ /dev/null @@ -1,231 +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.Monitor -{ - 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; - - /// - /// VMInsightsOperations operations. - /// - internal partial class VMInsightsOperations : IServiceOperations, IVMInsightsOperations - { - /// - /// Initializes a new instance of the VMInsightsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - internal VMInsightsOperations(MonitorManagementClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the MonitorManagementClient - /// - public MonitorManagementClient Client { get; private set; } - - /// - /// Retrieves the VM Insights onboarding status for the specified resource or - /// resource scope. - /// - /// - /// The fully qualified Azure Resource manager identifier of the resource, or - /// scope, whose status to retrieve. - /// - /// - /// 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> GetOnboardingStatusWithHttpMessagesAsync(string resourceUri, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (resourceUri == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "resourceUri"); - } - string apiVersion = "2018-11-27-preview"; - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("apiVersion", apiVersion); - tracingParameters.Add("resourceUri", resourceUri); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetOnboardingStatus", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default").ToString(); - _url = _url.Replace("{resourceUri}", resourceUri); - List _queryParameters = new List(); - if (apiVersion != null) - { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(apiVersion))); - } - if (_queryParameters.Count > 0) - { - _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); - } - // Create HTTP transport objects - var _httpRequest = new HttpRequestMessage(); - HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); - _httpRequest.RequestUri = new System.Uri(_url); - // Set Headers - if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) - { - _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); - } - if (Client.AcceptLanguage != null) - { - if (_httpRequest.Headers.Contains("accept-language")) - { - _httpRequest.Headers.Remove("accept-language"); - } - _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); - } - - - if (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200) - { - var ex = new ResponseWithErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ResponseWithError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_shouldTrace) - { - ServiceClientTracing.Error(_invocationId, ex); - } - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw ex; - } - // Create Result - var _result = new AzureOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - } -} diff --git a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/VMInsightsOperationsExtensions.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/VMInsightsOperationsExtensions.cs deleted file mode 100644 index 39a54983c5d8c..0000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/VMInsightsOperationsExtensions.cs +++ /dev/null @@ -1,63 +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.Monitor -{ - using Microsoft.Rest; - using Microsoft.Rest.Azure; - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for VMInsightsOperations. - /// - public static partial class VMInsightsOperationsExtensions - { - /// - /// Retrieves the VM Insights onboarding status for the specified resource or - /// resource scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The fully qualified Azure Resource manager identifier of the resource, or - /// scope, whose status to retrieve. - /// - public static VMInsightsOnboardingStatus GetOnboardingStatus(this IVMInsightsOperations operations, string resourceUri) - { - return operations.GetOnboardingStatusAsync(resourceUri).GetAwaiter().GetResult(); - } - - /// - /// Retrieves the VM Insights onboarding status for the specified resource or - /// resource scope. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The fully qualified Azure Resource manager identifier of the resource, or - /// scope, whose status to retrieve. - /// - /// - /// The cancellation token. - /// - public static async Task GetOnboardingStatusAsync(this IVMInsightsOperations operations, string resourceUri, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetOnboardingStatusWithHttpMessagesAsync(resourceUri, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -}