From cc9c98d7428e9f7f0059904692753294ed4955d3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 31 Aug 2022 08:05:06 +0000 Subject: [PATCH] CodeGen from PR 19652 in Azure/azure-rest-api-specs Merge 6e7d042975f3823c483ac775fc736e5ca059c1c6 into 049107d4b086d4bfbcc6c94846e834cadb3886a6 --- ....ResourceManager.Monitor.netstandard2.0.cs | 389 +++++++--------- .../Generated/Extensions/MonitorExtensions.cs | 56 ++- .../ResourceGroupResourceExtensionClient.cs | 8 +- .../SubscriptionResourceExtensionClient.cs | 72 ++- .../src/Generated/LogSearchRuleData.cs | 112 ----- .../Generated/Models/Actions.Serialization.cs | 83 ++++ .../src/Generated/Models/Actions.cs | 37 ++ .../src/Generated/Models/AlertSeverity.cs | 28 +- .../Models/AlertingAction.Serialization.cs | 85 ---- .../src/Generated/Models/AlertingAction.cs | 55 --- .../Models/Condition.Serialization.cs | 164 +++++++ .../src/Generated/Models/Condition.cs | 64 +++ .../ConditionFailingPeriods.Serialization.cs | 61 +++ .../Models/ConditionFailingPeriods.cs | 32 ++ .../Generated/Models/ConditionalOperator.cs | 60 --- .../src/Generated/Models/DimensionOperator.cs | 51 +++ .../Models/LogMetricTrigger.Serialization.cs | 88 ---- .../src/Generated/Models/LogMetricTrigger.cs | 40 -- .../Models/LogSearchRuleData.Serialization.cs | 249 ----------- .../LogSearchRulePatch.Serialization.cs | 40 -- .../Generated/Models/LogSearchRulePatch.cs | 27 -- .../Models/LogSearchRuleResourceCollection.cs | 33 -- .../Models/LogToMetricAction.Serialization.cs | 56 --- .../src/Generated/Models/LogToMetricAction.cs | 43 -- .../src/Generated/Models/MetricTriggerType.cs | 51 --- .../Models/MonitorAction.Serialization.cs | 45 -- .../src/Generated/Models/MonitorAction.cs | 32 -- .../MonitorConditionOperator.Serialization.cs | 2 + .../Models/MonitorConditionOperator.cs | 4 +- .../src/Generated/Models/MonitorCriteria.cs | 45 -- .../Models/MonitorDimension.Serialization.cs | 4 +- .../src/Generated/Models/MonitorDimension.cs | 8 +- .../src/Generated/Models/MonitorEnabled.cs | 51 --- .../src/Generated/Models/MonitorKind.cs | 51 +++ .../src/Generated/Models/MonitorOperator.cs | 3 - .../Models/MonitorProvisioningState.cs | 57 --- .../Models/MonitorSchedule.Serialization.cs | 45 -- .../src/Generated/Models/MonitorSchedule.cs | 27 -- .../Models/MonitorSource.Serialization.cs | 91 ---- .../src/Generated/Models/MonitorSource.cs | 53 --- .../Models/MonitorSourceQueryType.cs | 48 -- .../NotificationDetails.Serialization.cs | 78 ---- .../Generated/Models/NotificationDetails.cs | 40 -- ...heduledQueryRuleCriteria.Serialization.cs} | 30 +- .../Models/ScheduledQueryRuleCriteria.cs | 32 ++ ...ryRuleResourceCollection.Serialization.cs} | 18 +- .../ScheduledQueryRuleResourceCollection.cs | 37 ++ ...uledQueryRuleResourceData.Serialization.cs | 418 ++++++++++++++++++ ...ledQueryRuleResourcePatch.Serialization.cs | 120 +++++ .../Models/ScheduledQueryRuleResourcePatch.cs | 75 ++++ .../src/Generated/Models/TimeAggregation.cs | 60 +++ .../Models/TriggerCondition.Serialization.cs | 61 --- .../src/Generated/Models/TriggerCondition.cs | 40 -- .../UnknownMonitorAction.Serialization.cs | 37 -- .../Generated/Models/UnknownMonitorAction.cs | 20 - .../ScheduledQueryRulesRestOperations.cs | 340 +++++++++----- ...ource.cs => ScheduledQueryRuleResource.cs} | 164 +++---- ...> ScheduledQueryRuleResourceCollection.cs} | 158 ++++--- .../ScheduledQueryRuleResourceData.cs | 131 ++++++ .../src/autorest.md | 2 +- 60 files changed, 2126 insertions(+), 2285 deletions(-) delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleData.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.Serialization.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.Serialization.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.Serialization.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionalOperator.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/DimensionOperator.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleData.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleResourceCollection.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MetricTriggerType.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorCriteria.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorEnabled.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorKind.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorProvisioningState.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSourceQueryType.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.cs rename sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/{MonitorCriteria.Serialization.cs => ScheduledQueryRuleCriteria.Serialization.cs} (52%) create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleCriteria.cs rename sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/{LogSearchRuleResourceCollection.Serialization.cs => ScheduledQueryRuleResourceCollection.Serialization.cs} (52%) create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceCollection.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceData.Serialization.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.Serialization.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.cs create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TimeAggregation.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.Serialization.cs delete mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.cs rename sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/{LogSearchRuleResource.cs => ScheduledQueryRuleResource.cs} (61%) rename sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/{LogSearchRuleCollection.cs => ScheduledQueryRuleResourceCollection.cs} (52%) create mode 100644 sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResourceData.cs diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs b/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs index 7dfb635e024f..654ade3fc334 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs @@ -456,57 +456,6 @@ protected LogProfileResource() { } public virtual Azure.Response Update(Azure.ResourceManager.Monitor.Models.LogProfilePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Monitor.Models.LogProfilePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class LogSearchRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable - { - protected LogSearchRuleCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string ruleName, Azure.ResourceManager.Monitor.LogSearchRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string ruleName, Azure.ResourceManager.Monitor.LogSearchRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAll(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } - System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } - } - public partial class LogSearchRuleData : Azure.ResourceManager.Models.TrackedResourceData - { - public LogSearchRuleData(Azure.Core.AzureLocation location, Azure.ResourceManager.Monitor.Models.MonitorSource source, Azure.ResourceManager.Monitor.Models.MonitorAction action) : base (default(Azure.Core.AzureLocation)) { } - public Azure.ResourceManager.Monitor.Models.MonitorAction Action { get { throw null; } set { } } - public string CreatedWithApiVersion { get { throw null; } } - public string Description { get { throw null; } set { } } - public string DisplayName { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.MonitorEnabled? Enabled { get { throw null; } set { } } - public Azure.ETag? ETag { get { throw null; } } - public bool? IsAutoMitigateEnabled { get { throw null; } set { } } - public bool? IsLegacyLogAnalyticsRule { get { throw null; } } - public System.DateTimeOffset? LastUpdatedOn { get { throw null; } } - public Azure.ResourceManager.Monitor.Models.MonitorProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Monitor.Models.MonitorSchedule Schedule { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.MonitorSource Source { get { throw null; } set { } } - } - public partial class LogSearchRuleResource : Azure.ResourceManager.ArmResource - { - public static readonly Azure.Core.ResourceType ResourceType; - protected LogSearchRuleResource() { } - public virtual Azure.ResourceManager.Monitor.LogSearchRuleData Data { get { throw null; } } - public virtual bool HasData { get { throw null; } } - public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ruleName) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Update(Azure.ResourceManager.Monitor.Models.LogSearchRulePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Monitor.Models.LogSearchRulePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - } public partial class MetricAlertCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected MetricAlertCollection() { } @@ -625,12 +574,6 @@ public static partial class MonitorExtensions public static System.Threading.Tasks.Task> GetLogProfileAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string logProfileName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Monitor.LogProfileResource GetLogProfileResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Monitor.LogProfileCollection GetLogProfiles(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } - public static Azure.Response GetLogSearchRule(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task> GetLogSearchRuleAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.ResourceManager.Monitor.LogSearchRuleResource GetLogSearchRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } - public static Azure.ResourceManager.Monitor.LogSearchRuleCollection GetLogSearchRules(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } - public static Azure.Pageable GetLogSearchRules(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetLogSearchRulesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetMetricAlert(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetMetricAlertAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Monitor.MetricAlertResource GetMetricAlertResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -652,6 +595,12 @@ public static partial class MonitorExtensions public static System.Threading.Tasks.Task> GetNotificationStatusAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string notificationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetPrivateLinkScopeOperationStatus(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string asyncOperationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetPrivateLinkScopeOperationStatusAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string asyncOperationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Monitor.ScheduledQueryRuleResource GetScheduledQueryRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetScheduledQueryRuleResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetScheduledQueryRuleResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Monitor.ScheduledQueryRuleResourceCollection GetScheduledQueryRuleResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetScheduledQueryRuleResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetScheduledQueryRuleResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetTenantActivityLogs(this Azure.ResourceManager.Resources.TenantResource tenantResource, string filter = null, string select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetTenantActivityLogsAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string filter = null, string select = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Monitor.VmInsightsOnboardingStatusResource GetVmInsightsOnboardingStatus(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } @@ -809,6 +758,65 @@ protected MonitorPrivateLinkScopeResource() { } public virtual Azure.Response Update(Azure.ResourceManager.Monitor.Models.MonitorPrivateLinkScopePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Monitor.Models.MonitorPrivateLinkScopePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class ScheduledQueryRuleResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ScheduledQueryRuleResource() { } + public virtual Azure.ResourceManager.Monitor.ScheduledQueryRuleResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ruleName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.Monitor.Models.ScheduledQueryRuleResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Monitor.Models.ScheduledQueryRuleResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ScheduledQueryRuleResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ScheduledQueryRuleResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string ruleName, Azure.ResourceManager.Monitor.ScheduledQueryRuleResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string ruleName, Azure.ResourceManager.Monitor.ScheduledQueryRuleResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class ScheduledQueryRuleResourceData : Azure.ResourceManager.Models.TrackedResourceData + { + public ScheduledQueryRuleResourceData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.Monitor.Models.Actions Actions { get { throw null; } set { } } + public bool? AutoMitigate { get { throw null; } set { } } + public bool? CheckWorkspaceAlertsStorageConfigured { get { throw null; } set { } } + public string CreatedWithApiVersion { get { throw null; } } + public System.Collections.Generic.IList CriteriaAllOf { get { throw null; } } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public bool? Enabled { get { throw null; } set { } } + public Azure.ETag? ETag { get { throw null; } } + public System.TimeSpan? EvaluationFrequency { get { throw null; } set { } } + public bool? IsLegacyLogAnalyticsRule { get { throw null; } } + public bool? IsWorkspaceAlertsStorageConfigured { get { throw null; } } + public Azure.ResourceManager.Monitor.Models.MonitorKind? Kind { get { throw null; } set { } } + public System.TimeSpan? MuteActionsDuration { get { throw null; } set { } } + public System.TimeSpan? OverrideQueryTimeRange { get { throw null; } set { } } + public System.Collections.Generic.IList Scopes { get { throw null; } } + public Azure.ResourceManager.Monitor.Models.AlertSeverity? Severity { get { throw null; } set { } } + public bool? SkipQueryValidation { get { throw null; } set { } } + public System.Collections.Generic.IList TargetResourceTypes { get { throw null; } } + public System.TimeSpan? WindowSize { get { throw null; } set { } } + } public partial class VmInsightsOnboardingStatusData : Azure.ResourceManager.Models.ResourceData { internal VmInsightsOnboardingStatusData() { } @@ -841,6 +849,12 @@ public ActionGroupPatch() { } public bool? IsEnabled { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } + public partial class Actions + { + public Actions() { } + public System.Collections.Generic.IList ActionGroups { get { throw null; } } + public System.Collections.Generic.IDictionary CustomProperties { get { throw null; } } + } public partial class ActivityLogAlertActionGroup { public ActivityLogAlertActionGroup(Azure.Core.ResourceIdentifier actionGroupId) { } @@ -858,14 +872,6 @@ public ActivityLogAlertPatch() { } public bool? IsEnabled { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } - public partial class AlertingAction : Azure.ResourceManager.Monitor.Models.MonitorAction - { - public AlertingAction(Azure.ResourceManager.Monitor.Models.AlertSeverity severity, Azure.ResourceManager.Monitor.Models.TriggerCondition trigger) { } - public Azure.ResourceManager.Monitor.Models.NotificationDetails NotificationDetails { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.AlertSeverity Severity { get { throw null; } set { } } - public int? ThrottlingInMin { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.TriggerCondition Trigger { get { throw null; } set { } } - } public abstract partial class AlertRuleAction { protected AlertRuleAction() { } @@ -898,9 +904,8 @@ public AlertRulePatch() { } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AlertSeverity : System.IEquatable { - private readonly object _dummy; private readonly int _dummyPrimitive; - public AlertSeverity(string value) { throw null; } + public AlertSeverity(long value) { throw null; } public static Azure.ResourceManager.Monitor.Models.AlertSeverity Four { get { throw null; } } public static Azure.ResourceManager.Monitor.Models.AlertSeverity One { get { throw null; } } public static Azure.ResourceManager.Monitor.Models.AlertSeverity Three { get { throw null; } } @@ -912,7 +917,7 @@ public AlertRulePatch() { } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override int GetHashCode() { throw null; } public static bool operator ==(Azure.ResourceManager.Monitor.Models.AlertSeverity left, Azure.ResourceManager.Monitor.Models.AlertSeverity right) { throw null; } - public static implicit operator Azure.ResourceManager.Monitor.Models.AlertSeverity (string value) { throw null; } + public static implicit operator Azure.ResourceManager.Monitor.Models.AlertSeverity (long value) { throw null; } public static bool operator !=(Azure.ResourceManager.Monitor.Models.AlertSeverity left, Azure.ResourceManager.Monitor.Models.AlertSeverity right) { throw null; } public override string ToString() { throw null; } } @@ -975,26 +980,24 @@ public enum ComparisonOperationType LessThan = 4, LessThanOrEqual = 5, } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ConditionalOperator : System.IEquatable + public partial class Condition { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public ConditionalOperator(string value) { throw null; } - public static Azure.ResourceManager.Monitor.Models.ConditionalOperator Equal { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.ConditionalOperator GreaterThan { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.ConditionalOperator GreaterThanOrEqual { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.ConditionalOperator LessThan { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.ConditionalOperator LessThanOrEqual { get { throw null; } } - public bool Equals(Azure.ResourceManager.Monitor.Models.ConditionalOperator other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Monitor.Models.ConditionalOperator left, Azure.ResourceManager.Monitor.Models.ConditionalOperator right) { throw null; } - public static implicit operator Azure.ResourceManager.Monitor.Models.ConditionalOperator (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Monitor.Models.ConditionalOperator left, Azure.ResourceManager.Monitor.Models.ConditionalOperator right) { throw null; } - public override string ToString() { throw null; } + public Condition() { } + public System.Collections.Generic.IList Dimensions { get { throw null; } } + public Azure.ResourceManager.Monitor.Models.ConditionFailingPeriods FailingPeriods { get { throw null; } set { } } + public string MetricMeasureColumn { get { throw null; } set { } } + public string MetricName { get { throw null; } set { } } + public Azure.ResourceManager.Monitor.Models.MonitorConditionOperator? Operator { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public string ResourceIdColumn { get { throw null; } set { } } + public double? Threshold { get { throw null; } set { } } + public Azure.ResourceManager.Monitor.Models.TimeAggregation? TimeAggregation { get { throw null; } set { } } + } + public partial class ConditionFailingPeriods + { + public ConditionFailingPeriods() { } + public long? MinFailingPeriodsToAlert { get { throw null; } set { } } + public long? NumberOfEvaluationPeriods { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DataCollectionEndpointProvisioningState : System.IEquatable @@ -1212,6 +1215,24 @@ public DestinationsSpec() { } public string AzureMonitorMetricsName { get { throw null; } set { } } public System.Collections.Generic.IList LogAnalytics { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DimensionOperator : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DimensionOperator(string value) { throw null; } + public static Azure.ResourceManager.Monitor.Models.DimensionOperator Exclude { get { throw null; } } + public static Azure.ResourceManager.Monitor.Models.DimensionOperator Include { get { throw null; } } + public bool Equals(Azure.ResourceManager.Monitor.Models.DimensionOperator other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Monitor.Models.DimensionOperator left, Azure.ResourceManager.Monitor.Models.DimensionOperator right) { throw null; } + public static implicit operator Azure.ResourceManager.Monitor.Models.DimensionOperator (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Monitor.Models.DimensionOperator left, Azure.ResourceManager.Monitor.Models.DimensionOperator right) { throw null; } + public override string ToString() { throw null; } + } public partial class DynamicMetricCriteria : Azure.ResourceManager.Monitor.Models.MultiMetricCriteria { public DynamicMetricCriteria(string name, string metricName, Azure.ResourceManager.Monitor.Models.MonitorAggregationType timeAggregation, Azure.ResourceManager.Monitor.Models.DynamicThresholdOperator @operator, Azure.ResourceManager.Monitor.Models.DynamicThresholdSensitivity alertSensitivity, Azure.ResourceManager.Monitor.Models.DynamicThresholdFailingPeriods failingPeriods) : base (default(string), default(string), default(Azure.ResourceManager.Monitor.Models.MonitorAggregationType)) { } @@ -1408,14 +1429,6 @@ public LogFilesDataSource(System.Collections.Generic.IEnumerable streams public static bool operator !=(Azure.ResourceManager.Monitor.Models.LogFileTextSettingsRecordStartTimestampFormat left, Azure.ResourceManager.Monitor.Models.LogFileTextSettingsRecordStartTimestampFormat right) { throw null; } public override string ToString() { throw null; } } - public partial class LogMetricTrigger - { - public LogMetricTrigger() { } - public string MetricColumn { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.MetricTriggerType? MetricTriggerType { get { throw null; } set { } } - public double? Threshold { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.ConditionalOperator? ThresholdOperator { get { throw null; } set { } } - } public partial class LogProfilePatch { public LogProfilePatch() { } @@ -1426,12 +1439,6 @@ public LogProfilePatch() { } public Azure.Core.ResourceIdentifier StorageAccountId { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } - public partial class LogSearchRulePatch - { - public LogSearchRulePatch() { } - public Azure.ResourceManager.Monitor.Models.MonitorEnabled? Enabled { get { throw null; } set { } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - } public partial class LogSettings { public LogSettings(bool isEnabled) { } @@ -1440,11 +1447,6 @@ public LogSettings(bool isEnabled) { } public bool IsEnabled { get { throw null; } set { } } public Azure.ResourceManager.Monitor.Models.RetentionPolicy RetentionPolicy { get { throw null; } set { } } } - public partial class LogToMetricAction : Azure.ResourceManager.Monitor.Models.MonitorAction - { - public LogToMetricAction(System.Collections.Generic.IEnumerable criteria) { } - public System.Collections.Generic.IList Criteria { get { throw null; } } - } public partial class ManagementEventAggregationCondition { public ManagementEventAggregationCondition() { } @@ -1554,28 +1556,6 @@ public MetricTrigger(string metricName, Azure.Core.ResourceIdentifier metricReso public System.TimeSpan TimeWindow { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct MetricTriggerType : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public MetricTriggerType(string value) { throw null; } - public static Azure.ResourceManager.Monitor.Models.MetricTriggerType Consecutive { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.MetricTriggerType Total { get { throw null; } } - public bool Equals(Azure.ResourceManager.Monitor.Models.MetricTriggerType other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Monitor.Models.MetricTriggerType left, Azure.ResourceManager.Monitor.Models.MetricTriggerType right) { throw null; } - public static implicit operator Azure.ResourceManager.Monitor.Models.MetricTriggerType (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Monitor.Models.MetricTriggerType left, Azure.ResourceManager.Monitor.Models.MetricTriggerType right) { throw null; } - public override string ToString() { throw null; } - } - public abstract partial class MonitorAction - { - protected MonitorAction() { } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MonitorAggregationType : System.IEquatable { private readonly object _dummy; @@ -1653,18 +1633,13 @@ public enum MonitorConditionOperator GreaterThanOrEqual = 1, LessThan = 2, LessThanOrEqual = 3, - } - public partial class MonitorCriteria - { - public MonitorCriteria(string metricName) { } - public System.Collections.Generic.IList Dimensions { get { throw null; } } - public string MetricName { get { throw null; } set { } } + EqualsValue = 4, } public partial class MonitorDimension { - public MonitorDimension(string name, Azure.ResourceManager.Monitor.Models.MonitorOperator @operator, System.Collections.Generic.IEnumerable values) { } + public MonitorDimension(string name, Azure.ResourceManager.Monitor.Models.DimensionOperator @operator, System.Collections.Generic.IEnumerable values) { } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.MonitorOperator Operator { get { throw null; } set { } } + public Azure.ResourceManager.Monitor.Models.DimensionOperator Operator { get { throw null; } set { } } public System.Collections.Generic.IList Values { get { throw null; } } } public partial class MonitorEmailReceiver @@ -1675,24 +1650,6 @@ public MonitorEmailReceiver(string name, string emailAddress) { } public Azure.ResourceManager.Monitor.Models.MonitorReceiverStatus? Status { get { throw null; } } public bool? UseCommonAlertSchema { get { throw null; } set { } } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct MonitorEnabled : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public MonitorEnabled(string value) { throw null; } - public static Azure.ResourceManager.Monitor.Models.MonitorEnabled False { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.MonitorEnabled True { get { throw null; } } - public bool Equals(Azure.ResourceManager.Monitor.Models.MonitorEnabled other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Monitor.Models.MonitorEnabled left, Azure.ResourceManager.Monitor.Models.MonitorEnabled right) { throw null; } - public static implicit operator Azure.ResourceManager.Monitor.Models.MonitorEnabled (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Monitor.Models.MonitorEnabled left, Azure.ResourceManager.Monitor.Models.MonitorEnabled right) { throw null; } - public override string ToString() { throw null; } - } public partial class MonitorEventHubReceiver { public MonitorEventHubReceiver(string name, string eventHubNameSpace, string eventHubName, string subscriptionId) { } @@ -1729,6 +1686,24 @@ public MonitorItsmReceiver(string name, string workspaceId, string connectionId, public string TicketConfiguration { get { throw null; } set { } } public string WorkspaceId { get { throw null; } set { } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MonitorKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MonitorKind(string value) { throw null; } + public static Azure.ResourceManager.Monitor.Models.MonitorKind LogAlert { get { throw null; } } + public static Azure.ResourceManager.Monitor.Models.MonitorKind LogToMetric { get { throw null; } } + public bool Equals(Azure.ResourceManager.Monitor.Models.MonitorKind other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Monitor.Models.MonitorKind left, Azure.ResourceManager.Monitor.Models.MonitorKind right) { throw null; } + public static implicit operator Azure.ResourceManager.Monitor.Models.MonitorKind (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Monitor.Models.MonitorKind left, Azure.ResourceManager.Monitor.Models.MonitorKind right) { throw null; } + public override string ToString() { throw null; } + } public partial class MonitorLocalizableString { internal MonitorLocalizableString() { } @@ -1769,7 +1744,6 @@ public MonitorLogicAppReceiver(string name, Azure.Core.ResourceIdentifier resour public static Azure.ResourceManager.Monitor.Models.MonitorOperator EqualsValue { get { throw null; } } public static Azure.ResourceManager.Monitor.Models.MonitorOperator GreaterThan { get { throw null; } } public static Azure.ResourceManager.Monitor.Models.MonitorOperator GreaterThanOrEqual { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.MonitorOperator Include { get { throw null; } } public static Azure.ResourceManager.Monitor.Models.MonitorOperator LessThan { get { throw null; } } public static Azure.ResourceManager.Monitor.Models.MonitorOperator LessThanOrEqual { get { throw null; } } public bool Equals(Azure.ResourceManager.Monitor.Models.MonitorOperator other) { throw null; } @@ -1876,26 +1850,6 @@ public MonitorPrivateLinkServiceConnectionState() { } public Azure.ResourceManager.Monitor.Models.MonitorPrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct MonitorProvisioningState : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public MonitorProvisioningState(string value) { throw null; } - public static Azure.ResourceManager.Monitor.Models.MonitorProvisioningState Canceled { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.MonitorProvisioningState Deploying { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.MonitorProvisioningState Failed { get { throw null; } } - public static Azure.ResourceManager.Monitor.Models.MonitorProvisioningState Succeeded { get { throw null; } } - public bool Equals(Azure.ResourceManager.Monitor.Models.MonitorProvisioningState other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Monitor.Models.MonitorProvisioningState left, Azure.ResourceManager.Monitor.Models.MonitorProvisioningState right) { throw null; } - public static implicit operator Azure.ResourceManager.Monitor.Models.MonitorProvisioningState (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Monitor.Models.MonitorProvisioningState left, Azure.ResourceManager.Monitor.Models.MonitorProvisioningState right) { throw null; } - public override string ToString() { throw null; } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MonitorPublicNetworkAccess : System.IEquatable { private readonly object _dummy; @@ -1953,12 +1907,6 @@ public enum MonitorScaleType ExactCount = 2, ServiceAllowedNextValue = 3, } - public partial class MonitorSchedule - { - public MonitorSchedule(int frequencyInMinutes, int timeWindowInMinutes) { } - public int FrequencyInMinutes { get { throw null; } set { } } - public int TimeWindowInMinutes { get { throw null; } set { } } - } public partial class MonitorSmsReceiver { public MonitorSmsReceiver(string name, string countryCode, string phoneNumber) { } @@ -1967,31 +1915,6 @@ public MonitorSmsReceiver(string name, string countryCode, string phoneNumber) { public string PhoneNumber { get { throw null; } set { } } public Azure.ResourceManager.Monitor.Models.MonitorReceiverStatus? Status { get { throw null; } } } - public partial class MonitorSource - { - public MonitorSource(Azure.Core.ResourceIdentifier dataSourceId) { } - public System.Collections.Generic.IList AuthorizedResources { get { throw null; } } - public Azure.Core.ResourceIdentifier DataSourceId { get { throw null; } set { } } - public string Query { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType? QueryType { get { throw null; } set { } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct MonitorSourceQueryType : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public MonitorSourceQueryType(string value) { throw null; } - public static Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType ResultCount { get { throw null; } } - public bool Equals(Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType left, Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType right) { throw null; } - public static implicit operator Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType left, Azure.ResourceManager.Monitor.Models.MonitorSourceQueryType right) { throw null; } - public override string ToString() { throw null; } - } public enum MonitorTimeAggregationOperator { Average = 0, @@ -2077,13 +2000,6 @@ internal NotificationContext() { } public string ContextType { get { throw null; } } public string NotificationSource { get { throw null; } } } - public partial class NotificationDetails - { - public NotificationDetails() { } - public System.Collections.Generic.IList ActionGroup { get { throw null; } } - public string CustomWebhookPayload { get { throw null; } set { } } - public string EmailSubject { get { throw null; } set { } } - } public partial class NotificationStatus { internal NotificationStatus() { } @@ -2242,6 +2158,29 @@ public RuleWebhookAction() { } public static bool operator !=(Azure.ResourceManager.Monitor.Models.ScaleRuleMetricDimensionOperationType left, Azure.ResourceManager.Monitor.Models.ScaleRuleMetricDimensionOperationType right) { throw null; } public override string ToString() { throw null; } } + public partial class ScheduledQueryRuleResourcePatch + { + public ScheduledQueryRuleResourcePatch() { } + public Azure.ResourceManager.Monitor.Models.Actions Actions { get { throw null; } set { } } + public bool? AutoMitigate { get { throw null; } set { } } + public bool? CheckWorkspaceAlertsStorageConfigured { get { throw null; } set { } } + public string CreatedWithApiVersion { get { throw null; } } + public System.Collections.Generic.IList CriteriaAllOf { get { throw null; } } + public string Description { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public bool? Enabled { get { throw null; } set { } } + public System.TimeSpan? EvaluationFrequency { get { throw null; } set { } } + public bool? IsLegacyLogAnalyticsRule { get { throw null; } } + public bool? IsWorkspaceAlertsStorageConfigured { get { throw null; } } + public System.TimeSpan? MuteActionsDuration { get { throw null; } set { } } + public System.TimeSpan? OverrideQueryTimeRange { get { throw null; } set { } } + public System.Collections.Generic.IList Scopes { get { throw null; } } + public Azure.ResourceManager.Monitor.Models.AlertSeverity? Severity { get { throw null; } set { } } + public bool? SkipQueryValidation { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public System.Collections.Generic.IList TargetResourceTypes { get { throw null; } } + public System.TimeSpan? WindowSize { get { throw null; } set { } } + } public partial class SenderAuthorization { internal SenderAuthorization() { } @@ -2344,12 +2283,26 @@ public ThresholdRuleCondition(Azure.ResourceManager.Monitor.Models.MonitorCondit public Azure.ResourceManager.Monitor.Models.MonitorTimeAggregationOperator? TimeAggregation { get { throw null; } set { } } public System.TimeSpan? WindowSize { get { throw null; } set { } } } - public partial class TriggerCondition + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TimeAggregation : System.IEquatable { - public TriggerCondition(Azure.ResourceManager.Monitor.Models.ConditionalOperator thresholdOperator, double threshold) { } - public Azure.ResourceManager.Monitor.Models.LogMetricTrigger MetricTrigger { get { throw null; } set { } } - public double Threshold { get { throw null; } set { } } - public Azure.ResourceManager.Monitor.Models.ConditionalOperator ThresholdOperator { get { throw null; } set { } } + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TimeAggregation(string value) { throw null; } + public static Azure.ResourceManager.Monitor.Models.TimeAggregation Average { get { throw null; } } + public static Azure.ResourceManager.Monitor.Models.TimeAggregation Count { get { throw null; } } + public static Azure.ResourceManager.Monitor.Models.TimeAggregation Maximum { get { throw null; } } + public static Azure.ResourceManager.Monitor.Models.TimeAggregation Minimum { get { throw null; } } + public static Azure.ResourceManager.Monitor.Models.TimeAggregation Total { get { throw null; } } + public bool Equals(Azure.ResourceManager.Monitor.Models.TimeAggregation other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Monitor.Models.TimeAggregation left, Azure.ResourceManager.Monitor.Models.TimeAggregation right) { throw null; } + public static implicit operator Azure.ResourceManager.Monitor.Models.TimeAggregation (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Monitor.Models.TimeAggregation left, Azure.ResourceManager.Monitor.Models.TimeAggregation right) { throw null; } + public override string ToString() { throw null; } } public partial class WebhookNotification { diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs index 3477113df3d9..8c16c7441d99 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/MonitorExtensions.cs @@ -342,31 +342,29 @@ public static Pageable GetMetricAlerts(this SubscriptionRes } /// - /// List the Log Search rules within a subscription group. + /// Retrieve a scheduled query rule definitions in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules /// Operation Id: ScheduledQueryRules_ListBySubscription /// /// The instance the method will execute against. - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetLogSearchRulesAsync(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetScheduledQueryRuleResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionResource).GetLogSearchRulesAsync(filter, cancellationToken); + return GetExtensionClient(subscriptionResource).GetScheduledQueryRuleResourcesAsync(cancellationToken); } /// - /// List the Log Search rules within a subscription group. + /// Retrieve a scheduled query rule definitions in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules /// Operation Id: ScheduledQueryRules_ListBySubscription /// /// The instance the method will execute against. - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetLogSearchRules(this SubscriptionResource subscriptionResource, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetScheduledQueryRuleResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { - return GetExtensionClient(subscriptionResource).GetLogSearchRules(filter, cancellationToken); + return GetExtensionClient(subscriptionResource).GetScheduledQueryRuleResources(cancellationToken); } /// @@ -642,17 +640,17 @@ public static Response GetMetricAlert(this ResourceGroupRes return resourceGroupResource.GetMetricAlerts().Get(ruleName, cancellationToken); } - /// Gets a collection of LogSearchRuleResources in the ResourceGroupResource. + /// Gets a collection of ScheduledQueryRuleResources in the ResourceGroupResource. /// The instance the method will execute against. - /// An object representing collection of LogSearchRuleResources and their operations over a LogSearchRuleResource. - public static LogSearchRuleCollection GetLogSearchRules(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of ScheduledQueryRuleResources and their operations over a ScheduledQueryRuleResource. + public static ScheduledQueryRuleResourceCollection GetScheduledQueryRuleResources(this ResourceGroupResource resourceGroupResource) { - return GetExtensionClient(resourceGroupResource).GetLogSearchRules(); + return GetExtensionClient(resourceGroupResource).GetScheduledQueryRuleResources(); } /// - /// Gets an Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Retrieve an scheduled query rule definition. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The instance the method will execute against. @@ -661,14 +659,14 @@ public static LogSearchRuleCollection GetLogSearchRules(this ResourceGroupResour /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public static async Task> GetLogSearchRuleAsync(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) + public static async Task> GetScheduledQueryRuleResourceAsync(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return await resourceGroupResource.GetLogSearchRules().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetScheduledQueryRuleResources().GetAsync(ruleName, cancellationToken).ConfigureAwait(false); } /// - /// Gets an Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Retrieve an scheduled query rule definition. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The instance the method will execute against. @@ -677,9 +675,9 @@ public static async Task> GetLogSearchRuleAsync( /// is an empty string, and was expected to be non-empty. /// is null. [ForwardsClientCalls] - public static Response GetLogSearchRule(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) + public static Response GetScheduledQueryRuleResource(this ResourceGroupResource resourceGroupResource, string ruleName, CancellationToken cancellationToken = default) { - return resourceGroupResource.GetLogSearchRules().Get(ruleName, cancellationToken); + return resourceGroupResource.GetScheduledQueryRuleResources().Get(ruleName, cancellationToken); } /// Gets a collection of MonitorPrivateLinkScopeResources in the ResourceGroupResource. @@ -1233,20 +1231,20 @@ public static MetricAlertResource GetMetricAlertResource(this ArmClient client, } #endregion - #region LogSearchRuleResource + #region ScheduledQueryRuleResource /// - /// Gets an object representing a along with the instance operations that can be performed on it but with no data. - /// You can use to create a from its components. + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. /// /// The instance the method will execute against. /// The resource ID of the resource to get. - /// Returns a object. - public static LogSearchRuleResource GetLogSearchRuleResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static ScheduledQueryRuleResource GetScheduledQueryRuleResource(this ArmClient client, ResourceIdentifier id) { return client.GetResourceClient(() => { - LogSearchRuleResource.ValidateResourceId(id); - return new LogSearchRuleResource(client, id); + ScheduledQueryRuleResource.ValidateResourceId(id); + return new ScheduledQueryRuleResource(client, id); } ); } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index 46c3fd09c399..429e34672a5c 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -75,11 +75,11 @@ public virtual MetricAlertCollection GetMetricAlerts() return GetCachedClient(Client => new MetricAlertCollection(Client, Id)); } - /// Gets a collection of LogSearchRuleResources in the ResourceGroupResource. - /// An object representing collection of LogSearchRuleResources and their operations over a LogSearchRuleResource. - public virtual LogSearchRuleCollection GetLogSearchRules() + /// Gets a collection of ScheduledQueryRuleResources in the ResourceGroupResource. + /// An object representing collection of ScheduledQueryRuleResources and their operations over a ScheduledQueryRuleResource. + public virtual ScheduledQueryRuleResourceCollection GetScheduledQueryRuleResources() { - return GetCachedClient(Client => new LogSearchRuleCollection(Client, Id)); + return GetCachedClient(Client => new ScheduledQueryRuleResourceCollection(Client, Id)); } /// Gets a collection of MonitorPrivateLinkScopeResources in the ResourceGroupResource. diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 2568646e0f18..5a13611edd8b 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -30,8 +30,8 @@ internal partial class SubscriptionResourceExtensionClient : ArmResource private ActivityLogsRestOperations _activityLogsRestClient; private ClientDiagnostics _metricAlertClientDiagnostics; private MetricAlertsRestOperations _metricAlertRestClient; - private ClientDiagnostics _logSearchRuleScheduledQueryRulesClientDiagnostics; - private ScheduledQueryRulesRestOperations _logSearchRuleScheduledQueryRulesRestClient; + private ClientDiagnostics _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics; + private ScheduledQueryRulesRestOperations _scheduledQueryRuleResourceScheduledQueryRulesRestClient; private ClientDiagnostics _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics; private PrivateLinkScopesRestOperations _monitorPrivateLinkScopePrivateLinkScopesRestClient; private ClientDiagnostics _activityLogAlertClientDiagnostics; @@ -63,8 +63,8 @@ internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifie private ActivityLogsRestOperations ActivityLogsRestClient => _activityLogsRestClient ??= new ActivityLogsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics MetricAlertClientDiagnostics => _metricAlertClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MetricAlertResource.ResourceType.Namespace, Diagnostics); private MetricAlertsRestOperations MetricAlertRestClient => _metricAlertRestClient ??= new MetricAlertsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MetricAlertResource.ResourceType)); - private ClientDiagnostics LogSearchRuleScheduledQueryRulesClientDiagnostics => _logSearchRuleScheduledQueryRulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", LogSearchRuleResource.ResourceType.Namespace, Diagnostics); - private ScheduledQueryRulesRestOperations LogSearchRuleScheduledQueryRulesRestClient => _logSearchRuleScheduledQueryRulesRestClient ??= new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(LogSearchRuleResource.ResourceType)); + private ClientDiagnostics ScheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics => _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ScheduledQueryRuleResource.ResourceType.Namespace, Diagnostics); + private ScheduledQueryRulesRestOperations ScheduledQueryRuleResourceScheduledQueryRulesRestClient => _scheduledQueryRuleResourceScheduledQueryRulesRestClient ??= new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ScheduledQueryRuleResource.ResourceType)); private ClientDiagnostics MonitorPrivateLinkScopePrivateLinkScopesClientDiagnostics => _monitorPrivateLinkScopePrivateLinkScopesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", MonitorPrivateLinkScopeResource.ResourceType.Namespace, Diagnostics); private PrivateLinkScopesRestOperations MonitorPrivateLinkScopePrivateLinkScopesRestClient => _monitorPrivateLinkScopePrivateLinkScopesRestClient ??= new PrivateLinkScopesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MonitorPrivateLinkScopeResource.ResourceType)); private ClientDiagnostics ActivityLogAlertClientDiagnostics => _activityLogAlertClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Monitor", ActivityLogAlertResource.ResourceType.Namespace, Diagnostics); @@ -522,23 +522,22 @@ Page FirstPageFunc(int? pageSizeHint) } /// - /// List the Log Search rules within a subscription group. + /// Retrieve a scheduled query rule definitions in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules /// Operation Id: ScheduledQueryRules_ListBySubscription /// - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetLogSearchRulesAsync(string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetScheduledQueryRuleResourcesAsync(CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = LogSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLogSearchRules"); + using var scope = ScheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetScheduledQueryRuleResources"); scope.Start(); try { - var response = await LogSearchRuleScheduledQueryRulesRestClient.ListBySubscriptionAsync(Id.SubscriptionId, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new LogSearchRuleResource(Client, value)), null, response.GetRawResponse()); + var response = await ScheduledQueryRuleResourceScheduledQueryRulesRestClient.ListBySubscriptionAsync(Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -546,27 +545,41 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = ScheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetScheduledQueryRuleResources"); + scope.Start(); + try + { + var response = await ScheduledQueryRuleResourceScheduledQueryRulesRestClient.ListBySubscriptionNextPageAsync(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// - /// List the Log Search rules within a subscription group. + /// Retrieve a scheduled query rule definitions in a subscription. /// Request Path: /subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules /// Operation Id: ScheduledQueryRules_ListBySubscription /// - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetLogSearchRules(string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetScheduledQueryRuleResources(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) { - using var scope = LogSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetLogSearchRules"); + using var scope = ScheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetScheduledQueryRuleResources"); scope.Start(); try { - var response = LogSearchRuleScheduledQueryRulesRestClient.ListBySubscription(Id.SubscriptionId, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new LogSearchRuleResource(Client, value)), null, response.GetRawResponse()); + var response = ScheduledQueryRuleResourceScheduledQueryRulesRestClient.ListBySubscription(Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -574,7 +587,22 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + Page NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = ScheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.GetScheduledQueryRuleResources"); + scope.Start(); + try + { + var response = ScheduledQueryRuleResourceScheduledQueryRulesRestClient.ListBySubscriptionNextPage(nextLink, Id.SubscriptionId, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleData.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleData.cs deleted file mode 100644 index a369043862a3..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleData.cs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - /// A class representing the LogSearchRule data model. - public partial class LogSearchRuleData : TrackedResourceData - { - /// Initializes a new instance of LogSearchRuleData. - /// The location. - /// Data Source against which rule will Query Data. - /// - /// Action needs to be taken on rule execution. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// or is null. - public LogSearchRuleData(AzureLocation location, MonitorSource source, MonitorAction action) : base(location) - { - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } - if (action == null) - { - throw new ArgumentNullException(nameof(action)); - } - - Source = source; - Action = action; - } - - /// Initializes a new instance of LogSearchRuleData. - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The api-version used when creating this alert rule. - /// True if alert rule is legacy Log Analytic rule. - /// The description of the Log Search rule. - /// The display name of the alert rule. - /// The flag that indicates whether the alert should be automatically resolved or not. The default is false. - /// The flag which indicates whether the Log Search rule is enabled. Value should be true or false. - /// Last time the rule was updated in IS08601 format. - /// Provisioning state of the scheduled query rule. - /// Data Source against which rule will Query Data. - /// Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. - /// - /// Action needs to be taken on rule execution. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - /// 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. - internal LogSearchRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string createdWithApiVersion, bool? isLegacyLogAnalyticsRule, string description, string displayName, bool? isAutoMitigateEnabled, MonitorEnabled? enabled, DateTimeOffset? lastUpdatedOn, MonitorProvisioningState? provisioningState, MonitorSource source, MonitorSchedule schedule, MonitorAction action, ETag? etag) : base(id, name, resourceType, systemData, tags, location) - { - CreatedWithApiVersion = createdWithApiVersion; - IsLegacyLogAnalyticsRule = isLegacyLogAnalyticsRule; - Description = description; - DisplayName = displayName; - IsAutoMitigateEnabled = isAutoMitigateEnabled; - Enabled = enabled; - LastUpdatedOn = lastUpdatedOn; - ProvisioningState = provisioningState; - Source = source; - Schedule = schedule; - Action = action; - ETag = etag; - } - - /// The api-version used when creating this alert rule. - public string CreatedWithApiVersion { get; } - /// True if alert rule is legacy Log Analytic rule. - public bool? IsLegacyLogAnalyticsRule { get; } - /// The description of the Log Search rule. - public string Description { get; set; } - /// The display name of the alert rule. - public string DisplayName { get; set; } - /// The flag that indicates whether the alert should be automatically resolved or not. The default is false. - public bool? IsAutoMitigateEnabled { get; set; } - /// The flag which indicates whether the Log Search rule is enabled. Value should be true or false. - public MonitorEnabled? Enabled { get; set; } - /// Last time the rule was updated in IS08601 format. - public DateTimeOffset? LastUpdatedOn { get; } - /// Provisioning state of the scheduled query rule. - public MonitorProvisioningState? ProvisioningState { get; } - /// Data Source against which rule will Query Data. - public MonitorSource Source { get; set; } - /// Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. - public MonitorSchedule Schedule { get; set; } - /// - /// Action needs to be taken on rule execution. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public MonitorAction Action { get; set; } - /// 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. - public ETag? ETag { get; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.Serialization.cs new file mode 100644 index 000000000000..f96075cd7a2a --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.Serialization.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + public partial class Actions : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ActionGroups)) + { + writer.WritePropertyName("actionGroups"); + writer.WriteStartArray(); + foreach (var item in ActionGroups) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CustomProperties)) + { + writer.WritePropertyName("customProperties"); + writer.WriteStartObject(); + foreach (var item in CustomProperties) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + + internal static Actions DeserializeActions(JsonElement element) + { + Optional> actionGroups = default; + Optional> customProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("actionGroups")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + actionGroups = array; + continue; + } + if (property.NameEquals("customProperties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + customProperties = dictionary; + continue; + } + } + return new Actions(Optional.ToList(actionGroups), Optional.ToDictionary(customProperties)); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.cs new file mode 100644 index 000000000000..1c627ffe2287 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Actions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// Actions to invoke when the alert fires. + public partial class Actions + { + /// Initializes a new instance of Actions. + public Actions() + { + ActionGroups = new ChangeTrackingList(); + CustomProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of Actions. + /// Action Group resource Ids to invoke when the alert fires. + /// The properties of an alert payload. + internal Actions(IList actionGroups, IDictionary customProperties) + { + ActionGroups = actionGroups; + CustomProperties = customProperties; + } + + /// Action Group resource Ids to invoke when the alert fires. + public IList ActionGroups { get; } + /// The properties of an alert payload. + public IDictionary CustomProperties { get; } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertSeverity.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertSeverity.cs index a0286767b10f..91c11d0539dd 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertSeverity.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertSeverity.cs @@ -7,26 +7,26 @@ using System; using System.ComponentModel; +using System.Globalization; namespace Azure.ResourceManager.Monitor.Models { - /// Severity Level of Alert. + /// Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert. public readonly partial struct AlertSeverity : IEquatable { - private readonly string _value; + private readonly long _value; /// Initializes a new instance of . - /// is null. - public AlertSeverity(string value) + public AlertSeverity(long value) { - _value = value ?? throw new ArgumentNullException(nameof(value)); + _value = value; } - private const string ZeroValue = "0"; - private const string OneValue = "1"; - private const string TwoValue = "2"; - private const string ThreeValue = "3"; - private const string FourValue = "4"; + private const long ZeroValue = 0L; + private const long OneValue = 1L; + private const long TwoValue = 2L; + private const long ThreeValue = 3L; + private const long FourValue = 4L; /// 0. public static AlertSeverity Zero { get; } = new AlertSeverity(ZeroValue); @@ -43,18 +43,18 @@ public AlertSeverity(string value) /// Determines if two values are not the same. public static bool operator !=(AlertSeverity left, AlertSeverity right) => !left.Equals(right); /// Converts a string to a . - public static implicit operator AlertSeverity(string value) => new AlertSeverity(value); + public static implicit operator AlertSeverity(long value) => new AlertSeverity(value); /// [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(object obj) => obj is AlertSeverity other && Equals(other); /// - public bool Equals(AlertSeverity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(AlertSeverity other) => Equals(_value, other._value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; + public override int GetHashCode() => _value.GetHashCode(); /// - public override string ToString() => _value; + public override string ToString() => _value.ToString(CultureInfo.InvariantCulture); } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.Serialization.cs deleted file mode 100644 index f8b669bbedf0..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.Serialization.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class AlertingAction : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("severity"); - writer.WriteStringValue(Severity.ToString()); - if (Optional.IsDefined(NotificationDetails)) - { - writer.WritePropertyName("aznsAction"); - writer.WriteObjectValue(NotificationDetails); - } - if (Optional.IsDefined(ThrottlingInMin)) - { - writer.WritePropertyName("throttlingInMin"); - writer.WriteNumberValue(ThrottlingInMin.Value); - } - writer.WritePropertyName("trigger"); - writer.WriteObjectValue(Trigger); - writer.WritePropertyName("odata.type"); - writer.WriteStringValue(OdataType); - writer.WriteEndObject(); - } - - internal static AlertingAction DeserializeAlertingAction(JsonElement element) - { - AlertSeverity severity = default; - Optional aznsAction = default; - Optional throttlingInMin = default; - TriggerCondition trigger = default; - string odataType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("severity")) - { - severity = new AlertSeverity(property.Value.GetString()); - continue; - } - if (property.NameEquals("aznsAction")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - aznsAction = NotificationDetails.DeserializeNotificationDetails(property.Value); - continue; - } - if (property.NameEquals("throttlingInMin")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - throttlingInMin = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("trigger")) - { - trigger = TriggerCondition.DeserializeTriggerCondition(property.Value); - continue; - } - if (property.NameEquals("odata.type")) - { - odataType = property.Value.GetString(); - continue; - } - } - return new AlertingAction(odataType, severity, aznsAction.Value, Optional.ToNullable(throttlingInMin), trigger); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.cs deleted file mode 100644 index a6bc61b742de..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/AlertingAction.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Specify action need to be taken when rule type is Alert. - public partial class AlertingAction : MonitorAction - { - /// Initializes a new instance of AlertingAction. - /// Severity of the alert. - /// The trigger condition that results in the alert rule being. - /// is null. - public AlertingAction(AlertSeverity severity, TriggerCondition trigger) - { - if (trigger == null) - { - throw new ArgumentNullException(nameof(trigger)); - } - - Severity = severity; - Trigger = trigger; - OdataType = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction"; - } - - /// Initializes a new instance of AlertingAction. - /// Specifies the action. Supported values - AlertingAction, LogToMetricAction. - /// Severity of the alert. - /// Azure action group reference. - /// time (in minutes) for which Alerts should be throttled or suppressed. - /// The trigger condition that results in the alert rule being. - internal AlertingAction(string odataType, AlertSeverity severity, NotificationDetails notificationDetails, int? throttlingInMin, TriggerCondition trigger) : base(odataType) - { - Severity = severity; - NotificationDetails = notificationDetails; - ThrottlingInMin = throttlingInMin; - Trigger = trigger; - OdataType = odataType ?? "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction"; - } - - /// Severity of the alert. - public AlertSeverity Severity { get; set; } - /// Azure action group reference. - public NotificationDetails NotificationDetails { get; set; } - /// time (in minutes) for which Alerts should be throttled or suppressed. - public int? ThrottlingInMin { get; set; } - /// The trigger condition that results in the alert rule being. - public TriggerCondition Trigger { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.Serialization.cs new file mode 100644 index 000000000000..84ba8daa7e8c --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.Serialization.cs @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + public partial class Condition : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Query)) + { + writer.WritePropertyName("query"); + writer.WriteStringValue(Query); + } + if (Optional.IsDefined(TimeAggregation)) + { + writer.WritePropertyName("timeAggregation"); + writer.WriteStringValue(TimeAggregation.Value.ToString()); + } + if (Optional.IsDefined(MetricMeasureColumn)) + { + writer.WritePropertyName("metricMeasureColumn"); + writer.WriteStringValue(MetricMeasureColumn); + } + if (Optional.IsDefined(ResourceIdColumn)) + { + writer.WritePropertyName("resourceIdColumn"); + writer.WriteStringValue(ResourceIdColumn); + } + if (Optional.IsCollectionDefined(Dimensions)) + { + writer.WritePropertyName("dimensions"); + writer.WriteStartArray(); + foreach (var item in Dimensions) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Operator)) + { + writer.WritePropertyName("operator"); + writer.WriteStringValue(Operator.Value.ToSerialString()); + } + if (Optional.IsDefined(Threshold)) + { + writer.WritePropertyName("threshold"); + writer.WriteNumberValue(Threshold.Value); + } + if (Optional.IsDefined(FailingPeriods)) + { + writer.WritePropertyName("failingPeriods"); + writer.WriteObjectValue(FailingPeriods); + } + if (Optional.IsDefined(MetricName)) + { + writer.WritePropertyName("metricName"); + writer.WriteStringValue(MetricName); + } + writer.WriteEndObject(); + } + + internal static Condition DeserializeCondition(JsonElement element) + { + Optional query = default; + Optional timeAggregation = default; + Optional metricMeasureColumn = default; + Optional resourceIdColumn = default; + Optional> dimensions = default; + Optional @operator = default; + Optional threshold = default; + Optional failingPeriods = default; + Optional metricName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("query")) + { + query = property.Value.GetString(); + continue; + } + if (property.NameEquals("timeAggregation")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + timeAggregation = new TimeAggregation(property.Value.GetString()); + continue; + } + if (property.NameEquals("metricMeasureColumn")) + { + metricMeasureColumn = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceIdColumn")) + { + resourceIdColumn = property.Value.GetString(); + continue; + } + if (property.NameEquals("dimensions")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MonitorDimension.DeserializeMonitorDimension(item)); + } + dimensions = array; + continue; + } + if (property.NameEquals("operator")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + @operator = property.Value.GetString().ToMonitorConditionOperator(); + continue; + } + if (property.NameEquals("threshold")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + threshold = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("failingPeriods")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + failingPeriods = ConditionFailingPeriods.DeserializeConditionFailingPeriods(property.Value); + continue; + } + if (property.NameEquals("metricName")) + { + metricName = property.Value.GetString(); + continue; + } + } + return new Condition(query.Value, Optional.ToNullable(timeAggregation), metricMeasureColumn.Value, resourceIdColumn.Value, Optional.ToList(dimensions), Optional.ToNullable(@operator), Optional.ToNullable(threshold), failingPeriods.Value, metricName.Value); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.cs new file mode 100644 index 000000000000..8e182793a124 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/Condition.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// A condition of the scheduled query rule. + public partial class Condition + { + /// Initializes a new instance of Condition. + public Condition() + { + Dimensions = new ChangeTrackingList(); + } + + /// Initializes a new instance of Condition. + /// Log query alert. + /// Aggregation type. Relevant and required only for rules of the kind LogAlert. + /// The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + /// The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only for rules of the kind LogAlert. + /// List of Dimensions conditions. + /// The criteria operator. Relevant and required only for rules of the kind LogAlert. + /// the criteria threshold value that activates the alert. Relevant and required only for rules of the kind LogAlert. + /// The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert. + /// The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + internal Condition(string query, TimeAggregation? timeAggregation, string metricMeasureColumn, string resourceIdColumn, IList dimensions, MonitorConditionOperator? @operator, double? threshold, ConditionFailingPeriods failingPeriods, string metricName) + { + Query = query; + TimeAggregation = timeAggregation; + MetricMeasureColumn = metricMeasureColumn; + ResourceIdColumn = resourceIdColumn; + Dimensions = dimensions; + Operator = @operator; + Threshold = threshold; + FailingPeriods = failingPeriods; + MetricName = metricName; + } + + /// Log query alert. + public string Query { get; set; } + /// Aggregation type. Relevant and required only for rules of the kind LogAlert. + public TimeAggregation? TimeAggregation { get; set; } + /// The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + public string MetricMeasureColumn { get; set; } + /// The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only for rules of the kind LogAlert. + public string ResourceIdColumn { get; set; } + /// List of Dimensions conditions. + public IList Dimensions { get; } + /// The criteria operator. Relevant and required only for rules of the kind LogAlert. + public MonitorConditionOperator? Operator { get; set; } + /// the criteria threshold value that activates the alert. Relevant and required only for rules of the kind LogAlert. + public double? Threshold { get; set; } + /// The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert. + public ConditionFailingPeriods FailingPeriods { get; set; } + /// The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + public string MetricName { get; set; } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.Serialization.cs new file mode 100644 index 000000000000..ae2900daa083 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + public partial class ConditionFailingPeriods : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NumberOfEvaluationPeriods)) + { + writer.WritePropertyName("numberOfEvaluationPeriods"); + writer.WriteNumberValue(NumberOfEvaluationPeriods.Value); + } + if (Optional.IsDefined(MinFailingPeriodsToAlert)) + { + writer.WritePropertyName("minFailingPeriodsToAlert"); + writer.WriteNumberValue(MinFailingPeriodsToAlert.Value); + } + writer.WriteEndObject(); + } + + internal static ConditionFailingPeriods DeserializeConditionFailingPeriods(JsonElement element) + { + Optional numberOfEvaluationPeriods = default; + Optional minFailingPeriodsToAlert = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("numberOfEvaluationPeriods")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + numberOfEvaluationPeriods = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("minFailingPeriodsToAlert")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + minFailingPeriodsToAlert = property.Value.GetInt64(); + continue; + } + } + return new ConditionFailingPeriods(Optional.ToNullable(numberOfEvaluationPeriods), Optional.ToNullable(minFailingPeriodsToAlert)); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.cs new file mode 100644 index 000000000000..c810e166abf6 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionFailingPeriods.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Monitor.Models +{ + /// The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant only for rules of the kind LogAlert. + public partial class ConditionFailingPeriods + { + /// Initializes a new instance of ConditionFailingPeriods. + public ConditionFailingPeriods() + { + } + + /// Initializes a new instance of ConditionFailingPeriods. + /// 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. Default value is 1. + /// The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is 1. + internal ConditionFailingPeriods(long? numberOfEvaluationPeriods, long? minFailingPeriodsToAlert) + { + NumberOfEvaluationPeriods = numberOfEvaluationPeriods; + MinFailingPeriodsToAlert = minFailingPeriodsToAlert; + } + + /// 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. Default value is 1. + public long? NumberOfEvaluationPeriods { get; set; } + /// The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is 1. + public long? MinFailingPeriodsToAlert { get; set; } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionalOperator.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionalOperator.cs deleted file mode 100644 index 5691cb58cf75..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ConditionalOperator.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Result Condition Evaluation criteria. - public readonly partial struct ConditionalOperator : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ConditionalOperator(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string GreaterThanOrEqualValue = "GreaterThanOrEqual"; - private const string LessThanOrEqualValue = "LessThanOrEqual"; - private const string GreaterThanValue = "GreaterThan"; - private const string LessThanValue = "LessThan"; - private const string EqualValue = "Equal"; - - /// GreaterThanOrEqual. - public static ConditionalOperator GreaterThanOrEqual { get; } = new ConditionalOperator(GreaterThanOrEqualValue); - /// LessThanOrEqual. - public static ConditionalOperator LessThanOrEqual { get; } = new ConditionalOperator(LessThanOrEqualValue); - /// GreaterThan. - public static ConditionalOperator GreaterThan { get; } = new ConditionalOperator(GreaterThanValue); - /// LessThan. - public static ConditionalOperator LessThan { get; } = new ConditionalOperator(LessThanValue); - /// Equal. - public static ConditionalOperator Equal { get; } = new ConditionalOperator(EqualValue); - /// Determines if two values are the same. - public static bool operator ==(ConditionalOperator left, ConditionalOperator right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ConditionalOperator left, ConditionalOperator right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator ConditionalOperator(string value) => new ConditionalOperator(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ConditionalOperator other && Equals(other); - /// - public bool Equals(ConditionalOperator other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/DimensionOperator.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/DimensionOperator.cs new file mode 100644 index 000000000000..c76f392ad0d6 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/DimensionOperator.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// Operator for dimension values. + public readonly partial struct DimensionOperator : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DimensionOperator(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IncludeValue = "Include"; + private const string ExcludeValue = "Exclude"; + + /// Include. + public static DimensionOperator Include { get; } = new DimensionOperator(IncludeValue); + /// Exclude. + public static DimensionOperator Exclude { get; } = new DimensionOperator(ExcludeValue); + /// Determines if two values are the same. + public static bool operator ==(DimensionOperator left, DimensionOperator right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DimensionOperator left, DimensionOperator right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DimensionOperator(string value) => new DimensionOperator(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DimensionOperator other && Equals(other); + /// + public bool Equals(DimensionOperator other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.Serialization.cs deleted file mode 100644 index 236593f2e687..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.Serialization.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class LogMetricTrigger : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ThresholdOperator)) - { - writer.WritePropertyName("thresholdOperator"); - writer.WriteStringValue(ThresholdOperator.Value.ToString()); - } - if (Optional.IsDefined(Threshold)) - { - writer.WritePropertyName("threshold"); - writer.WriteNumberValue(Threshold.Value); - } - if (Optional.IsDefined(MetricTriggerType)) - { - writer.WritePropertyName("metricTriggerType"); - writer.WriteStringValue(MetricTriggerType.Value.ToString()); - } - if (Optional.IsDefined(MetricColumn)) - { - writer.WritePropertyName("metricColumn"); - writer.WriteStringValue(MetricColumn); - } - writer.WriteEndObject(); - } - - internal static LogMetricTrigger DeserializeLogMetricTrigger(JsonElement element) - { - Optional thresholdOperator = default; - Optional threshold = default; - Optional metricTriggerType = default; - Optional metricColumn = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("thresholdOperator")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - thresholdOperator = new ConditionalOperator(property.Value.GetString()); - continue; - } - if (property.NameEquals("threshold")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - threshold = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("metricTriggerType")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - metricTriggerType = new MetricTriggerType(property.Value.GetString()); - continue; - } - if (property.NameEquals("metricColumn")) - { - metricColumn = property.Value.GetString(); - continue; - } - } - return new LogMetricTrigger(Optional.ToNullable(thresholdOperator), Optional.ToNullable(threshold), Optional.ToNullable(metricTriggerType), metricColumn.Value); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.cs deleted file mode 100644 index 69b23e9bef89..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogMetricTrigger.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Monitor.Models -{ - /// A log metrics trigger descriptor. - public partial class LogMetricTrigger - { - /// Initializes a new instance of LogMetricTrigger. - public LogMetricTrigger() - { - } - - /// Initializes a new instance of LogMetricTrigger. - /// Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. - /// The threshold of the metric trigger. - /// Metric Trigger Type - 'Consecutive' or 'Total'. - /// Evaluation of metric on a particular column. - internal LogMetricTrigger(ConditionalOperator? thresholdOperator, double? threshold, MetricTriggerType? metricTriggerType, string metricColumn) - { - ThresholdOperator = thresholdOperator; - Threshold = threshold; - MetricTriggerType = metricTriggerType; - MetricColumn = metricColumn; - } - - /// Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. - public ConditionalOperator? ThresholdOperator { get; set; } - /// The threshold of the metric trigger. - public double? Threshold { get; set; } - /// Metric Trigger Type - 'Consecutive' or 'Total'. - public MetricTriggerType? MetricTriggerType { get; set; } - /// Evaluation of metric on a particular column. - public string MetricColumn { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleData.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleData.Serialization.cs deleted file mode 100644 index 445558b10f39..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleData.Serialization.cs +++ /dev/null @@ -1,249 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; -using Azure; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.Monitor.Models; - -namespace Azure.ResourceManager.Monitor -{ - public partial class LogSearchRuleData : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("location"); - writer.WriteStringValue(Location); - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"); - writer.WriteStringValue(Description); - } - if (Optional.IsDefined(DisplayName)) - { - writer.WritePropertyName("displayName"); - writer.WriteStringValue(DisplayName); - } - if (Optional.IsDefined(IsAutoMitigateEnabled)) - { - writer.WritePropertyName("autoMitigate"); - writer.WriteBooleanValue(IsAutoMitigateEnabled.Value); - } - if (Optional.IsDefined(Enabled)) - { - writer.WritePropertyName("enabled"); - writer.WriteStringValue(Enabled.Value.ToString()); - } - writer.WritePropertyName("source"); - writer.WriteObjectValue(Source); - if (Optional.IsDefined(Schedule)) - { - writer.WritePropertyName("schedule"); - writer.WriteObjectValue(Schedule); - } - writer.WritePropertyName("action"); - writer.WriteObjectValue(Action); - writer.WriteEndObject(); - writer.WriteEndObject(); - } - - internal static LogSearchRuleData DeserializeLogSearchRuleData(JsonElement element) - { - Optional etag = default; - Optional> tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - Optional systemData = default; - Optional createdWithApiVersion = default; - Optional isLegacyLogAnalyticsRule = default; - Optional description = default; - Optional displayName = default; - Optional autoMitigate = default; - Optional enabled = default; - Optional lastUpdatedTime = default; - Optional provisioningState = default; - MonitorSource source = default; - Optional schedule = default; - MonitorAction action = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("etag")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - etag = new ETag(property.Value.GetString()); - continue; - } - if (property.NameEquals("tags")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location")) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id")) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name")) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type")) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - systemData = JsonSerializer.Deserialize(property.Value.ToString()); - continue; - } - if (property.NameEquals("properties")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("createdWithApiVersion")) - { - createdWithApiVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("isLegacyLogAnalyticsRule")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - isLegacyLogAnalyticsRule = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("description")) - { - description = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("displayName")) - { - displayName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("autoMitigate")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - autoMitigate = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("enabled")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - enabled = new MonitorEnabled(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("lastUpdatedTime")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - lastUpdatedTime = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("provisioningState")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - provisioningState = new MonitorProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("source")) - { - source = MonitorSource.DeserializeMonitorSource(property0.Value); - continue; - } - if (property0.NameEquals("schedule")) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - property0.ThrowNonNullablePropertyIsNull(); - continue; - } - schedule = MonitorSchedule.DeserializeMonitorSchedule(property0.Value); - continue; - } - if (property0.NameEquals("action")) - { - action = MonitorAction.DeserializeMonitorAction(property0.Value); - continue; - } - } - continue; - } - } - return new LogSearchRuleData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, createdWithApiVersion.Value, Optional.ToNullable(isLegacyLogAnalyticsRule), description.Value, displayName.Value, Optional.ToNullable(autoMitigate), Optional.ToNullable(enabled), Optional.ToNullable(lastUpdatedTime), Optional.ToNullable(provisioningState), source, schedule.Value, action, Optional.ToNullable(etag)); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.Serialization.cs deleted file mode 100644 index cc90a51cf570..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class LogSearchRulePatch : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("properties"); - writer.WriteStartObject(); - if (Optional.IsDefined(Enabled)) - { - writer.WritePropertyName("enabled"); - writer.WriteStringValue(Enabled.Value.ToString()); - } - writer.WriteEndObject(); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.cs deleted file mode 100644 index 9a7dc529d8f3..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRulePatch.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// The log search rule resource for patch operations. - public partial class LogSearchRulePatch - { - /// Initializes a new instance of LogSearchRulePatch. - public LogSearchRulePatch() - { - Tags = new ChangeTrackingDictionary(); - } - - /// Resource tags. - public IDictionary Tags { get; } - /// The flag which indicates whether the Log Search rule is enabled. Value should be true or false. - public MonitorEnabled? Enabled { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleResourceCollection.cs deleted file mode 100644 index 3d265eb87962..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleResourceCollection.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Monitor; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Represents a collection of Log Search rule resources. - internal partial class LogSearchRuleResourceCollection - { - /// Initializes a new instance of LogSearchRuleResourceCollection. - internal LogSearchRuleResourceCollection() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of LogSearchRuleResourceCollection. - /// The values for the Log Search Rule resources. - internal LogSearchRuleResourceCollection(IReadOnlyList value) - { - Value = value; - } - - /// The values for the Log Search Rule resources. - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.Serialization.cs deleted file mode 100644 index 4ae2660daa30..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.Serialization.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class LogToMetricAction : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("criteria"); - writer.WriteStartArray(); - foreach (var item in Criteria) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("odata.type"); - writer.WriteStringValue(OdataType); - writer.WriteEndObject(); - } - - internal static LogToMetricAction DeserializeLogToMetricAction(JsonElement element) - { - IList criteria = default; - string odataType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("criteria")) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(MonitorCriteria.DeserializeMonitorCriteria(item)); - } - criteria = array; - continue; - } - if (property.NameEquals("odata.type")) - { - odataType = property.Value.GetString(); - continue; - } - } - return new LogToMetricAction(odataType, criteria); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.cs deleted file mode 100644 index a6dd9b2c753e..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogToMetricAction.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Specify action need to be taken when rule type is converting log to metric. - public partial class LogToMetricAction : MonitorAction - { - /// Initializes a new instance of LogToMetricAction. - /// Criteria of Metric. - /// is null. - public LogToMetricAction(IEnumerable criteria) - { - if (criteria == null) - { - throw new ArgumentNullException(nameof(criteria)); - } - - Criteria = criteria.ToList(); - OdataType = "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction"; - } - - /// Initializes a new instance of LogToMetricAction. - /// Specifies the action. Supported values - AlertingAction, LogToMetricAction. - /// Criteria of Metric. - internal LogToMetricAction(string odataType, IList criteria) : base(odataType) - { - Criteria = criteria; - OdataType = odataType ?? "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction"; - } - - /// Criteria of Metric. - public IList Criteria { get; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MetricTriggerType.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MetricTriggerType.cs deleted file mode 100644 index 5063347d2695..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MetricTriggerType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Metric Trigger Evaluation Type. - public readonly partial struct MetricTriggerType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MetricTriggerType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ConsecutiveValue = "Consecutive"; - private const string TotalValue = "Total"; - - /// Consecutive. - public static MetricTriggerType Consecutive { get; } = new MetricTriggerType(ConsecutiveValue); - /// Total. - public static MetricTriggerType Total { get; } = new MetricTriggerType(TotalValue); - /// Determines if two values are the same. - public static bool operator ==(MetricTriggerType left, MetricTriggerType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MetricTriggerType left, MetricTriggerType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator MetricTriggerType(string value) => new MetricTriggerType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MetricTriggerType other && Equals(other); - /// - public bool Equals(MetricTriggerType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.Serialization.cs deleted file mode 100644 index 796c997e3483..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class MonitorAction : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("odata.type"); - writer.WriteStringValue(OdataType); - writer.WriteEndObject(); - } - - internal static MonitorAction DeserializeMonitorAction(JsonElement element) - { - if (element.TryGetProperty("odata.type", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.AlertingAction": return AlertingAction.DeserializeAlertingAction(element); - case "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources.ScheduledQueryRules.LogToMetricAction": return LogToMetricAction.DeserializeLogToMetricAction(element); - } - } - string odataType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("odata.type")) - { - odataType = property.Value.GetString(); - continue; - } - } - return new UnknownMonitorAction(odataType); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.cs deleted file mode 100644 index 10c76aaaaa22..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorAction.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Monitor.Models -{ - /// - /// Action descriptor. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . - /// - public abstract partial class MonitorAction - { - /// Initializes a new instance of MonitorAction. - protected MonitorAction() - { - } - - /// Initializes a new instance of MonitorAction. - /// Specifies the action. Supported values - AlertingAction, LogToMetricAction. - internal MonitorAction(string odataType) - { - OdataType = odataType; - } - - /// Specifies the action. Supported values - AlertingAction, LogToMetricAction. - internal string OdataType { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.Serialization.cs index d5e919518961..5c82053277b9 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.Serialization.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.Serialization.cs @@ -17,6 +17,7 @@ internal static partial class MonitorConditionOperatorExtensions MonitorConditionOperator.GreaterThanOrEqual => "GreaterThanOrEqual", MonitorConditionOperator.LessThan => "LessThan", MonitorConditionOperator.LessThanOrEqual => "LessThanOrEqual", + MonitorConditionOperator.EqualsValue => "Equals", _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown MonitorConditionOperator value.") }; @@ -26,6 +27,7 @@ public static MonitorConditionOperator ToMonitorConditionOperator(this string va if (string.Equals(value, "GreaterThanOrEqual", StringComparison.InvariantCultureIgnoreCase)) return MonitorConditionOperator.GreaterThanOrEqual; if (string.Equals(value, "LessThan", StringComparison.InvariantCultureIgnoreCase)) return MonitorConditionOperator.LessThan; if (string.Equals(value, "LessThanOrEqual", StringComparison.InvariantCultureIgnoreCase)) return MonitorConditionOperator.LessThanOrEqual; + if (string.Equals(value, "Equals", StringComparison.InvariantCultureIgnoreCase)) return MonitorConditionOperator.EqualsValue; throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown MonitorConditionOperator value."); } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.cs index 0ac542a841c1..abd25d22da51 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorConditionOperator.cs @@ -17,6 +17,8 @@ public enum MonitorConditionOperator /// LessThan. LessThan, /// LessThanOrEqual. - LessThanOrEqual + LessThanOrEqual, + /// Equals. + EqualsValue } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorCriteria.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorCriteria.cs deleted file mode 100644 index e1e42ac68eda..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorCriteria.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Specifies the criteria for converting log to metric. - public partial class MonitorCriteria - { - /// Initializes a new instance of MonitorCriteria. - /// Name of the metric. - /// is null. - public MonitorCriteria(string metricName) - { - if (metricName == null) - { - throw new ArgumentNullException(nameof(metricName)); - } - - MetricName = metricName; - Dimensions = new ChangeTrackingList(); - } - - /// Initializes a new instance of MonitorCriteria. - /// Name of the metric. - /// List of Dimensions for creating metric. - internal MonitorCriteria(string metricName, IList dimensions) - { - MetricName = metricName; - Dimensions = dimensions; - } - - /// Name of the metric. - public string MetricName { get; set; } - /// List of Dimensions for creating metric. - public IList Dimensions { get; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.Serialization.cs index dfa06ea931f9..932d21807316 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.Serialization.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.Serialization.cs @@ -33,7 +33,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static MonitorDimension DeserializeMonitorDimension(JsonElement element) { string name = default; - MonitorOperator @operator = default; + DimensionOperator @operator = default; IList values = default; foreach (var property in element.EnumerateObject()) { @@ -44,7 +44,7 @@ internal static MonitorDimension DeserializeMonitorDimension(JsonElement element } if (property.NameEquals("operator")) { - @operator = new MonitorOperator(property.Value.GetString()); + @operator = new DimensionOperator(property.Value.GetString()); continue; } if (property.NameEquals("values")) diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.cs index 9ef24f6cae36..56c169700f08 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorDimension.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Monitor.Models { - /// Specifies the criteria for converting log to metric. + /// Dimension splitting and filtering definition. public partial class MonitorDimension { /// Initializes a new instance of MonitorDimension. @@ -19,7 +19,7 @@ public partial class MonitorDimension /// Operator for dimension values. /// List of dimension values. /// or is null. - public MonitorDimension(string name, MonitorOperator @operator, IEnumerable values) + public MonitorDimension(string name, DimensionOperator @operator, IEnumerable values) { if (name == null) { @@ -39,7 +39,7 @@ public MonitorDimension(string name, MonitorOperator @operator, IEnumerable Name of the dimension. /// Operator for dimension values. /// List of dimension values. - internal MonitorDimension(string name, MonitorOperator @operator, IList values) + internal MonitorDimension(string name, DimensionOperator @operator, IList values) { Name = name; Operator = @operator; @@ -49,7 +49,7 @@ internal MonitorDimension(string name, MonitorOperator @operator, IList /// Name of the dimension. public string Name { get; set; } /// Operator for dimension values. - public MonitorOperator Operator { get; set; } + public DimensionOperator Operator { get; set; } /// List of dimension values. public IList Values { get; } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorEnabled.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorEnabled.cs deleted file mode 100644 index 9a4c20a00400..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorEnabled.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// The flag which indicates whether the Log Search rule is enabled. Value should be true or false. - public readonly partial struct MonitorEnabled : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MonitorEnabled(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TrueValue = "true"; - private const string FalseValue = "false"; - - /// true. - public static MonitorEnabled True { get; } = new MonitorEnabled(TrueValue); - /// false. - public static MonitorEnabled False { get; } = new MonitorEnabled(FalseValue); - /// Determines if two values are the same. - public static bool operator ==(MonitorEnabled left, MonitorEnabled right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MonitorEnabled left, MonitorEnabled right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator MonitorEnabled(string value) => new MonitorEnabled(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MonitorEnabled other && Equals(other); - /// - public bool Equals(MonitorEnabled other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorKind.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorKind.cs new file mode 100644 index 000000000000..6b418ef41cd2 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// Indicates the type of scheduled query rule. The default is LogAlert. + public readonly partial struct MonitorKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MonitorKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LogAlertValue = "LogAlert"; + private const string LogToMetricValue = "LogToMetric"; + + /// LogAlert. + public static MonitorKind LogAlert { get; } = new MonitorKind(LogAlertValue); + /// LogToMetric. + public static MonitorKind LogToMetric { get; } = new MonitorKind(LogToMetricValue); + /// Determines if two values are the same. + public static bool operator ==(MonitorKind left, MonitorKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MonitorKind left, MonitorKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MonitorKind(string value) => new MonitorKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MonitorKind other && Equals(other); + /// + public bool Equals(MonitorKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorOperator.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorOperator.cs index 57105e7b2b60..601616aeca14 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorOperator.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorOperator.cs @@ -27,7 +27,6 @@ public MonitorOperator(string value) private const string GreaterThanOrEqualValue = "GreaterThanOrEqual"; private const string LessThanValue = "LessThan"; private const string LessThanOrEqualValue = "LessThanOrEqual"; - private const string IncludeValue = "Include"; /// Equals. public static MonitorOperator EqualsValue { get; } = new MonitorOperator(EqualsValueValue); @@ -39,8 +38,6 @@ public MonitorOperator(string value) public static MonitorOperator LessThan { get; } = new MonitorOperator(LessThanValue); /// LessThanOrEqual. public static MonitorOperator LessThanOrEqual { get; } = new MonitorOperator(LessThanOrEqualValue); - /// Include. - public static MonitorOperator Include { get; } = new MonitorOperator(IncludeValue); /// Determines if two values are the same. public static bool operator ==(MonitorOperator left, MonitorOperator right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorProvisioningState.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorProvisioningState.cs deleted file mode 100644 index e85c067905b2..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorProvisioningState.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Provisioning state of the scheduled query rule. - public readonly partial struct MonitorProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MonitorProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SucceededValue = "Succeeded"; - private const string DeployingValue = "Deploying"; - private const string CanceledValue = "Canceled"; - private const string FailedValue = "Failed"; - - /// Succeeded. - public static MonitorProvisioningState Succeeded { get; } = new MonitorProvisioningState(SucceededValue); - /// Deploying. - public static MonitorProvisioningState Deploying { get; } = new MonitorProvisioningState(DeployingValue); - /// Canceled. - public static MonitorProvisioningState Canceled { get; } = new MonitorProvisioningState(CanceledValue); - /// Failed. - public static MonitorProvisioningState Failed { get; } = new MonitorProvisioningState(FailedValue); - /// Determines if two values are the same. - public static bool operator ==(MonitorProvisioningState left, MonitorProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MonitorProvisioningState left, MonitorProvisioningState right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator MonitorProvisioningState(string value) => new MonitorProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MonitorProvisioningState other && Equals(other); - /// - public bool Equals(MonitorProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.Serialization.cs deleted file mode 100644 index 2ec002f6f9ce..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class MonitorSchedule : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("frequencyInMinutes"); - writer.WriteNumberValue(FrequencyInMinutes); - writer.WritePropertyName("timeWindowInMinutes"); - writer.WriteNumberValue(TimeWindowInMinutes); - writer.WriteEndObject(); - } - - internal static MonitorSchedule DeserializeMonitorSchedule(JsonElement element) - { - int frequencyInMinutes = default; - int timeWindowInMinutes = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("frequencyInMinutes")) - { - frequencyInMinutes = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("timeWindowInMinutes")) - { - timeWindowInMinutes = property.Value.GetInt32(); - continue; - } - } - return new MonitorSchedule(frequencyInMinutes, timeWindowInMinutes); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.cs deleted file mode 100644 index 89590d067319..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSchedule.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Defines how often to run the search and the time interval. - public partial class MonitorSchedule - { - /// Initializes a new instance of MonitorSchedule. - /// 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 MonitorSchedule(int frequencyInMinutes, int timeWindowInMinutes) - { - FrequencyInMinutes = frequencyInMinutes; - TimeWindowInMinutes = timeWindowInMinutes; - } - - /// frequency (in minutes) at which rule condition should be evaluated. - public int FrequencyInMinutes { get; set; } - /// Time window for which data needs to be fetched for query (should be greater than or equal to frequencyInMinutes). - public int TimeWindowInMinutes { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.Serialization.cs deleted file mode 100644 index d558afa8a42d..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.Serialization.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class MonitorSource : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Query)) - { - writer.WritePropertyName("query"); - writer.WriteStringValue(Query); - } - if (Optional.IsCollectionDefined(AuthorizedResources)) - { - writer.WritePropertyName("authorizedResources"); - writer.WriteStartArray(); - foreach (var item in AuthorizedResources) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WritePropertyName("dataSourceId"); - writer.WriteStringValue(DataSourceId); - if (Optional.IsDefined(QueryType)) - { - writer.WritePropertyName("queryType"); - writer.WriteStringValue(QueryType.Value.ToString()); - } - writer.WriteEndObject(); - } - - internal static MonitorSource DeserializeMonitorSource(JsonElement element) - { - Optional query = default; - Optional> authorizedResources = default; - ResourceIdentifier dataSourceId = default; - Optional queryType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("query")) - { - query = property.Value.GetString(); - continue; - } - if (property.NameEquals("authorizedResources")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - authorizedResources = array; - continue; - } - if (property.NameEquals("dataSourceId")) - { - dataSourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("queryType")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - queryType = new MonitorSourceQueryType(property.Value.GetString()); - continue; - } - } - return new MonitorSource(query.Value, Optional.ToList(authorizedResources), dataSourceId, Optional.ToNullable(queryType)); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.cs deleted file mode 100644 index dbb62164b920..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSource.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Specifies the log search query. - public partial class MonitorSource - { - /// Initializes a new instance of MonitorSource. - /// The resource uri over which log search query is to be run. - /// is null. - public MonitorSource(ResourceIdentifier dataSourceId) - { - if (dataSourceId == null) - { - throw new ArgumentNullException(nameof(dataSourceId)); - } - - AuthorizedResources = new ChangeTrackingList(); - DataSourceId = dataSourceId; - } - - /// Initializes a new instance of MonitorSource. - /// Log search query. Required for action type - AlertingAction. - /// List of Resource referred into query. - /// The resource uri over which log search query is to be run. - /// Set value to 'ResultCount' . - internal MonitorSource(string query, IList authorizedResources, ResourceIdentifier dataSourceId, MonitorSourceQueryType? queryType) - { - Query = query; - AuthorizedResources = authorizedResources; - DataSourceId = dataSourceId; - QueryType = queryType; - } - - /// Log search query. Required for action type - AlertingAction. - public string Query { get; set; } - /// List of Resource referred into query. - public IList AuthorizedResources { get; } - /// The resource uri over which log search query is to be run. - public ResourceIdentifier DataSourceId { get; set; } - /// Set value to 'ResultCount' . - public MonitorSourceQueryType? QueryType { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSourceQueryType.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSourceQueryType.cs deleted file mode 100644 index 819c4747a0b8..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorSourceQueryType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Set value to 'ResultAccount'. - public readonly partial struct MonitorSourceQueryType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public MonitorSourceQueryType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ResultCountValue = "ResultCount"; - - /// ResultCount. - public static MonitorSourceQueryType ResultCount { get; } = new MonitorSourceQueryType(ResultCountValue); - /// Determines if two values are the same. - public static bool operator ==(MonitorSourceQueryType left, MonitorSourceQueryType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(MonitorSourceQueryType left, MonitorSourceQueryType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator MonitorSourceQueryType(string value) => new MonitorSourceQueryType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is MonitorSourceQueryType other && Equals(other); - /// - public bool Equals(MonitorSourceQueryType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.Serialization.cs deleted file mode 100644 index 2f783d7b2ac3..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.Serialization.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class NotificationDetails : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(ActionGroup)) - { - writer.WritePropertyName("actionGroup"); - writer.WriteStartArray(); - foreach (var item in ActionGroup) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(EmailSubject)) - { - writer.WritePropertyName("emailSubject"); - writer.WriteStringValue(EmailSubject); - } - if (Optional.IsDefined(CustomWebhookPayload)) - { - writer.WritePropertyName("customWebhookPayload"); - writer.WriteStringValue(CustomWebhookPayload); - } - writer.WriteEndObject(); - } - - internal static NotificationDetails DeserializeNotificationDetails(JsonElement element) - { - Optional> actionGroup = default; - Optional emailSubject = default; - Optional customWebhookPayload = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("actionGroup")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - actionGroup = array; - continue; - } - if (property.NameEquals("emailSubject")) - { - emailSubject = property.Value.GetString(); - continue; - } - if (property.NameEquals("customWebhookPayload")) - { - customWebhookPayload = property.Value.GetString(); - continue; - } - } - return new NotificationDetails(Optional.ToList(actionGroup), emailSubject.Value, customWebhookPayload.Value); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.cs deleted file mode 100644 index 559fd472646b..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/NotificationDetails.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - /// Azure action group. - public partial class NotificationDetails - { - /// Initializes a new instance of NotificationDetails. - public NotificationDetails() - { - ActionGroup = new ChangeTrackingList(); - } - - /// Initializes a new instance of NotificationDetails. - /// 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. - internal NotificationDetails(IList actionGroup, string emailSubject, string customWebhookPayload) - { - ActionGroup = actionGroup; - EmailSubject = emailSubject; - CustomWebhookPayload = customWebhookPayload; - } - - /// Azure Action Group reference. - public IList ActionGroup { get; } - /// Custom subject override for all email ids in Azure action group. - public string EmailSubject { get; set; } - /// Custom payload to be sent for all webhook URI in Azure action group. - public string CustomWebhookPayload { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorCriteria.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleCriteria.Serialization.cs similarity index 52% rename from sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorCriteria.Serialization.cs rename to sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleCriteria.Serialization.cs index 3d79430d2c23..071148443474 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/MonitorCriteria.Serialization.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleCriteria.Serialization.cs @@ -11,18 +11,16 @@ namespace Azure.ResourceManager.Monitor.Models { - public partial class MonitorCriteria : IUtf8JsonSerializable + internal partial class ScheduledQueryRuleCriteria : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("metricName"); - writer.WriteStringValue(MetricName); - if (Optional.IsCollectionDefined(Dimensions)) + if (Optional.IsCollectionDefined(AllOf)) { - writer.WritePropertyName("dimensions"); + writer.WritePropertyName("allOf"); writer.WriteStartArray(); - foreach (var item in Dimensions) + foreach (var item in AllOf) { writer.WriteObjectValue(item); } @@ -31,34 +29,28 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static MonitorCriteria DeserializeMonitorCriteria(JsonElement element) + internal static ScheduledQueryRuleCriteria DeserializeScheduledQueryRuleCriteria(JsonElement element) { - string metricName = default; - Optional> dimensions = default; + Optional> allOf = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("metricName")) - { - metricName = property.Value.GetString(); - continue; - } - if (property.NameEquals("dimensions")) + if (property.NameEquals("allOf")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(MonitorDimension.DeserializeMonitorDimension(item)); + array.Add(Condition.DeserializeCondition(item)); } - dimensions = array; + allOf = array; continue; } } - return new MonitorCriteria(metricName, Optional.ToList(dimensions)); + return new ScheduledQueryRuleCriteria(Optional.ToList(allOf)); } } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleCriteria.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleCriteria.cs new file mode 100644 index 000000000000..9f3ece05cecb --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleCriteria.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// The rule criteria that defines the conditions of the scheduled query rule. + internal partial class ScheduledQueryRuleCriteria + { + /// Initializes a new instance of ScheduledQueryRuleCriteria. + public ScheduledQueryRuleCriteria() + { + AllOf = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScheduledQueryRuleCriteria. + /// A list of conditions to evaluate against the specified scopes. + internal ScheduledQueryRuleCriteria(IList allOf) + { + AllOf = allOf; + } + + /// A list of conditions to evaluate against the specified scopes. + public IList AllOf { get; } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleResourceCollection.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceCollection.Serialization.cs similarity index 52% rename from sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleResourceCollection.Serialization.cs rename to sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceCollection.Serialization.cs index 9b1fefa98371..b46d799cf31d 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/LogSearchRuleResourceCollection.Serialization.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceCollection.Serialization.cs @@ -12,11 +12,12 @@ namespace Azure.ResourceManager.Monitor.Models { - internal partial class LogSearchRuleResourceCollection + internal partial class ScheduledQueryRuleResourceCollection { - internal static LogSearchRuleResourceCollection DeserializeLogSearchRuleResourceCollection(JsonElement element) + internal static ScheduledQueryRuleResourceCollection DeserializeScheduledQueryRuleResourceCollection(JsonElement element) { - Optional> value = default; + Optional> value = default; + Optional nextLink = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) @@ -26,16 +27,21 @@ internal static LogSearchRuleResourceCollection DeserializeLogSearchRuleResource property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(LogSearchRuleData.DeserializeLogSearchRuleData(item)); + array.Add(ScheduledQueryRuleResourceData.DeserializeScheduledQueryRuleResourceData(item)); } value = array; continue; } + if (property.NameEquals("nextLink")) + { + nextLink = property.Value.GetString(); + continue; + } } - return new LogSearchRuleResourceCollection(Optional.ToList(value)); + return new ScheduledQueryRuleResourceCollection(Optional.ToList(value), nextLink.Value); } } } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceCollection.cs new file mode 100644 index 000000000000..f9c42d32991e --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceCollection.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Monitor; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// Represents a collection of scheduled query rule resources. + internal partial class ScheduledQueryRuleResourceCollection + { + /// Initializes a new instance of ScheduledQueryRuleResourceCollection. + internal ScheduledQueryRuleResourceCollection() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScheduledQueryRuleResourceCollection. + /// The values for the scheduled query rule resources. + /// Provides the link to retrieve the next set of elements. + internal ScheduledQueryRuleResourceCollection(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The values for the scheduled query rule resources. + public IReadOnlyList Value { get; } + /// Provides the link to retrieve the next set of elements. + public string NextLink { get; } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceData.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceData.Serialization.cs new file mode 100644 index 000000000000..7d433f1c0945 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourceData.Serialization.cs @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor +{ + public partial class ScheduledQueryRuleResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Severity)) + { + writer.WritePropertyName("severity"); + writer.WriteStringValue(Severity.Value.ToString()); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsCollectionDefined(Scopes)) + { + writer.WritePropertyName("scopes"); + writer.WriteStartArray(); + foreach (var item in Scopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EvaluationFrequency)) + { + writer.WritePropertyName("evaluationFrequency"); + writer.WriteStringValue(EvaluationFrequency.Value, "P"); + } + if (Optional.IsDefined(WindowSize)) + { + writer.WritePropertyName("windowSize"); + writer.WriteStringValue(WindowSize.Value, "P"); + } + if (Optional.IsDefined(OverrideQueryTimeRange)) + { + writer.WritePropertyName("overrideQueryTimeRange"); + writer.WriteStringValue(OverrideQueryTimeRange.Value, "P"); + } + if (Optional.IsCollectionDefined(TargetResourceTypes)) + { + writer.WritePropertyName("targetResourceTypes"); + writer.WriteStartArray(); + foreach (var item in TargetResourceTypes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Criteria)) + { + writer.WritePropertyName("criteria"); + writer.WriteObjectValue(Criteria); + } + if (Optional.IsDefined(MuteActionsDuration)) + { + writer.WritePropertyName("muteActionsDuration"); + writer.WriteStringValue(MuteActionsDuration.Value, "P"); + } + if (Optional.IsDefined(Actions)) + { + writer.WritePropertyName("actions"); + writer.WriteObjectValue(Actions); + } + if (Optional.IsDefined(CheckWorkspaceAlertsStorageConfigured)) + { + writer.WritePropertyName("checkWorkspaceAlertsStorageConfigured"); + writer.WriteBooleanValue(CheckWorkspaceAlertsStorageConfigured.Value); + } + if (Optional.IsDefined(SkipQueryValidation)) + { + writer.WritePropertyName("skipQueryValidation"); + writer.WriteBooleanValue(SkipQueryValidation.Value); + } + if (Optional.IsDefined(AutoMitigate)) + { + writer.WritePropertyName("autoMitigate"); + writer.WriteBooleanValue(AutoMitigate.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ScheduledQueryRuleResourceData DeserializeScheduledQueryRuleResourceData(JsonElement element) + { + Optional kind = default; + Optional etag = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional createdWithApiVersion = default; + Optional isLegacyLogAnalyticsRule = default; + Optional description = default; + Optional displayName = default; + Optional severity = default; + Optional enabled = default; + Optional> scopes = default; + Optional evaluationFrequency = default; + Optional windowSize = default; + Optional overrideQueryTimeRange = default; + Optional> targetResourceTypes = default; + Optional criteria = default; + Optional muteActionsDuration = default; + Optional actions = default; + Optional isWorkspaceAlertsStorageConfigured = default; + Optional checkWorkspaceAlertsStorageConfigured = default; + Optional skipQueryValidation = default; + Optional autoMitigate = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + kind = new MonitorKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("etag")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + etag = new ETag(property.Value.GetString()); + continue; + } + if (property.NameEquals("tags")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location")) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.ToString()); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("createdWithApiVersion")) + { + createdWithApiVersion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("isLegacyLogAnalyticsRule")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isLegacyLogAnalyticsRule = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("description")) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("displayName")) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("severity")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + severity = new AlertSeverity(property0.Value.GetInt64()); + continue; + } + if (property0.NameEquals("enabled")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + enabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("scopes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + scopes = array; + continue; + } + if (property0.NameEquals("evaluationFrequency")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + evaluationFrequency = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("windowSize")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + windowSize = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("overrideQueryTimeRange")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + overrideQueryTimeRange = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("targetResourceTypes")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + targetResourceTypes = array; + continue; + } + if (property0.NameEquals("criteria")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + criteria = ScheduledQueryRuleCriteria.DeserializeScheduledQueryRuleCriteria(property0.Value); + continue; + } + if (property0.NameEquals("muteActionsDuration")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + muteActionsDuration = property0.Value.GetTimeSpan("P"); + continue; + } + if (property0.NameEquals("actions")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + actions = Actions.DeserializeActions(property0.Value); + continue; + } + if (property0.NameEquals("isWorkspaceAlertsStorageConfigured")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isWorkspaceAlertsStorageConfigured = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("checkWorkspaceAlertsStorageConfigured")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + checkWorkspaceAlertsStorageConfigured = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("skipQueryValidation")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + skipQueryValidation = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("autoMitigate")) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + autoMitigate = property0.Value.GetBoolean(); + continue; + } + } + continue; + } + } + return new ScheduledQueryRuleResourceData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(kind), Optional.ToNullable(etag), createdWithApiVersion.Value, Optional.ToNullable(isLegacyLogAnalyticsRule), description.Value, displayName.Value, Optional.ToNullable(severity), Optional.ToNullable(enabled), Optional.ToList(scopes), Optional.ToNullable(evaluationFrequency), Optional.ToNullable(windowSize), Optional.ToNullable(overrideQueryTimeRange), Optional.ToList(targetResourceTypes), criteria.Value, Optional.ToNullable(muteActionsDuration), actions.Value, Optional.ToNullable(isWorkspaceAlertsStorageConfigured), Optional.ToNullable(checkWorkspaceAlertsStorageConfigured), Optional.ToNullable(skipQueryValidation), Optional.ToNullable(autoMitigate)); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.Serialization.cs new file mode 100644 index 000000000000..69e6ca6d8c79 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.Serialization.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + public partial class ScheduledQueryRuleResourcePatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("properties"); + writer.WriteStartObject(); + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Severity)) + { + writer.WritePropertyName("severity"); + writer.WriteStringValue(Severity.Value.ToString()); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsCollectionDefined(Scopes)) + { + writer.WritePropertyName("scopes"); + writer.WriteStartArray(); + foreach (var item in Scopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EvaluationFrequency)) + { + writer.WritePropertyName("evaluationFrequency"); + writer.WriteStringValue(EvaluationFrequency.Value, "P"); + } + if (Optional.IsDefined(WindowSize)) + { + writer.WritePropertyName("windowSize"); + writer.WriteStringValue(WindowSize.Value, "P"); + } + if (Optional.IsDefined(OverrideQueryTimeRange)) + { + writer.WritePropertyName("overrideQueryTimeRange"); + writer.WriteStringValue(OverrideQueryTimeRange.Value, "P"); + } + if (Optional.IsCollectionDefined(TargetResourceTypes)) + { + writer.WritePropertyName("targetResourceTypes"); + writer.WriteStartArray(); + foreach (var item in TargetResourceTypes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Criteria)) + { + writer.WritePropertyName("criteria"); + writer.WriteObjectValue(Criteria); + } + if (Optional.IsDefined(MuteActionsDuration)) + { + writer.WritePropertyName("muteActionsDuration"); + writer.WriteStringValue(MuteActionsDuration.Value, "P"); + } + if (Optional.IsDefined(Actions)) + { + writer.WritePropertyName("actions"); + writer.WriteObjectValue(Actions); + } + if (Optional.IsDefined(CheckWorkspaceAlertsStorageConfigured)) + { + writer.WritePropertyName("checkWorkspaceAlertsStorageConfigured"); + writer.WriteBooleanValue(CheckWorkspaceAlertsStorageConfigured.Value); + } + if (Optional.IsDefined(SkipQueryValidation)) + { + writer.WritePropertyName("skipQueryValidation"); + writer.WriteBooleanValue(SkipQueryValidation.Value); + } + if (Optional.IsDefined(AutoMitigate)) + { + writer.WritePropertyName("autoMitigate"); + writer.WriteBooleanValue(AutoMitigate.Value); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.cs new file mode 100644 index 000000000000..dc631a6d3868 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/ScheduledQueryRuleResourcePatch.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// The scheduled query rule resource for patch operations. + public partial class ScheduledQueryRuleResourcePatch + { + /// Initializes a new instance of ScheduledQueryRuleResourcePatch. + public ScheduledQueryRuleResourcePatch() + { + Tags = new ChangeTrackingDictionary(); + Scopes = new ChangeTrackingList(); + TargetResourceTypes = new ChangeTrackingList(); + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The api-version used when creating this alert rule. + public string CreatedWithApiVersion { get; } + /// True if alert rule is legacy Log Analytic rule. + public bool? IsLegacyLogAnalyticsRule { get; } + /// The description of the scheduled query rule. + public string Description { get; set; } + /// The display name of the alert rule. + public string DisplayName { get; set; } + /// Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert. + public AlertSeverity? Severity { get; set; } + /// The flag which indicates whether this scheduled query rule is enabled. Value should be true or false. + public bool? Enabled { get; set; } + /// The list of resource id's that this scheduled query rule is scoped to. + public IList Scopes { get; } + /// How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert. + public TimeSpan? EvaluationFrequency { get; set; } + /// The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + public TimeSpan? WindowSize { get; set; } + /// If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + public TimeSpan? OverrideQueryTimeRange { get; set; } + /// List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + public IList TargetResourceTypes { get; } + /// The rule criteria that defines the conditions of the scheduled query rule. + internal ScheduledQueryRuleCriteria Criteria { get; set; } + /// A list of conditions to evaluate against the specified scopes. + public IList CriteriaAllOf + { + get + { + if (Criteria is null) + Criteria = new ScheduledQueryRuleCriteria(); + return Criteria.AllOf; + } + } + + /// Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules of the kind LogAlert. + public TimeSpan? MuteActionsDuration { get; set; } + /// Actions to invoke when the alert fires. + public Actions Actions { get; set; } + /// The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's storage. The default is false. + public bool? IsWorkspaceAlertsStorageConfigured { get; } + /// The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + public bool? CheckWorkspaceAlertsStorageConfigured { get; set; } + /// The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for rules of the kind LogAlert. + public bool? SkipQueryValidation { get; set; } + /// The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + public bool? AutoMitigate { get; set; } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TimeAggregation.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TimeAggregation.cs new file mode 100644 index 000000000000..16075db70107 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TimeAggregation.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Monitor.Models +{ + /// Aggregation type. Relevant and required only for rules of the kind LogAlert. + public readonly partial struct TimeAggregation : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TimeAggregation(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CountValue = "Count"; + private const string AverageValue = "Average"; + private const string MinimumValue = "Minimum"; + private const string MaximumValue = "Maximum"; + private const string TotalValue = "Total"; + + /// Count. + public static TimeAggregation Count { get; } = new TimeAggregation(CountValue); + /// Average. + public static TimeAggregation Average { get; } = new TimeAggregation(AverageValue); + /// Minimum. + public static TimeAggregation Minimum { get; } = new TimeAggregation(MinimumValue); + /// Maximum. + public static TimeAggregation Maximum { get; } = new TimeAggregation(MaximumValue); + /// Total. + public static TimeAggregation Total { get; } = new TimeAggregation(TotalValue); + /// Determines if two values are the same. + public static bool operator ==(TimeAggregation left, TimeAggregation right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TimeAggregation left, TimeAggregation right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TimeAggregation(string value) => new TimeAggregation(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TimeAggregation other && Equals(other); + /// + public bool Equals(TimeAggregation other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.Serialization.cs deleted file mode 100644 index 15d25caeb4df..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.Serialization.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - public partial class TriggerCondition : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("thresholdOperator"); - writer.WriteStringValue(ThresholdOperator.ToString()); - writer.WritePropertyName("threshold"); - writer.WriteNumberValue(Threshold); - if (Optional.IsDefined(MetricTrigger)) - { - writer.WritePropertyName("metricTrigger"); - writer.WriteObjectValue(MetricTrigger); - } - writer.WriteEndObject(); - } - - internal static TriggerCondition DeserializeTriggerCondition(JsonElement element) - { - ConditionalOperator thresholdOperator = default; - double threshold = default; - Optional metricTrigger = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("thresholdOperator")) - { - thresholdOperator = new ConditionalOperator(property.Value.GetString()); - continue; - } - if (property.NameEquals("threshold")) - { - threshold = property.Value.GetDouble(); - continue; - } - if (property.NameEquals("metricTrigger")) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - metricTrigger = LogMetricTrigger.DeserializeLogMetricTrigger(property.Value); - continue; - } - } - return new TriggerCondition(thresholdOperator, threshold, metricTrigger.Value); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.cs deleted file mode 100644 index cabaac910d66..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/TriggerCondition.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Monitor.Models -{ - /// The condition that results in the Log Search rule. - public partial class TriggerCondition - { - /// Initializes a new instance of TriggerCondition. - /// Evaluation operation for rule - 'GreaterThan' or 'LessThan. - /// Result or count threshold based on which rule should be triggered. - public TriggerCondition(ConditionalOperator thresholdOperator, double threshold) - { - ThresholdOperator = thresholdOperator; - Threshold = threshold; - } - - /// Initializes a new instance of TriggerCondition. - /// Evaluation operation for rule - 'GreaterThan' or 'LessThan. - /// Result or count threshold based on which rule should be triggered. - /// Trigger condition for metric query rule. - internal TriggerCondition(ConditionalOperator thresholdOperator, double threshold, LogMetricTrigger metricTrigger) - { - ThresholdOperator = thresholdOperator; - Threshold = threshold; - MetricTrigger = metricTrigger; - } - - /// Evaluation operation for rule - 'GreaterThan' or 'LessThan. - public ConditionalOperator ThresholdOperator { get; set; } - /// Result or count threshold based on which rule should be triggered. - public double Threshold { get; set; } - /// Trigger condition for metric query rule. - public LogMetricTrigger MetricTrigger { get; set; } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.Serialization.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.Serialization.cs deleted file mode 100644 index 46fcb9030381..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.Serialization.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Monitor.Models -{ - internal partial class UnknownMonitorAction : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("odata.type"); - writer.WriteStringValue(OdataType); - writer.WriteEndObject(); - } - - internal static UnknownMonitorAction DeserializeUnknownMonitorAction(JsonElement element) - { - string odataType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("odata.type")) - { - odataType = property.Value.GetString(); - continue; - } - } - return new UnknownMonitorAction(odataType); - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.cs deleted file mode 100644 index fef51a9342b5..000000000000 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/Models/UnknownMonitorAction.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Monitor.Models -{ - /// The UnknownMonitorAction. - internal partial class UnknownMonitorAction : MonitorAction - { - /// Initializes a new instance of UnknownMonitorAction. - /// Specifies the action. Supported values - AlertingAction, LogToMetricAction. - internal UnknownMonitorAction(string odataType) : base(odataType) - { - OdataType = odataType ?? "Unknown"; - } - } -} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/RestOperations/ScheduledQueryRulesRestOperations.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/RestOperations/ScheduledQueryRulesRestOperations.cs index 557dd103d8bb..adca8c2f2148 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/RestOperations/ScheduledQueryRulesRestOperations.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/RestOperations/ScheduledQueryRulesRestOperations.cs @@ -33,59 +33,116 @@ public ScheduledQueryRulesRestOperations(HttpPipeline pipeline, string applicati { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2018-04-16"; + _apiVersion = apiVersion ?? "2022-06-15"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string ruleName, LogSearchRuleData data) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retrieve a scheduled query rule definitions in a subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Models.ScheduledQueryRuleResourceCollection value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieve a scheduled query rule definitions in a subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Models.ScheduledQueryRuleResourceCollection value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules/", false); - uri.AppendPath(ruleName, true); + uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(data); - request.Content = content; _userAgent.Apply(message); return message; } - /// Creates or updates an log search rule. + /// Retrieve scheduled query rule definitions in a resource group. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the rule. - /// The parameters of the rule to create or update. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string ruleName, LogSearchRuleData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, ruleName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: { - LogSearchRuleData value = default; + Models.ScheduledQueryRuleResourceCollection value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LogSearchRuleData.DeserializeLogSearchRuleData(document.RootElement); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -93,31 +150,26 @@ public async Task> CreateOrUpdateAsync(string subscr } } - /// Creates or updates an log search rule. + /// Retrieve scheduled query rule definitions in a resource group. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the rule. - /// The parameters of the rule to create or update. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string ruleName, LogSearchRuleData data, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, ruleName, data); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: { - LogSearchRuleData value = default; + Models.ScheduledQueryRuleResourceCollection value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LogSearchRuleData.DeserializeLogSearchRuleData(document.RootElement); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -134,7 +186,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules/", false); uri.AppendPath(ruleName, true); @@ -145,14 +197,14 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Gets an Log Search rule. + /// Retrieve an scheduled query rule definition. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the rule. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -164,26 +216,26 @@ public async Task> GetAsync(string subscriptionId, s { case 200: { - LogSearchRuleData value = default; + ScheduledQueryRuleResourceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LogSearchRuleData.DeserializeLogSearchRuleData(document.RootElement); + value = ScheduledQueryRuleResourceData.DeserializeScheduledQueryRuleResourceData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((LogSearchRuleData)null, message.Response); + return Response.FromValue((ScheduledQueryRuleResourceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets an Log Search rule. + /// Retrieve an scheduled query rule definition. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the rule. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -195,19 +247,107 @@ public Response Get(string subscriptionId, string resourceGro { case 200: { - LogSearchRuleData value = default; + ScheduledQueryRuleResourceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LogSearchRuleData.DeserializeLogSearchRuleData(document.RootElement); + value = ScheduledQueryRuleResourceData.DeserializeScheduledQueryRuleResourceData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((LogSearchRuleData)null, message.Response); + return Response.FromValue((ScheduledQueryRuleResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string ruleName, ScheduledQueryRuleResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules/", false); + uri.AppendPath(ruleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates or updates a scheduled query rule. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the rule. + /// The parameters of the rule to create or update. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string ruleName, ScheduledQueryRuleResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, ruleName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + ScheduledQueryRuleResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ScheduledQueryRuleResourceData.DeserializeScheduledQueryRuleResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string ruleName, LogSearchRulePatch patch) + /// Creates or updates a scheduled query rule. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the rule. + /// The parameters of the rule to create or update. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string ruleName, ScheduledQueryRuleResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, ruleName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + ScheduledQueryRuleResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ScheduledQueryRuleResourceData.DeserializeScheduledQueryRuleResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string ruleName, ScheduledQueryRuleResourcePatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -216,7 +356,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules/", false); uri.AppendPath(ruleName, true); @@ -231,7 +371,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG return message; } - /// Update log search Rule. + /// Update a scheduled query rule. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the rule. @@ -239,7 +379,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string ruleName, LogSearchRulePatch patch, CancellationToken cancellationToken = default) + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string ruleName, ScheduledQueryRuleResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -252,9 +392,9 @@ public async Task> UpdateAsync(string subscriptionId { case 200: { - LogSearchRuleData value = default; + ScheduledQueryRuleResourceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LogSearchRuleData.DeserializeLogSearchRuleData(document.RootElement); + value = ScheduledQueryRuleResourceData.DeserializeScheduledQueryRuleResourceData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -262,7 +402,7 @@ public async Task> UpdateAsync(string subscriptionId } } - /// Update log search Rule. + /// Update a scheduled query rule. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the rule. @@ -270,7 +410,7 @@ public async Task> UpdateAsync(string subscriptionId /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string ruleName, LogSearchRulePatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string ruleName, ScheduledQueryRuleResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -283,9 +423,9 @@ public Response Update(string subscriptionId, string resource { case 200: { - LogSearchRuleData value = default; + ScheduledQueryRuleResourceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LogSearchRuleData.DeserializeLogSearchRuleData(document.RootElement); + value = ScheduledQueryRuleResourceData.DeserializeScheduledQueryRuleResourceData(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -302,7 +442,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); + uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules/", false); uri.AppendPath(ruleName, true); @@ -313,7 +453,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Deletes a Log Search rule. + /// Deletes a scheduled query rule. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the rule. @@ -338,7 +478,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Deletes a Log Search rule. + /// Deletes a scheduled query rule. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. /// The name of the rule. @@ -363,46 +503,40 @@ public Response Delete(string subscriptionId, string resourceGroupName, string r } } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string filter) + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List the Log Search rules within a subscription group. + /// Retrieve a scheduled query rule definitions in a subscription. + /// The URL to the next page of results. /// The ID of the target subscription. - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListBySubscriptionRequest(subscriptionId, filter); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - LogSearchRuleResourceCollection value = default; + Models.ScheduledQueryRuleResourceCollection value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LogSearchRuleResourceCollection.DeserializeLogSearchRuleResourceCollection(document.RootElement); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -410,25 +544,26 @@ public async Task> ListBySubscriptionA } } - /// List the Log Search rules within a subscription group. + /// Retrieve a scheduled query rule definitions in a subscription. + /// The URL to the next page of results. /// The ID of the target subscription. - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// is null. + /// or is null. /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, string filter = null, CancellationToken cancellationToken = default) + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListBySubscriptionRequest(subscriptionId, filter); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - LogSearchRuleResourceCollection value = default; + Models.ScheduledQueryRuleResourceCollection value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LogSearchRuleResourceCollection.DeserializeLogSearchRuleResourceCollection(document.RootElement); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -436,50 +571,42 @@ public Response ListBySubscription(string subsc } } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter) + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourcegroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Insights/scheduledQueryRules", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (filter != null) - { - uri.AppendQuery("$filter", filter, true); - } + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// List the Log Search rules within a resource group. + /// Retrieve scheduled query rule definitions in a resource group. + /// The URL to the next page of results. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// or is null. + /// , or is null. /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - LogSearchRuleResourceCollection value = default; + Models.ScheduledQueryRuleResourceCollection value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LogSearchRuleResourceCollection.DeserializeLogSearchRuleResourceCollection(document.RootElement); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -487,27 +614,28 @@ public async Task> ListByResourceGroup } } - /// List the Log Search rules within a resource group. + /// Retrieve scheduled query rule definitions in a resource group. + /// The URL to the next page of results. /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// or is null. + /// , or is null. /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, string filter = null, CancellationToken cancellationToken = default) + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter); + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - LogSearchRuleResourceCollection value = default; + Models.ScheduledQueryRuleResourceCollection value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LogSearchRuleResourceCollection.DeserializeLogSearchRuleResourceCollection(document.RootElement); + value = Models.ScheduledQueryRuleResourceCollection.DeserializeScheduledQueryRuleResourceCollection(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResource.cs similarity index 61% rename from sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleResource.cs rename to sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResource.cs index 5ae46008b003..03bc2b97b607 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResource.cs @@ -20,46 +20,46 @@ namespace Azure.ResourceManager.Monitor { /// - /// A Class representing a LogSearchRule along with the instance operations that can be performed on it. - /// If you have a you can construct a - /// from an instance of using the GetLogSearchRuleResource method. - /// Otherwise you can get one from its parent resource using the GetLogSearchRule method. + /// A Class representing a ScheduledQueryRuleResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetScheduledQueryRuleResource method. + /// Otherwise you can get one from its parent resource using the GetScheduledQueryRuleResource method. /// - public partial class LogSearchRuleResource : ArmResource + public partial class ScheduledQueryRuleResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string ruleName) { - var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _logSearchRuleScheduledQueryRulesClientDiagnostics; - private readonly ScheduledQueryRulesRestOperations _logSearchRuleScheduledQueryRulesRestClient; - private readonly LogSearchRuleData _data; + private readonly ClientDiagnostics _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics; + private readonly ScheduledQueryRulesRestOperations _scheduledQueryRuleResourceScheduledQueryRulesRestClient; + private readonly ScheduledQueryRuleResourceData _data; - /// Initializes a new instance of the class for mocking. - protected LogSearchRuleResource() + /// Initializes a new instance of the class for mocking. + protected ScheduledQueryRuleResource() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal LogSearchRuleResource(ArmClient client, LogSearchRuleData data) : this(client, data.Id) + internal ScheduledQueryRuleResource(ArmClient client, ScheduledQueryRuleResourceData data) : this(client, data.Id) { HasData = true; _data = data; } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the resource that is the target of operations. - internal LogSearchRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ScheduledQueryRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _logSearchRuleScheduledQueryRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Monitor", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string logSearchRuleScheduledQueryRulesApiVersion); - _logSearchRuleScheduledQueryRulesRestClient = new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, logSearchRuleScheduledQueryRulesApiVersion); + _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Monitor", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string scheduledQueryRuleResourceScheduledQueryRulesApiVersion); + _scheduledQueryRuleResourceScheduledQueryRulesRestClient = new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, scheduledQueryRuleResourceScheduledQueryRulesApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -73,7 +73,7 @@ internal LogSearchRuleResource(ArmClient client, ResourceIdentifier id) : base(c /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual LogSearchRuleData Data + public virtual ScheduledQueryRuleResourceData Data { get { @@ -90,21 +90,21 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets an Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Retrieve an scheduled query rule definition. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.Get"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.Get"); scope.Start(); try { - var response = await _logSearchRuleScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new LogSearchRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ScheduledQueryRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -114,21 +114,21 @@ public virtual async Task> GetAsync(Cancellation } /// - /// Gets an Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Retrieve an scheduled query rule definition. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.Get"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.Get"); scope.Start(); try { - var response = _logSearchRuleScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new LogSearchRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ScheduledQueryRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -138,19 +138,19 @@ public virtual Response Get(CancellationToken cancellatio } /// - /// Deletes a Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Deletes a scheduled query rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Delete /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.Delete"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.Delete"); scope.Start(); try { - var response = await _logSearchRuleScheduledQueryRulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); var operation = new MonitorArmOperation(response); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); @@ -164,19 +164,19 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes a Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Deletes a scheduled query rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Delete /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.Delete"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.Delete"); scope.Start(); try { - var response = _logSearchRuleScheduledQueryRulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); var operation = new MonitorArmOperation(response); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); @@ -190,23 +190,23 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Update log search Rule. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Update a scheduled query rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Update /// /// The parameters of the rule to update. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(LogSearchRulePatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(ScheduledQueryRuleResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.Update"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.Update"); scope.Start(); try { - var response = await _logSearchRuleScheduledQueryRulesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new LogSearchRuleResource(Client, response.Value), response.GetRawResponse()); + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ScheduledQueryRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -216,23 +216,23 @@ public virtual async Task> UpdateAsync(LogSearch } /// - /// Update log search Rule. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Update a scheduled query rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Update /// /// The parameters of the rule to update. /// The cancellation token to use. /// is null. - public virtual Response Update(LogSearchRulePatch patch, CancellationToken cancellationToken = default) + public virtual Response Update(ScheduledQueryRuleResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.Update"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.Update"); scope.Start(); try { - var response = _logSearchRuleScheduledQueryRulesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - return Response.FromValue(new LogSearchRuleResource(Client, response.Value), response.GetRawResponse()); + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + return Response.FromValue(new ScheduledQueryRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -243,27 +243,27 @@ public virtual Response Update(LogSearchRulePatch patch, /// /// Add a tag to the current resource. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The key for the tag. /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.AddTag"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.AddTag"); scope.Start(); try { var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _logSearchRuleScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new LogSearchRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ScheduledQueryRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) { @@ -274,27 +274,27 @@ public virtual async Task> AddTagAsync(string ke /// /// Add a tag to the current resource. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The key for the tag. /// The value for the tag. /// The cancellation token to use. /// or is null. - public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.AddTag"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.AddTag"); scope.Start(); try { var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _logSearchRuleScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new LogSearchRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ScheduledQueryRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) { @@ -305,17 +305,17 @@ public virtual Response AddTag(string key, string value, /// /// Replace the tags on the resource with the given set. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.SetTags"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.SetTags"); scope.Start(); try { @@ -323,8 +323,8 @@ public virtual async Task> SetTagsAsync(IDiction var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.ReplaceWith(tags); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _logSearchRuleScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new LogSearchRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ScheduledQueryRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) { @@ -335,17 +335,17 @@ public virtual async Task> SetTagsAsync(IDiction /// /// Replace the tags on the resource with the given set. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The set of tags to use as replacement. /// The cancellation token to use. /// is null. - public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.SetTags"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.SetTags"); scope.Start(); try { @@ -353,8 +353,8 @@ public virtual Response SetTags(IDictionary SetTags(IDictionary /// Removes a tag by key from the resource. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.RemoveTag"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.RemoveTag"); scope.Start(); try { var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _logSearchRuleScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new LogSearchRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ScheduledQueryRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) { @@ -394,25 +394,25 @@ public virtual async Task> RemoveTagAsync(string /// /// Removes a tag by key from the resource. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The key for the tag. /// The cancellation token to use. /// is null. - public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) { Argument.AssertNotNull(key, nameof(key)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleResource.RemoveTag"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResource.RemoveTag"); scope.Start(); try { var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _logSearchRuleScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new LogSearchRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + var originalResponse = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ScheduledQueryRuleResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } catch (Exception e) { diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleCollection.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResourceCollection.cs similarity index 52% rename from sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleCollection.cs rename to sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResourceCollection.cs index de460fa4eea2..3b644ce5a68e 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/LogSearchRuleCollection.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResourceCollection.cs @@ -21,28 +21,28 @@ namespace Azure.ResourceManager.Monitor { /// - /// A class representing a collection of and their operations. - /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetLogSearchRules method from an instance of . + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetScheduledQueryRuleResources method from an instance of . /// - public partial class LogSearchRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class ScheduledQueryRuleResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _logSearchRuleScheduledQueryRulesClientDiagnostics; - private readonly ScheduledQueryRulesRestOperations _logSearchRuleScheduledQueryRulesRestClient; + private readonly ClientDiagnostics _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics; + private readonly ScheduledQueryRulesRestOperations _scheduledQueryRuleResourceScheduledQueryRulesRestClient; - /// Initializes a new instance of the class for mocking. - protected LogSearchRuleCollection() + /// Initializes a new instance of the class for mocking. + protected ScheduledQueryRuleResourceCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal LogSearchRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal ScheduledQueryRuleResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _logSearchRuleScheduledQueryRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Monitor", LogSearchRuleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(LogSearchRuleResource.ResourceType, out string logSearchRuleScheduledQueryRulesApiVersion); - _logSearchRuleScheduledQueryRulesRestClient = new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, logSearchRuleScheduledQueryRulesApiVersion); + _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Monitor", ScheduledQueryRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ScheduledQueryRuleResource.ResourceType, out string scheduledQueryRuleResourceScheduledQueryRulesApiVersion); + _scheduledQueryRuleResourceScheduledQueryRulesRestClient = new ScheduledQueryRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, scheduledQueryRuleResourceScheduledQueryRulesApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -55,8 +55,8 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Creates or updates an log search rule. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Creates or updates a scheduled query rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_CreateOrUpdate /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. @@ -65,17 +65,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string ruleName, LogSearchRuleData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string ruleName, ScheduledQueryRuleResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.CreateOrUpdate"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _logSearchRuleScheduledQueryRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, data, cancellationToken).ConfigureAwait(false); - var operation = new MonitorArmOperation(Response.FromValue(new LogSearchRuleResource(Client, response), response.GetRawResponse())); + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, data, cancellationToken).ConfigureAwait(false); + var operation = new MonitorArmOperation(Response.FromValue(new ScheduledQueryRuleResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -88,8 +88,8 @@ public virtual async Task> CreateOrUpdateAsy } /// - /// Creates or updates an log search rule. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Creates or updates a scheduled query rule. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_CreateOrUpdate /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. @@ -98,17 +98,17 @@ public virtual async Task> CreateOrUpdateAsy /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string ruleName, LogSearchRuleData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string ruleName, ScheduledQueryRuleResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.CreateOrUpdate"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _logSearchRuleScheduledQueryRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, ruleName, data, cancellationToken); - var operation = new MonitorArmOperation(Response.FromValue(new LogSearchRuleResource(Client, response), response.GetRawResponse())); + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, ruleName, data, cancellationToken); + var operation = new MonitorArmOperation(Response.FromValue(new ScheduledQueryRuleResource(Client, response), response.GetRawResponse())); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -121,26 +121,26 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wait } /// - /// Gets an Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Retrieve an scheduled query rule definition. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The name of the rule. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual async Task> GetAsync(string ruleName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.Get"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.Get"); scope.Start(); try { - var response = await _logSearchRuleScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken).ConfigureAwait(false); + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new LogSearchRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ScheduledQueryRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -150,26 +150,26 @@ public virtual async Task> GetAsync(string ruleN } /// - /// Gets an Log Search rule - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Retrieve an scheduled query rule definition. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The name of the rule. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. - public virtual Response Get(string ruleName, CancellationToken cancellationToken = default) + public virtual Response Get(string ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.Get"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.Get"); scope.Start(); try { - var response = _logSearchRuleScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken); + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new LogSearchRuleResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new ScheduledQueryRuleResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -179,23 +179,22 @@ public virtual Response Get(string ruleName, Cancellation } /// - /// List the Log Search rules within a resource group. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules + /// Retrieve scheduled query rule definitions in a resource group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules /// Operation Id: ScheduledQueryRules_ListByResourceGroup /// - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - async Task> FirstPageFunc(int? pageSizeHint) + async Task> FirstPageFunc(int? pageSizeHint) { - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.GetAll"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.GetAll"); scope.Start(); try { - var response = await _logSearchRuleScheduledQueryRulesRestClient.ListByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, filter, cancellationToken: cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value.Select(value => new LogSearchRuleResource(Client, value)), null, response.GetRawResponse()); + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.ListByResourceGroupAsync(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -203,27 +202,56 @@ async Task> FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null); + async Task> NextPageFunc(string nextLink, int? pageSizeHint) + { + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.GetAll"); + scope.Start(); + try + { + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.ListByResourceGroupNextPageAsync(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); } /// - /// List the Log Search rules within a resource group. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules + /// Retrieve scheduled query rule definitions in a resource group. + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules /// Operation Id: ScheduledQueryRules_ListByResourceGroup /// - /// The filter to apply on the operation. For more information please see https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - Page FirstPageFunc(int? pageSizeHint) + Page FirstPageFunc(int? pageSizeHint) + { + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.GetAll"); + scope.Start(); + try + { + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.ListByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + Page NextPageFunc(string nextLink, int? pageSizeHint) { - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.GetAll"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.GetAll"); scope.Start(); try { - var response = _logSearchRuleScheduledQueryRulesRestClient.ListByResourceGroup(Id.SubscriptionId, Id.ResourceGroupName, filter, cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value.Select(value => new LogSearchRuleResource(Client, value)), null, response.GetRawResponse()); + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.ListByResourceGroupNextPage(nextLink, Id.SubscriptionId, Id.ResourceGroupName, cancellationToken: cancellationToken); + return Page.FromValues(response.Value.Value.Select(value => new ScheduledQueryRuleResource(Client, value)), response.Value.NextLink, response.GetRawResponse()); } catch (Exception e) { @@ -231,12 +259,12 @@ Page FirstPageFunc(int? pageSizeHint) throw; } } - return PageableHelpers.CreateEnumerable(FirstPageFunc, null); + return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); } /// /// Checks to see if the resource exists in azure. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The name of the rule. @@ -247,11 +275,11 @@ public virtual async Task> ExistsAsync(string ruleName, Cancellat { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.Exists"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.Exists"); scope.Start(); try { - var response = await _logSearchRuleScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _scheduledQueryRuleResourceScheduledQueryRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -263,7 +291,7 @@ public virtual async Task> ExistsAsync(string ruleName, Cancellat /// /// Checks to see if the resource exists in azure. - /// Request Path: /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} + /// Request Path: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName} /// Operation Id: ScheduledQueryRules_Get /// /// The name of the rule. @@ -274,11 +302,11 @@ public virtual Response Exists(string ruleName, CancellationToken cancella { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _logSearchRuleScheduledQueryRulesClientDiagnostics.CreateScope("LogSearchRuleCollection.Exists"); + using var scope = _scheduledQueryRuleResourceScheduledQueryRulesClientDiagnostics.CreateScope("ScheduledQueryRuleResourceCollection.Exists"); scope.Start(); try { - var response = _logSearchRuleScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken); + var response = _scheduledQueryRuleResourceScheduledQueryRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, ruleName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -288,7 +316,7 @@ public virtual Response Exists(string ruleName, CancellationToken cancella } } - IEnumerator IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return GetAll().GetEnumerator(); } @@ -298,7 +326,7 @@ IEnumerator IEnumerable.GetEnumerator() return GetAll().GetEnumerator(); } - IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) { return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); } diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResourceData.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResourceData.cs new file mode 100644 index 000000000000..f177d164b2b7 --- /dev/null +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/ScheduledQueryRuleResourceData.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Monitor.Models; + +namespace Azure.ResourceManager.Monitor +{ + /// A class representing the ScheduledQueryRuleResource data model. + public partial class ScheduledQueryRuleResourceData : TrackedResourceData + { + /// Initializes a new instance of ScheduledQueryRuleResourceData. + /// The location. + public ScheduledQueryRuleResourceData(AzureLocation location) : base(location) + { + Scopes = new ChangeTrackingList(); + TargetResourceTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of ScheduledQueryRuleResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Indicates the type of scheduled query rule. The default is LogAlert. + /// 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. + /// The api-version used when creating this alert rule. + /// True if alert rule is legacy Log Analytic rule. + /// The description of the scheduled query rule. + /// The display name of the alert rule. + /// Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert. + /// The flag which indicates whether this scheduled query rule is enabled. Value should be true or false. + /// The list of resource id's that this scheduled query rule is scoped to. + /// How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert. + /// The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + /// If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + /// List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + /// The rule criteria that defines the conditions of the scheduled query rule. + /// Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules of the kind LogAlert. + /// Actions to invoke when the alert fires. + /// The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's storage. The default is false. + /// The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + /// The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for rules of the kind LogAlert. + /// The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + internal ScheduledQueryRuleResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, MonitorKind? kind, ETag? etag, string createdWithApiVersion, bool? isLegacyLogAnalyticsRule, string description, string displayName, AlertSeverity? severity, bool? enabled, IList scopes, TimeSpan? evaluationFrequency, TimeSpan? windowSize, TimeSpan? overrideQueryTimeRange, IList targetResourceTypes, ScheduledQueryRuleCriteria criteria, TimeSpan? muteActionsDuration, Actions actions, bool? isWorkspaceAlertsStorageConfigured, bool? checkWorkspaceAlertsStorageConfigured, bool? skipQueryValidation, bool? autoMitigate) : base(id, name, resourceType, systemData, tags, location) + { + Kind = kind; + ETag = etag; + CreatedWithApiVersion = createdWithApiVersion; + IsLegacyLogAnalyticsRule = isLegacyLogAnalyticsRule; + Description = description; + DisplayName = displayName; + Severity = severity; + Enabled = enabled; + Scopes = scopes; + EvaluationFrequency = evaluationFrequency; + WindowSize = windowSize; + OverrideQueryTimeRange = overrideQueryTimeRange; + TargetResourceTypes = targetResourceTypes; + Criteria = criteria; + MuteActionsDuration = muteActionsDuration; + Actions = actions; + IsWorkspaceAlertsStorageConfigured = isWorkspaceAlertsStorageConfigured; + CheckWorkspaceAlertsStorageConfigured = checkWorkspaceAlertsStorageConfigured; + SkipQueryValidation = skipQueryValidation; + AutoMitigate = autoMitigate; + } + + /// Indicates the type of scheduled query rule. The default is LogAlert. + public MonitorKind? Kind { get; set; } + /// 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. + public ETag? ETag { get; } + /// The api-version used when creating this alert rule. + public string CreatedWithApiVersion { get; } + /// True if alert rule is legacy Log Analytic rule. + public bool? IsLegacyLogAnalyticsRule { get; } + /// The description of the scheduled query rule. + public string Description { get; set; } + /// The display name of the alert rule. + public string DisplayName { get; set; } + /// Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules of the kind LogAlert. + public AlertSeverity? Severity { get; set; } + /// The flag which indicates whether this scheduled query rule is enabled. Value should be true or false. + public bool? Enabled { get; set; } + /// The list of resource id's that this scheduled query rule is scoped to. + public IList Scopes { get; } + /// How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert. + public TimeSpan? EvaluationFrequency { get; set; } + /// The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required only for rules of the kind LogAlert. + public TimeSpan? WindowSize { get; set; } + /// If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + public TimeSpan? OverrideQueryTimeRange { get; set; } + /// List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + public IList TargetResourceTypes { get; } + /// The rule criteria that defines the conditions of the scheduled query rule. + internal ScheduledQueryRuleCriteria Criteria { get; set; } + /// A list of conditions to evaluate against the specified scopes. + public IList CriteriaAllOf + { + get + { + if (Criteria is null) + Criteria = new ScheduledQueryRuleCriteria(); + return Criteria.AllOf; + } + } + + /// Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules of the kind LogAlert. + public TimeSpan? MuteActionsDuration { get; set; } + /// Actions to invoke when the alert fires. + public Actions Actions { get; set; } + /// The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's storage. The default is false. + public bool? IsWorkspaceAlertsStorageConfigured { get; } + /// The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind LogAlert. + public bool? CheckWorkspaceAlertsStorageConfigured { get; set; } + /// The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for rules of the kind LogAlert. + public bool? SkipQueryValidation { get; set; } + /// The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for rules of the kind LogAlert. + public bool? AutoMitigate { get; set; } + } +} diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md b/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md index 52bd4ecdcf48..116edba732d0 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md @@ -7,7 +7,7 @@ Run `dotnet build /t:GenerateCode` to generate code. azure-arm: true library-name: Monitor namespace: Azure.ResourceManager.Monitor -require: https://github.com/Azure/azure-rest-api-specs/blob/d1b0569d8adbd342a1111d6a69764d099f5f717c/specification/monitor/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true