Class MetricTrigger
java.lang.Object
com.azure.resourcemanager.monitor.models.MetricTrigger
- All Implemented Interfaces:
com.azure.json.JsonSerializable<MetricTrigger>
public final class MetricTrigger
extends Object
implements com.azure.json.JsonSerializable<MetricTrigger>
The trigger that results in a scaling action.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the dimensions property: List of dimension conditions.Get the dividePerInstance property: a value indicating whether metric should divide per instance.static MetricTrigger
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of MetricTrigger from the JsonReader.Get the metricName property: the name of the metric that defines what the rule monitors.Get the metricNamespace property: the namespace of the metric that defines what the rule monitors.Get the metricResourceLocation property: the location of the resource the rule monitors.Get the metricResourceUri property: the resource identifier of the resource the rule monitors.operator()
Get the operator property: the operator that is used to compare the metric data and the threshold.Get the statistic property: the metric statistic type.double
Get the threshold property: the threshold of the metric that triggers the scale action.Get the timeAggregation property: time aggregation type.Get the timeGrain property: the granularity of metrics the rule monitors.Get the timeWindow property: the range of time in which instance data is collected.com.azure.json.JsonWriter
toJson
(com.azure.json.JsonWriter jsonWriter) void
validate()
Validates the instance.withDimensions
(List<ScaleRuleMetricDimension> dimensions) Set the dimensions property: List of dimension conditions.withDividePerInstance
(Boolean dividePerInstance) Set the dividePerInstance property: a value indicating whether metric should divide per instance.withMetricName
(String metricName) Set the metricName property: the name of the metric that defines what the rule monitors.withMetricNamespace
(String metricNamespace) Set the metricNamespace property: the namespace of the metric that defines what the rule monitors.withMetricResourceLocation
(String metricResourceLocation) Set the metricResourceLocation property: the location of the resource the rule monitors.withMetricResourceUri
(String metricResourceUri) Set the metricResourceUri property: the resource identifier of the resource the rule monitors.withOperator
(ComparisonOperationType operator) Set the operator property: the operator that is used to compare the metric data and the threshold.withStatistic
(MetricStatisticType statistic) Set the statistic property: the metric statistic type.withThreshold
(double threshold) Set the threshold property: the threshold of the metric that triggers the scale action.withTimeAggregation
(TimeAggregationType timeAggregation) Set the timeAggregation property: time aggregation type.withTimeGrain
(Duration timeGrain) Set the timeGrain property: the granularity of metrics the rule monitors.withTimeWindow
(Duration timeWindow) Set the timeWindow property: the range of time in which instance data is collected.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
-
MetricTrigger
public MetricTrigger()Creates an instance of MetricTrigger class.
-
-
Method Details
-
metricName
Get the metricName property: the name of the metric that defines what the rule monitors.- Returns:
- the metricName value.
-
withMetricName
Set the metricName property: the name of the metric that defines what the rule monitors.- Parameters:
metricName
- the metricName value to set.- Returns:
- the MetricTrigger object itself.
-
metricNamespace
Get the metricNamespace property: the namespace of the metric that defines what the rule monitors.- Returns:
- the metricNamespace value.
-
withMetricNamespace
Set the metricNamespace property: the namespace of the metric that defines what the rule monitors.- Parameters:
metricNamespace
- the metricNamespace value to set.- Returns:
- the MetricTrigger object itself.
-
metricResourceUri
Get the metricResourceUri property: the resource identifier of the resource the rule monitors.- Returns:
- the metricResourceUri value.
-
withMetricResourceUri
Set the metricResourceUri property: the resource identifier of the resource the rule monitors.- Parameters:
metricResourceUri
- the metricResourceUri value to set.- Returns:
- the MetricTrigger object itself.
-
metricResourceLocation
Get the metricResourceLocation property: the location of the resource the rule monitors.- Returns:
- the metricResourceLocation value.
-
withMetricResourceLocation
Set the metricResourceLocation property: the location of the resource the rule monitors.- Parameters:
metricResourceLocation
- the metricResourceLocation value to set.- Returns:
- the MetricTrigger object itself.
-
timeGrain
Get the timeGrain property: the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute.- Returns:
- the timeGrain value.
-
withTimeGrain
Set the timeGrain property: the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions for the metric. Must be between 12 hours and 1 minute.- Parameters:
timeGrain
- the timeGrain value to set.- Returns:
- the MetricTrigger object itself.
-
statistic
Get the statistic property: the metric statistic type. How the metrics from multiple instances are combined.- Returns:
- the statistic value.
-
withStatistic
Set the statistic property: the metric statistic type. How the metrics from multiple instances are combined.- Parameters:
statistic
- the statistic value to set.- Returns:
- the MetricTrigger object itself.
-
timeWindow
Get the timeWindow property: the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes.- Returns:
- the timeWindow value.
-
withTimeWindow
Set the timeWindow property: the range of time in which instance data is collected. This value must be greater than the delay in metric collection, which can vary from resource-to-resource. Must be between 12 hours and 5 minutes.- Parameters:
timeWindow
- the timeWindow value to set.- Returns:
- the MetricTrigger object itself.
-
timeAggregation
Get the timeAggregation property: time aggregation type. How the data that is collected should be combined over time. The default value is Average.- Returns:
- the timeAggregation value.
-
withTimeAggregation
Set the timeAggregation property: time aggregation type. How the data that is collected should be combined over time. The default value is Average.- Parameters:
timeAggregation
- the timeAggregation value to set.- Returns:
- the MetricTrigger object itself.
-
operator
Get the operator property: the operator that is used to compare the metric data and the threshold.- Returns:
- the operator value.
-
withOperator
Set the operator property: the operator that is used to compare the metric data and the threshold.- Parameters:
operator
- the operator value to set.- Returns:
- the MetricTrigger object itself.
-
threshold
public double threshold()Get the threshold property: the threshold of the metric that triggers the scale action.- Returns:
- the threshold value.
-
withThreshold
Set the threshold property: the threshold of the metric that triggers the scale action.- Parameters:
threshold
- the threshold value to set.- Returns:
- the MetricTrigger object itself.
-
dimensions
Get the dimensions property: List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].- Returns:
- the dimensions value.
-
withDimensions
Set the dimensions property: List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].- Parameters:
dimensions
- the dimensions value to set.- Returns:
- the MetricTrigger object itself.
-
dividePerInstance
Get the dividePerInstance property: a value indicating whether metric should divide per instance.- Returns:
- the dividePerInstance value.
-
withDividePerInstance
Set the dividePerInstance property: a value indicating whether metric should divide per instance.- Parameters:
dividePerInstance
- the dividePerInstance value to set.- Returns:
- the MetricTrigger object itself.
-
validate
public void validate()Validates the instance.- Throws:
IllegalArgumentException
- thrown if the instance is not valid.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<MetricTrigger>
- Throws:
IOException
-
fromJson
Reads an instance of MetricTrigger from the JsonReader.- Parameters:
jsonReader
- The JsonReader being read.- Returns:
- An instance of MetricTrigger 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 MetricTrigger.
-