Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Monitor.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

/// <summary>
/// Criterion for dynamic threshold.
/// </summary>
[Newtonsoft.Json.JsonObject("DynamicThresholdCriterion")]
public partial class DynamicMetricCriteria : MultiMetricCriteria
{
/// <summary>
/// Initializes a new instance of the DynamicMetricCriteria class.
/// </summary>
public DynamicMetricCriteria()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the DynamicMetricCriteria class.
/// </summary>
/// <param name="name">Name of the criteria.</param>
/// <param name="metricName">Name of the metric.</param>
/// <param name="timeAggregation">the criteria time aggregation
/// types.</param>
/// <param name="operatorProperty">The operator used to compare the
/// metric value against the threshold.</param>
/// <param name="alertSensitivity">The extent of deviation required to
/// trigger an alert. This will affect how tight the threshold is to
/// the metric series pattern.</param>
/// <param name="failingPeriods">The minimum number of violations
/// required within the selected lookback time window required to raise
/// an alert.</param>
/// <param name="additionalProperties">Unmatched properties from the
/// message are deserialized this collection</param>
/// <param name="metricNamespace">Namespace of the metric.</param>
/// <param name="dimensions">List of dimension conditions.</param>
/// <param name="ignoreDataBefore">Use this option to set the date from
/// which to start learning the metric historical data and calculate
/// the dynamic thresholds (in ISO8601 format)</param>
public DynamicMetricCriteria(string name, string metricName, object timeAggregation, object operatorProperty, object alertSensitivity, DynamicThresholdFailingPeriods failingPeriods, IDictionary<string, object> additionalProperties = default(IDictionary<string, object>), string metricNamespace = default(string), IList<MetricDimension> dimensions = default(IList<MetricDimension>), System.DateTime? ignoreDataBefore = default(System.DateTime?))
: base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions)
{
OperatorProperty = operatorProperty;
AlertSensitivity = alertSensitivity;
FailingPeriods = failingPeriods;
IgnoreDataBefore = ignoreDataBefore;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets the operator used to compare the metric value against
/// the threshold.
/// </summary>
[JsonProperty(PropertyName = "operator")]
public object OperatorProperty { get; set; }

/// <summary>
/// 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.
/// </summary>
[JsonProperty(PropertyName = "alertSensitivity")]
public object AlertSensitivity { get; set; }

/// <summary>
/// Gets or sets the minimum number of violations required within the
/// selected lookback time window required to raise an alert.
/// </summary>
[JsonProperty(PropertyName = "failingPeriods")]
public DynamicThresholdFailingPeriods FailingPeriods { get; set; }

/// <summary>
/// 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)
/// </summary>
[JsonProperty(PropertyName = "ignoreDataBefore")]
public System.DateTime? IgnoreDataBefore { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
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();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// <auto-generated>
// 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.
// </auto-generated>

namespace Microsoft.Azure.Management.Monitor.Models
{
using Newtonsoft.Json;
using System.Linq;

/// <summary>
/// The minimum number of violations required within the selected lookback
/// time window required to raise an alert.
/// </summary>
public partial class DynamicThresholdFailingPeriods
{
/// <summary>
/// Initializes a new instance of the DynamicThresholdFailingPeriods
/// class.
/// </summary>
public DynamicThresholdFailingPeriods()
{
CustomInit();
}

/// <summary>
/// Initializes a new instance of the DynamicThresholdFailingPeriods
/// class.
/// </summary>
/// <param name="numberOfEvaluationPeriods">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.</param>
/// <param name="minFailingPeriodsToAlert">The number of violations to
/// trigger an alert. Should be smaller or equal to
/// numberOfEvaluationPeriods.</param>
public DynamicThresholdFailingPeriods(double numberOfEvaluationPeriods, double minFailingPeriodsToAlert)
{
NumberOfEvaluationPeriods = numberOfEvaluationPeriods;
MinFailingPeriodsToAlert = minFailingPeriodsToAlert;
CustomInit();
}

/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();

/// <summary>
/// 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.
/// </summary>
[JsonProperty(PropertyName = "numberOfEvaluationPeriods")]
public double NumberOfEvaluationPeriods { get; set; }

/// <summary>
/// Gets or sets the number of violations to trigger an alert. Should
/// be smaller or equal to numberOfEvaluationPeriods.
/// </summary>
[JsonProperty(PropertyName = "minFailingPeriodsToAlert")]
public double MinFailingPeriodsToAlert { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
//Nothing to validate
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand All @@ -32,8 +34,8 @@ public LogToMetricAction()
/// <summary>
/// Initializes a new instance of the LogToMetricAction class.
/// </summary>
/// <param name="criteria">Severity of the alert</param>
public LogToMetricAction(Criteria criteria)
/// <param name="criteria">Criteria of Metric</param>
public LogToMetricAction(IList<Criteria> criteria)
{
Criteria = criteria;
CustomInit();
Expand All @@ -45,10 +47,10 @@ public LogToMetricAction(Criteria criteria)
partial void CustomInit();

/// <summary>
/// Gets or sets severity of the alert
/// Gets or sets criteria of Metric
/// </summary>
[JsonProperty(PropertyName = "criteria")]
public Criteria Criteria { get; set; }
public IList<Criteria> Criteria { get; set; }

/// <summary>
/// Validate the object.
Expand All @@ -64,7 +66,13 @@ public virtual void Validate()
}
if (Criteria != null)
{
Criteria.Validate();
foreach (var element in Criteria)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,20 @@ public MetricCriteria()
/// </summary>
/// <param name="name">Name of the criteria.</param>
/// <param name="metricName">Name of the metric.</param>
/// <param name="operatorProperty">the criteria operator.</param>
/// <param name="timeAggregation">the criteria time aggregation
/// types.</param>
/// <param name="operatorProperty">the criteria operator.</param>
/// <param name="threshold">the criteria threshold value that activates
/// the alert.</param>
/// <param name="additionalProperties">Unmatched properties from the
/// message are deserialized this collection</param>
/// <param name="metricNamespace">Namespace of the metric.</param>
/// <param name="dimensions">List of dimension conditions.</param>
public MetricCriteria(string name, string metricName, object operatorProperty, object timeAggregation, double threshold, IDictionary<string, object> additionalProperties = default(IDictionary<string, object>), string metricNamespace = default(string), IList<MetricDimension> dimensions = default(IList<MetricDimension>))
: base(additionalProperties)
public MetricCriteria(string name, string metricName, object timeAggregation, object operatorProperty, double threshold, IDictionary<string, object> additionalProperties = default(IDictionary<string, object>), string metricNamespace = default(string), IList<MetricDimension> dimensions = default(IList<MetricDimension>))
: base(name, metricName, timeAggregation, additionalProperties, metricNamespace, dimensions)
{
Name = name;
MetricName = metricName;
MetricNamespace = metricNamespace;
OperatorProperty = operatorProperty;
TimeAggregation = timeAggregation;
Threshold = threshold;
Dimensions = dimensions;
CustomInit();
}

Expand All @@ -62,82 +57,31 @@ public MetricCriteria()
/// </summary>
partial void CustomInit();

/// <summary>
/// Gets or sets name of the criteria.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }

/// <summary>
/// Gets or sets name of the metric.
/// </summary>
[JsonProperty(PropertyName = "metricName")]
public string MetricName { get; set; }

/// <summary>
/// Gets or sets namespace of the metric.
/// </summary>
[JsonProperty(PropertyName = "metricNamespace")]
public string MetricNamespace { get; set; }

/// <summary>
/// Gets or sets the criteria operator.
/// </summary>
[JsonProperty(PropertyName = "operator")]
public object OperatorProperty { get; set; }

/// <summary>
/// Gets or sets the criteria time aggregation types.
/// </summary>
[JsonProperty(PropertyName = "timeAggregation")]
public object TimeAggregation { get; set; }

/// <summary>
/// Gets or sets the criteria threshold value that activates the alert.
/// </summary>
[JsonProperty(PropertyName = "threshold")]
public double Threshold { get; set; }

/// <summary>
/// Gets or sets list of dimension conditions.
/// </summary>
[JsonProperty(PropertyName = "dimensions")]
public IList<MetricDimension> Dimensions { get; set; }

/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
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();
}
}
}
}
}
}
Loading