From d5f906430a95adecc7f057696ebb091a68a4db7f Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 24 Dec 2021 07:52:57 +0000 Subject: [PATCH] CodeGen from PR 17128 in Azure/azure-rest-api-specs Merge ef8a8fada6f95d335078d8629bbd867e15c82421 into 35f8a4df47aedc1ce185c854595cba6b83fa6c71 --- .../Generated/ActivityLogAlertsOperations.cs | 429 ++++++++++++++++-- .../ActivityLogAlertsOperationsExtensions.cs | 152 +++++-- .../Generated/IActivityLogAlertsOperations.cs | 82 +++- .../src/Generated/Models/ActionGroup.cs | 311 +++++++++++++ ...ityLogAlertActionList.cs => ActionList.cs} | 18 +- .../Models/ActivityLogAlertActionGroup.cs | 82 ---- .../Models/ActivityLogAlertLeafCondition.cs | 90 ---- .../Models/ActivityLogAlertResource.cs | 69 ++- ...ondition.cs => AlertRuleAllOfCondition.cs} | 30 +- .../Models/AlertRuleAnyOfOrLeafCondition.cs | 85 ++++ .../Models/AlertRuleLeafCondition.cs | 89 ++++ ...rtPatchBody.cs => AlertRulePatchObject.cs} | 28 +- .../src/Generated/SdkInfo_MonitorClient.cs | 13 +- 13 files changed, 1105 insertions(+), 373 deletions(-) create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroup.cs rename sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/{ActivityLogAlertActionList.cs => ActionList.cs} (62%) delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionGroup.cs delete mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertLeafCondition.cs rename sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/{ActivityLogAlertAllOfCondition.cs => AlertRuleAllOfCondition.cs} (62%) create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleAnyOfOrLeafCondition.cs create mode 100644 sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRuleLeafCondition.cs rename sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/{ActivityLogAlertPatchBody.cs => AlertRulePatchObject.cs} (59%) 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 fb328785dc0a..e5f1638660ed 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 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,7 +83,7 @@ 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) { @@ -115,15 +115,15 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - if (activityLogAlert == null) + if (activityLogAlertRule == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlert"); + throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertRule"); } - if (activityLogAlert != null) + if (activityLogAlertRule != null) { - activityLogAlert.Validate(); + activityLogAlertRule.Validate(); } - string apiVersion = "2017-04-01"; + string apiVersion = "2020-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -134,13 +134,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) 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)); @@ -187,9 +187,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"); } @@ -294,13 +294,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } /// - /// Get an activity log alert. + /// Get an Activity Log Alert rule. /// /// /// 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. @@ -355,7 +355,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - string apiVersion = "2017-04-01"; + string apiVersion = "2020-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -371,7 +371,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.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)); @@ -501,13 +501,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } /// - /// Delete an activity log alert. + /// Delete an Activity Log Alert rule. /// /// /// 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. @@ -559,7 +559,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - string apiVersion = "2017-04-01"; + string apiVersion = "2020-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -575,7 +575,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.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)); @@ -687,16 +687,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 is case insensitive. /// /// - /// The name of the activity log alert. + /// The name of the Activity Log Alert rule. /// - /// + /// /// Parameters supplied to the operation. /// /// @@ -720,7 +721,7 @@ 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) { @@ -752,11 +753,11 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertName"); } - if (activityLogAlertPatch == null) + if (activityLogAlertRulePatch == null) { - throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertPatch"); + throw new ValidationException(ValidationRules.CannotBeNull, "activityLogAlertRulePatch"); } - string apiVersion = "2017-04-01"; + string apiVersion = "2020-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -767,13 +768,13 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) 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)); @@ -820,9 +821,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"); } @@ -909,7 +910,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. @@ -932,7 +933,7 @@ 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) { @@ -945,7 +946,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) throw new ValidationException(ValidationRules.MinLength, "Client.SubscriptionId", 1); } } - string apiVersion = "2017-04-01"; + string apiVersion = "2020-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -959,7 +960,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } // 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) @@ -1054,7 +1055,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")) @@ -1067,7 +1068,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) { @@ -1087,7 +1088,7 @@ 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 is case insensitive. @@ -1113,7 +1114,7 @@ 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) { @@ -1141,7 +1142,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) throw new ValidationException(ValidationRules.MinLength, "resourceGroupName", 1); } } - string apiVersion = "2017-04-01"; + string apiVersion = "2020-10-01"; // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1156,7 +1157,7 @@ internal ActivityLogAlertsOperations(MonitorManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.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(); @@ -1252,7 +1253,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")) @@ -1265,7 +1266,343 @@ 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) + { + _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")) + { + _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); + } + // 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) { 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 4f52aac7d9d8..689b9ab95c19 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,7 +22,7 @@ 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. @@ -33,18 +31,18 @@ public static partial class ActivityLogAlertsOperationsExtensions /// 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. @@ -53,24 +51,24 @@ public static ActivityLogAlertResource CreateOrUpdate(this IActivityLogAlertsOpe /// 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. @@ -79,7 +77,7 @@ public static ActivityLogAlertResource CreateOrUpdate(this IActivityLogAlertsOpe /// 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,7 +85,7 @@ 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. @@ -96,7 +94,7 @@ public static ActivityLogAlertResource Get(this IActivityLogAlertsOperations ope /// 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,7 +108,7 @@ 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. @@ -119,7 +117,7 @@ public static ActivityLogAlertResource Get(this IActivityLogAlertsOperations ope /// 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,7 +125,7 @@ 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. @@ -136,7 +134,7 @@ public static void Delete(this IActivityLogAlertsOperations operations, string r /// 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,8 +145,9 @@ 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. @@ -157,19 +156,20 @@ public static void Delete(this IActivityLogAlertsOperations operations, string r /// 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. @@ -178,35 +178,35 @@ public static ActivityLogAlertResource Update(this IActivityLogAlertsOperations /// 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,7 +223,7 @@ 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. @@ -231,13 +231,13 @@ public static IEnumerable ListBySubscriptionId(this IA /// /// 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. @@ -248,7 +248,7 @@ public static IEnumerable ListByResourceGroup(this IAc /// /// 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/IActivityLogAlertsOperations.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/IActivityLogAlertsOperations.cs index 21a14f9e9f9f..333917453e7c 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 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 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 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 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,9 +147,9 @@ 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 is case insensitive. @@ -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/Models/ActionGroup.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroup.cs new file mode 100644 index 000000000000..2caf00d1426c --- /dev/null +++ b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActionGroup.cs @@ -0,0 +1,311 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated 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; + + /// + /// An Azure action group. + /// + public partial class ActionGroup + { + /// + /// Initializes a new instance of the ActionGroup class. + /// + public ActionGroup() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ActionGroup class. + /// + /// 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. + /// 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. + /// The list of event hub receivers + /// that are part of this action group. + public ActionGroup(string groupShortName, bool enabled, 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), IList eventHubReceivers = default(IList)) + { + GroupShortName = groupShortName; + Enabled = enabled; + EmailReceivers = emailReceivers; + SmsReceivers = smsReceivers; + WebhookReceivers = webhookReceivers; + ItsmReceivers = itsmReceivers; + AzureAppPushReceivers = azureAppPushReceivers; + AutomationRunbookReceivers = automationRunbookReceivers; + VoiceReceivers = voiceReceivers; + LogicAppReceivers = logicAppReceivers; + AzureFunctionReceivers = azureFunctionReceivers; + ArmRoleReceivers = armRoleReceivers; + EventHubReceivers = eventHubReceivers; + 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 = "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 = "enabled")] + public bool Enabled { get; set; } + + /// + /// Gets or sets the list of email receivers that are part of this + /// action group. + /// + [JsonProperty(PropertyName = "emailReceivers")] + public IList EmailReceivers { get; set; } + + /// + /// Gets or sets the list of SMS receivers that are part of this action + /// group. + /// + [JsonProperty(PropertyName = "smsReceivers")] + public IList SmsReceivers { get; set; } + + /// + /// Gets or sets the list of webhook receivers that are part of this + /// action group. + /// + [JsonProperty(PropertyName = "webhookReceivers")] + public IList WebhookReceivers { get; set; } + + /// + /// Gets or sets the list of ITSM receivers that are part of this + /// action group. + /// + [JsonProperty(PropertyName = "itsmReceivers")] + public IList ItsmReceivers { get; set; } + + /// + /// Gets or sets the list of AzureAppPush receivers that are part of + /// this action group. + /// + [JsonProperty(PropertyName = "azureAppPushReceivers")] + public IList AzureAppPushReceivers { get; set; } + + /// + /// Gets or sets the list of AutomationRunbook receivers that are part + /// of this action group. + /// + [JsonProperty(PropertyName = "automationRunbookReceivers")] + public IList AutomationRunbookReceivers { get; set; } + + /// + /// Gets or sets the list of voice receivers that are part of this + /// action group. + /// + [JsonProperty(PropertyName = "voiceReceivers")] + public IList VoiceReceivers { get; set; } + + /// + /// Gets or sets the list of logic app receivers that are part of this + /// action group. + /// + [JsonProperty(PropertyName = "logicAppReceivers")] + public IList LogicAppReceivers { get; set; } + + /// + /// Gets or sets the list of azure function receivers that are part of + /// this action group. + /// + [JsonProperty(PropertyName = "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 = "armRoleReceivers")] + public IList ArmRoleReceivers { get; set; } + + /// + /// Gets or sets the list of event hub receivers that are part of this + /// action group. + /// + [JsonProperty(PropertyName = "eventHubReceivers")] + public IList EventHubReceivers { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void 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(); + } + } + } + if (EventHubReceivers != null) + { + foreach (var element10 in EventHubReceivers) + { + if (element10 != null) + { + element10.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 a9de7c860ae5..26aafe4a4135 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/ActivityLogAlertActionGroup.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionGroup.cs deleted file mode 100644 index 07b3b047ba2a..000000000000 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertActionGroup.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.Models -{ - using Microsoft.Rest; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// A pointer to an Azure Action Group. - /// - public partial class ActivityLogAlertActionGroup - { - /// - /// Initializes a new instance of the ActivityLogAlertActionGroup - /// class. - /// - public ActivityLogAlertActionGroup() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ActivityLogAlertActionGroup - /// class. - /// - /// The resourceId 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)) - { - ActionGroupId = actionGroupId; - WebhookProperties = webhookProperties; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets or sets the resourceId of the action group. This cannot be - /// null or empty. - /// - [JsonProperty(PropertyName = "actionGroupId")] - public string ActionGroupId { 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 = "webhookProperties")] - public IDictionary WebhookProperties { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (ActionGroupId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "ActionGroupId"); - } - } - } -} 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 8a951407ad02..000000000000 --- 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/ActivityLogAlertResource.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertResource.cs index 3d3ee5288001..07b4e17a093f 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. @@ -35,9 +35,9 @@ 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. @@ -46,30 +46,21 @@ public ActivityLogAlertResource() /// Azure resource Id /// Azure resource name /// Azure resource type + /// Azure resource kind + /// Azure resource identity /// Resource tags - /// Metadata used by portal/tooling/etc to render - /// different UX experiences for resources of the same type; e.g. - /// ApiApps are a kind of Microsoft.Web/sites type. If supported, the - /// resource provider must validate and persist this value. - /// The etag field is *not* required. If it is - /// provided in the response body, it must also be provided as a header - /// per the normal etag convention. Entity tags are used for comparing - /// two or more entities from the same requested resource. HTTP/1.1 - /// uses entity tags in the etag (section 14.19), If-Match (section - /// 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) - /// header fields. - /// 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), string kind = default(string), string etag = default(string), bool? enabled = default(bool?), string description = default(string)) - : base(location, id, name, type, tags, kind, etag) + /// 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(string location, IList scopes, AlertRuleAllOfCondition condition, ActionList actions, string id = default(string), string name = default(string), string type = default(string), string kind = default(string), string identity = default(string), IDictionary tags = default(IDictionary), bool? enabled = default(bool?), string description = default(string)) + : base(location, id, name, type, kind, identity, tags) { Scopes = scopes; - Enabled = enabled; Condition = condition; Actions = actions; + Enabled = enabled; Description = description; CustomInit(); } @@ -80,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; } 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 bd35eba74812..f6a90d22df8b 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 000000000000..d09651d95f09 --- /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 000000000000..ada48105213c --- /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/ActivityLogAlertPatchBody.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRulePatchObject.cs similarity index 59% rename from sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertPatchBody.cs rename to sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/AlertRulePatchObject.cs index 78a700645914..e9735467269c 100644 --- a/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/Models/ActivityLogAlertPatchBody.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 activity log alert 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 ActivityLogAlertPatchBody + public partial class AlertRulePatchObject { /// - /// Initializes a new instance of the ActivityLogAlertPatchBody class. + /// Initializes a new instance of the AlertRulePatchObject class. /// - public ActivityLogAlertPatchBody() + public AlertRulePatchObject() { CustomInit(); } /// - /// Initializes a new instance of the ActivityLogAlertPatchBody class. + /// Initializes a new instance of the AlertRulePatchObject 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?)) + /// 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 ActivityLogAlertPatchBody() 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 activity log alert is enabled. - /// If an activity log alert 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/SdkInfo_MonitorClient.cs b/sdk/monitor/Microsoft.Azure.Management.Monitor/src/Generated/SdkInfo_MonitorClient.cs index 7b99d381e64b..c7b3fc454301 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 @@ -20,6 +20,7 @@ public static IEnumerable> ApiInfo_MonitorClient return new Tuple[] { new Tuple("Insights", "ActionGroups", "2021-09-01"), + new Tuple("Insights", "ActivityLogAlerts", "2020-10-01"), new Tuple("Insights", "ActivityLogs", "2015-04-01"), new Tuple("Insights", "AlertRules", "2016-03-01"), new Tuple("Insights", "AutoscaleSettings", "2015-04-01"), @@ -42,7 +43,6 @@ public static IEnumerable> ApiInfo_MonitorClient new Tuple("Insights", "ScheduledQueryRules", "2018-04-16"), new Tuple("Insights", "TenantActivityLogs", "2015-04-01"), new Tuple("Insights", "VMInsights", "2018-11-27-preview"), - new Tuple("insights", "ActivityLogAlerts", "2017-04-01"), new Tuple("insights", "AlertRuleIncidents", "2016-03-01"), new Tuple("insights", "MetricNamespaces", "2017-12-01-preview"), new Tuple("insights", "PrivateLinkScopeOperationStatus", "2019-10-17-preview"), @@ -50,16 +50,5 @@ public static IEnumerable> ApiInfo_MonitorClient }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@3.4.2"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/main/specification/monitor/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --tag=package-2021-09 --csharp-sdks-folder=D:\\ICM\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "0fba9ba4b78d20fc1a7ec251dab889b7a7eb8afd"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -