Skip to content

Commit a83f294

Browse files
authored
Generate .NET SDK for Microsoft.Insights metric alerts 2024-03-01-preview (#53566)
1 parent 2f78d77 commit a83f294

File tree

58 files changed

+2778
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2778
-452
lines changed

sdk/monitor/Azure.ResourceManager.Monitor/CHANGELOG.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
# Release History
22

3-
## 1.4.0-beta.4 (Unreleased)
3+
## 1.4.0-beta.4 (2025-11-18)
44

55
### Features Added
66

7-
### Breaking Changes
8-
9-
### Bugs Fixed
10-
11-
### Other Changes
7+
- Updated azure monitor metric alert APIs to version `2024-03-01-preview`.
128

139
## 1.4.0-beta.3 (2025-03-14)
1410

1511
### Features Added
1612

17-
- Updated azure monitor pipeline group APIs to version `2024-10-01-preview`
13+
- Updated azure monitor pipeline group APIs to version `2024-10-01-preview`.
1814

1915
## 1.4.0-beta.2 (2025-02-14)
2016

sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.net8.0.cs

Lines changed: 77 additions & 2 deletions
Large diffs are not rendered by default.

sdk/monitor/Azure.ResourceManager.Monitor/api/Azure.ResourceManager.Monitor.netstandard2.0.cs

Lines changed: 77 additions & 2 deletions
Large diffs are not rendered by default.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.ComponentModel;
9+
using Azure.Core;
10+
using Azure.ResourceManager.Models;
11+
12+
namespace Azure.ResourceManager.Monitor.Models
13+
{
14+
/// <summary> Model factory for models. </summary>
15+
public static partial class ArmMonitorModelFactory
16+
{
17+
/// <summary> Initializes a new instance of <see cref="Monitor.MetricAlertData"/>. </summary>
18+
/// <param name="id"> The id. </param>
19+
/// <param name="name"> The name. </param>
20+
/// <param name="resourceType"> The resourceType. </param>
21+
/// <param name="systemData"> The systemData. </param>
22+
/// <param name="tags"> The tags. </param>
23+
/// <param name="location"> The location. </param>
24+
/// <param name="description"> the description of the metric alert that will be included in the alert email. </param>
25+
/// <param name="severity"> Alert severity {0, 1, 2, 3, 4}. </param>
26+
/// <param name="isEnabled"> the flag that indicates whether the metric alert is enabled. </param>
27+
/// <param name="scopes"> the list of resource id's that this metric alert is scoped to. </param>
28+
/// <param name="evaluationFrequency"> how often the metric alert is evaluated represented in ISO 8601 duration format. </param>
29+
/// <param name="windowSize"> the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. </param>
30+
/// <param name="targetResourceType"> the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. </param>
31+
/// <param name="targetResourceRegion"> the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, resource group, or more than one resource. </param>
32+
/// <param name="criteria">
33+
/// defines the specific alert criteria information.
34+
/// Please note <see cref="MetricAlertCriteria"/> 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.
35+
/// The available derived classes include <see cref="MetricAlertMultipleResourceMultipleMetricCriteria"/>, <see cref="MetricAlertSingleResourceMultipleMetricCriteria"/> and <see cref="WebtestLocationAvailabilityCriteria"/>.
36+
/// </param>
37+
/// <param name="isAutoMitigateEnabled"> the flag that indicates whether the alert should be auto resolved or not. The default is true. </param>
38+
/// <param name="actions"> the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. </param>
39+
/// <param name="lastUpdatedOn"> Last time the rule was updated in ISO8601 format. </param>
40+
/// <param name="isMigrated"> the value indicating whether this alert rule is migrated. </param>
41+
/// <returns> A new <see cref="Monitor.MetricAlertData"/> instance for mocking. </returns>
42+
[EditorBrowsable(EditorBrowsableState.Never)]
43+
public static MetricAlertData MetricAlertData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary<string, string> tags, AzureLocation location, string description, int severity, bool isEnabled, IEnumerable<string> scopes, TimeSpan evaluationFrequency, TimeSpan windowSize, ResourceType? targetResourceType, AzureLocation? targetResourceRegion, MetricAlertCriteria criteria, bool? isAutoMitigateEnabled, IEnumerable<MetricAlertAction> actions, DateTimeOffset? lastUpdatedOn, bool? isMigrated)
44+
=> MetricAlertData(id, name, resourceType, systemData, tags, location, description, severity, isEnabled, scopes, evaluationFrequency, windowSize, targetResourceType, targetResourceRegion, criteria, isAutoMitigateEnabled, null, actions, lastUpdatedOn, isMigrated, null, null, null);
45+
}
46+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.ComponentModel;
9+
using Azure.Core;
10+
using Azure.ResourceManager.Monitor.Models;
11+
12+
namespace Azure.ResourceManager.Monitor
13+
{
14+
/// <summary>
15+
/// A class representing the MetricAlert data model.
16+
/// </summary>
17+
public partial class MetricAlertData
18+
{
19+
/// <summary> Initializes a new instance of <see cref="MetricAlertData"/>. </summary>
20+
/// <param name="location"> The location. </param>
21+
/// <param name="severity"> Alert severity {0, 1, 2, 3, 4}. </param>
22+
/// <param name="isEnabled"> The flag that indicates whether the metric alert is enabled. </param>
23+
/// <param name="scopes"> The list of resource id's that this metric alert is scoped to. </param>
24+
/// <param name="evaluationFrequency"> How often the metric alert is evaluated represented in ISO 8601 duration format. </param>
25+
/// <param name="windowSize"> The period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. </param>
26+
/// <param name="criteria"> Defines the specific alert criteria information. </param>
27+
/// <exception cref="ArgumentNullException"> <paramref name="scopes"/> is null. </exception>
28+
[EditorBrowsable(EditorBrowsableState.Never)]
29+
public MetricAlertData(AzureLocation location, int severity, bool isEnabled, IEnumerable<string> scopes, TimeSpan evaluationFrequency, TimeSpan windowSize, MetricAlertCriteria criteria)
30+
: this(location, severity, isEnabled, scopes, evaluationFrequency, criteria)
31+
{
32+
WindowSize = GetWindowSizeOrDefault(windowSize);
33+
}
34+
35+
/// <summary> the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. </summary>
36+
[EditorBrowsable(EditorBrowsableState.Never)]
37+
public TimeSpan WindowSize { get => GetWindowSizeOrDefault(); set => MonitorWindowSize = value; }
38+
39+
private TimeSpan GetWindowSizeOrDefault(TimeSpan defaultValue = default)
40+
{
41+
return MonitorWindowSize ?? defaultValue;
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)