Class MetricCriteria

java.lang.Object
com.azure.resourcemanager.monitor.models.MultiMetricCriteria
com.azure.resourcemanager.monitor.models.MetricCriteria
All Implemented Interfaces:
com.azure.json.JsonSerializable<MultiMetricCriteria>

public final class MetricCriteria extends MultiMetricCriteria
Criterion to filter metrics.
  • Constructor Details

    • MetricCriteria

      public MetricCriteria()
      Creates an instance of MetricCriteria class.
  • Method Details

    • criterionType

      public CriterionType criterionType()
      Get the criterionType property: Specifies the type of threshold criteria.
      Overrides:
      criterionType in class MultiMetricCriteria
      Returns:
      the criterionType value.
    • operator

      public Operator operator()
      Get the operator property: the criteria operator.
      Returns:
      the operator value.
    • withOperator

      public MetricCriteria withOperator(Operator operator)
      Set the operator property: the criteria operator.
      Parameters:
      operator - the operator value to set.
      Returns:
      the MetricCriteria object itself.
    • threshold

      public double threshold()
      Get the threshold property: the criteria threshold value that activates the alert.
      Returns:
      the threshold value.
    • withThreshold

      public MetricCriteria withThreshold(double threshold)
      Set the threshold property: the criteria threshold value that activates the alert.
      Parameters:
      threshold - the threshold value to set.
      Returns:
      the MetricCriteria object itself.
    • withName

      public MetricCriteria withName(String name)
      Set the name property: Name of the criteria.
      Overrides:
      withName in class MultiMetricCriteria
      Parameters:
      name - the name value to set.
      Returns:
      the MultiMetricCriteria object itself.
    • withMetricName

      public MetricCriteria withMetricName(String metricName)
      Set the metricName property: Name of the metric.
      Overrides:
      withMetricName in class MultiMetricCriteria
      Parameters:
      metricName - the metricName value to set.
      Returns:
      the MultiMetricCriteria object itself.
    • withMetricNamespace

      public MetricCriteria withMetricNamespace(String metricNamespace)
      Set the metricNamespace property: Namespace of the metric.
      Overrides:
      withMetricNamespace in class MultiMetricCriteria
      Parameters:
      metricNamespace - the metricNamespace value to set.
      Returns:
      the MultiMetricCriteria object itself.
    • withTimeAggregation

      public MetricCriteria withTimeAggregation(AggregationTypeEnum timeAggregation)
      Set the timeAggregation property: the criteria time aggregation types.
      Overrides:
      withTimeAggregation in class MultiMetricCriteria
      Parameters:
      timeAggregation - the timeAggregation value to set.
      Returns:
      the MultiMetricCriteria object itself.
    • withDimensions

      public MetricCriteria withDimensions(List<MetricDimension> dimensions)
      Set the dimensions property: List of dimension conditions.
      Overrides:
      withDimensions in class MultiMetricCriteria
      Parameters:
      dimensions - the dimensions value to set.
      Returns:
      the MultiMetricCriteria object itself.
    • withSkipMetricValidation

      public MetricCriteria withSkipMetricValidation(Boolean skipMetricValidation)
      Set the skipMetricValidation property: Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped.
      Overrides:
      withSkipMetricValidation in class MultiMetricCriteria
      Parameters:
      skipMetricValidation - the skipMetricValidation value to set.
      Returns:
      the MultiMetricCriteria object itself.
    • validate

      public void validate()
      Validates the instance.
      Overrides:
      validate in class MultiMetricCriteria
      Throws:
      IllegalArgumentException - thrown if the instance is not valid.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<MultiMetricCriteria>
      Overrides:
      toJson in class MultiMetricCriteria
      Throws:
      IOException
    • fromJson

      public static MetricCriteria fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of MetricCriteria from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of MetricCriteria 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 MetricCriteria.