Class ThresholdRuleCondition
java.lang.Object
com.azure.resourcemanager.monitor.models.RuleCondition
com.azure.resourcemanager.monitor.models.ThresholdRuleCondition
- All Implemented Interfaces:
com.azure.json.JsonSerializable<RuleCondition>
A rule condition based on a metric crossing a threshold.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of ThresholdRuleCondition class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThresholdRuleCondition
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of ThresholdRuleCondition from the JsonReader.Get the odataType property: specifies the type of condition.operator()
Get the operator property: the operator used to compare the data and the threshold.double
Get the threshold property: the threshold value that activates the alert.Get the timeAggregation property: the time aggregation operator.com.azure.json.JsonWriter
toJson
(com.azure.json.JsonWriter jsonWriter) void
validate()
Validates the instance.Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.withDataSource
(RuleDataSource dataSource) Set the dataSource property: the resource from which the rule collects its data.withOperator
(ConditionOperator operator) Set the operator property: the operator used to compare the data and the threshold.withThreshold
(double threshold) Set the threshold property: the threshold value that activates the alert.withTimeAggregation
(TimeAggregationOperator timeAggregation) Set the timeAggregation property: the time aggregation operator.withWindowSize
(Duration windowSize) Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold.Methods inherited from class com.azure.resourcemanager.monitor.models.RuleCondition
dataSource
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Constructor Details
-
ThresholdRuleCondition
public ThresholdRuleCondition()Creates an instance of ThresholdRuleCondition class.
-
-
Method Details
-
odataType
Get the odataType property: specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of management events), LocationThresholdRuleCondition (based on the number of failures of a web test), and ThresholdRuleCondition (based on the threshold of a metric).- Overrides:
odataType
in classRuleCondition
- Returns:
- the odataType value.
-
operator
Get the operator property: the operator used to compare the data and the threshold.- Returns:
- the operator value.
-
withOperator
Set the operator property: the operator used to compare the data and the threshold.- Parameters:
operator
- the operator value to set.- Returns:
- the ThresholdRuleCondition object itself.
-
threshold
public double threshold()Get the threshold property: the threshold value that activates the alert.- Returns:
- the threshold value.
-
withThreshold
Set the threshold property: the threshold value that activates the alert.- Parameters:
threshold
- the threshold value to set.- Returns:
- the ThresholdRuleCondition object itself.
-
windowSize
Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.- Returns:
- the windowSize value.
-
withWindowSize
Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified then it must be between 5 minutes and 1 day.- Parameters:
windowSize
- the windowSize value to set.- Returns:
- the ThresholdRuleCondition object itself.
-
timeAggregation
Get the timeAggregation property: the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric.- Returns:
- the timeAggregation value.
-
withTimeAggregation
Set the timeAggregation property: the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType of the Metric.- Parameters:
timeAggregation
- the timeAggregation value to set.- Returns:
- the ThresholdRuleCondition object itself.
-
withDataSource
Set the dataSource property: the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource.- Overrides:
withDataSource
in classRuleCondition
- Parameters:
dataSource
- the dataSource value to set.- Returns:
- the RuleCondition object itself.
-
validate
public void validate()Validates the instance.- Overrides:
validate
in classRuleCondition
- Throws:
IllegalArgumentException
- thrown if the instance is not valid.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<RuleCondition>
- Overrides:
toJson
in classRuleCondition
- Throws:
IOException
-
fromJson
public static ThresholdRuleCondition fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads an instance of ThresholdRuleCondition from the JsonReader.- Parameters:
jsonReader
- The JsonReader being read.- Returns:
- An instance of ThresholdRuleCondition if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IllegalStateException
- If the deserialized JSON object was missing any required properties.IOException
- If an error occurs while reading the ThresholdRuleCondition.
-