diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/DynamicMetricCriteria.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DynamicMetricCriteria.cs new file mode 100644 index 000000000000..298bcbb4583f --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DynamicMetricCriteria.cs @@ -0,0 +1,127 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Criterion for dynamic threshold. + /// + [Newtonsoft.Json.JsonObject("DynamicThresholdCriterion")] + public partial class DynamicMetricCriteria : MultiMetricCriteria + { + /// + /// Initializes a new instance of the DynamicMetricCriteria class. + /// + public DynamicMetricCriteria() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DynamicMetricCriteria class. + /// + /// Name of the criteria. + /// Name of the metric. + /// the criteria time aggregation + /// types. + /// The operator used to compare the + /// metric value against the threshold. + /// The extent of deviation required to + /// trigger an alert. This will affect how tight the threshold is to + /// the metric series pattern. + /// The minimum number of violations + /// required within the selected lookback time window required to raise + /// an alert. + /// Unmatched properties from the + /// message are deserialized this collection + /// Namespace of the metric. + /// List of dimension conditions. + /// Use this option to set the date from + /// which to start learning the metric historical data and calculate + /// the dynamic thresholds (in ISO8601 format) + public DynamicMetricCriteria(string name, string metricName, object timeAggregation, object operatorProperty, object alertSensitivity, DynamicThresholdFailingPeriods failingPeriods, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList), System.DateTime? ignoreDataBefore = default(System.DateTime?)) + : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions) + { + OperatorProperty = operatorProperty; + AlertSensitivity = alertSensitivity; + FailingPeriods = failingPeriods; + IgnoreDataBefore = ignoreDataBefore; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the operator used to compare the metric value against + /// the threshold. + /// + [JsonProperty(PropertyName = "operator")] + public object OperatorProperty { get; set; } + + /// + /// Gets or sets the extent of deviation required to trigger an alert. + /// This will affect how tight the threshold is to the metric series + /// pattern. + /// + [JsonProperty(PropertyName = "alertSensitivity")] + public object AlertSensitivity { get; set; } + + /// + /// Gets or sets the minimum number of violations required within the + /// selected lookback time window required to raise an alert. + /// + [JsonProperty(PropertyName = "failingPeriods")] + public DynamicThresholdFailingPeriods FailingPeriods { get; set; } + + /// + /// Gets or sets use this option to set the date from which to start + /// learning the metric historical data and calculate the dynamic + /// thresholds (in ISO8601 format) + /// + [JsonProperty(PropertyName = "ignoreDataBefore")] + public System.DateTime? IgnoreDataBefore { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + if (OperatorProperty == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); + } + if (AlertSensitivity == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AlertSensitivity"); + } + if (FailingPeriods == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "FailingPeriods"); + } + if (FailingPeriods != null) + { + FailingPeriods.Validate(); + } + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/DynamicThresholdFailingPeriods.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DynamicThresholdFailingPeriods.cs new file mode 100644 index 000000000000..013569f048c5 --- /dev/null +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/DynamicThresholdFailingPeriods.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.Monitor.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The minimum number of violations required within the selected lookback + /// time window required to raise an alert. + /// + public partial class DynamicThresholdFailingPeriods + { + /// + /// Initializes a new instance of the DynamicThresholdFailingPeriods + /// class. + /// + public DynamicThresholdFailingPeriods() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DynamicThresholdFailingPeriods + /// class. + /// + /// The number of aggregated + /// lookback points. The lookback time window is calculated based on + /// the aggregation granularity (windowSize) and the selected number of + /// aggregated points. + /// The number of violations to + /// trigger an alert. Should be smaller or equal to + /// numberOfEvaluationPeriods. + public DynamicThresholdFailingPeriods(double numberOfEvaluationPeriods, double minFailingPeriodsToAlert) + { + NumberOfEvaluationPeriods = numberOfEvaluationPeriods; + MinFailingPeriodsToAlert = minFailingPeriodsToAlert; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the number of aggregated lookback points. The lookback + /// time window is calculated based on the aggregation granularity + /// (windowSize) and the selected number of aggregated points. + /// + [JsonProperty(PropertyName = "numberOfEvaluationPeriods")] + public double NumberOfEvaluationPeriods { get; set; } + + /// + /// Gets or sets the number of violations to trigger an alert. Should + /// be smaller or equal to numberOfEvaluationPeriods. + /// + [JsonProperty(PropertyName = "minFailingPeriodsToAlert")] + public double MinFailingPeriodsToAlert { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogToMetricAction.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogToMetricAction.cs index 0f81238fe0e5..449398da9c62 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogToMetricAction.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/LogToMetricAction.cs @@ -12,6 +12,8 @@ namespace Microsoft.Azure.Management.Monitor.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -32,8 +34,8 @@ public LogToMetricAction() /// /// Initializes a new instance of the LogToMetricAction class. /// - /// Severity of the alert - public LogToMetricAction(Criteria criteria) + /// Criteria of Metric + public LogToMetricAction(IList criteria) { Criteria = criteria; CustomInit(); @@ -45,10 +47,10 @@ public LogToMetricAction(Criteria criteria) partial void CustomInit(); /// - /// Gets or sets severity of the alert + /// Gets or sets criteria of Metric /// [JsonProperty(PropertyName = "criteria")] - public Criteria Criteria { get; set; } + public IList Criteria { get; set; } /// /// Validate the object. @@ -64,7 +66,13 @@ public virtual void Validate() } if (Criteria != null) { - Criteria.Validate(); + foreach (var element in Criteria) + { + if (element != null) + { + element.Validate(); + } + } } } } diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricCriteria.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricCriteria.cs index 3a2211a85f0e..eac6ab2bad92 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricCriteria.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MetricCriteria.cs @@ -35,25 +35,20 @@ public MetricCriteria() /// /// Name of the criteria. /// Name of the metric. - /// the criteria operator. /// the criteria time aggregation /// types. + /// the criteria operator. /// the criteria threshold value that activates /// the alert. /// Unmatched properties from the /// message are deserialized this collection /// Namespace of the metric. /// List of dimension conditions. - public MetricCriteria(string name, string metricName, object operatorProperty, object timeAggregation, double threshold, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList)) - : base(additionalProperties) + public MetricCriteria(string name, string metricName, object timeAggregation, object operatorProperty, double threshold, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList)) + : base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions) { - Name = name; - MetricName = metricName; - MetricNamespace = metricNamespace; OperatorProperty = operatorProperty; - TimeAggregation = timeAggregation; Threshold = threshold; - Dimensions = dimensions; CustomInit(); } @@ -62,82 +57,31 @@ public MetricCriteria() /// partial void CustomInit(); - /// - /// Gets or sets name of the criteria. - /// - [JsonProperty(PropertyName = "name")] - public string Name { get; set; } - - /// - /// Gets or sets name of the metric. - /// - [JsonProperty(PropertyName = "metricName")] - public string MetricName { get; set; } - - /// - /// Gets or sets namespace of the metric. - /// - [JsonProperty(PropertyName = "metricNamespace")] - public string MetricNamespace { get; set; } - /// /// Gets or sets the criteria operator. /// [JsonProperty(PropertyName = "operator")] public object OperatorProperty { get; set; } - /// - /// Gets or sets the criteria time aggregation types. - /// - [JsonProperty(PropertyName = "timeAggregation")] - public object TimeAggregation { get; set; } - /// /// Gets or sets the criteria threshold value that activates the alert. /// [JsonProperty(PropertyName = "threshold")] public double Threshold { get; set; } - /// - /// Gets or sets list of dimension conditions. - /// - [JsonProperty(PropertyName = "dimensions")] - public IList Dimensions { get; set; } - /// /// Validate the object. /// /// /// Thrown if validation fails /// - public virtual void Validate() + public override void Validate() { - if (Name == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Name"); - } - if (MetricName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); - } + base.Validate(); if (OperatorProperty == null) { throw new ValidationException(ValidationRules.CannotBeNull, "OperatorProperty"); } - if (TimeAggregation == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "TimeAggregation"); - } - if (Dimensions != null) - { - foreach (var element in Dimensions) - { - if (element != null) - { - element.Validate(); - } - } - } } } } diff --git a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MultiMetricCriteria.cs b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MultiMetricCriteria.cs index a60a43c37f4e..9d748898780a 100644 --- a/src/SDKs/Monitor/Management.Monitor/Generated/Models/MultiMetricCriteria.cs +++ b/src/SDKs/Monitor/Management.Monitor/Generated/Models/MultiMetricCriteria.cs @@ -10,13 +10,14 @@ namespace Microsoft.Azure.Management.Monitor.Models { + using Microsoft.Rest; using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Linq; /// - /// The types of conditions for a multi resource alert + /// The types of conditions for a multi resource alert. /// public partial class MultiMetricCriteria { @@ -31,11 +32,22 @@ public MultiMetricCriteria() /// /// Initializes a new instance of the MultiMetricCriteria class. /// + /// Name of the criteria. + /// Name of the metric. + /// the criteria time aggregation + /// types. /// Unmatched properties from the /// message are deserialized this collection - public MultiMetricCriteria(IDictionary additionalProperties = default(IDictionary)) + /// Namespace of the metric. + /// List of dimension conditions. + public MultiMetricCriteria(string name, string metricName, object timeAggregation, IDictionary additionalProperties = default(IDictionary), string metricNamespace = default(string), IList dimensions = default(IList)) { AdditionalProperties = additionalProperties; + Name = name; + MetricName = metricName; + MetricNamespace = metricNamespace; + TimeAggregation = timeAggregation; + Dimensions = dimensions; CustomInit(); } @@ -51,5 +63,66 @@ public MultiMetricCriteria() [JsonExtensionData] public IDictionary AdditionalProperties { get; set; } + /// + /// Gets or sets name of the criteria. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets name of the metric. + /// + [JsonProperty(PropertyName = "metricName")] + public string MetricName { get; set; } + + /// + /// Gets or sets namespace of the metric. + /// + [JsonProperty(PropertyName = "metricNamespace")] + public string MetricNamespace { get; set; } + + /// + /// Gets or sets the criteria time aggregation types. + /// + [JsonProperty(PropertyName = "timeAggregation")] + public object TimeAggregation { get; set; } + + /// + /// Gets or sets list of dimension conditions. + /// + [JsonProperty(PropertyName = "dimensions")] + public IList Dimensions { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Name == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Name"); + } + if (MetricName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MetricName"); + } + if (TimeAggregation == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "TimeAggregation"); + } + if (Dimensions != null) + { + foreach (var element in Dimensions) + { + if (element != null) + { + element.Validate(); + } + } + } + } } }