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 Details

    • MetricTrigger

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

    • metricName

      public String metricName()
      Get the metricName property: the name of the metric that defines what the rule monitors.
      Returns:
      the metricName value.
    • withMetricName

      public MetricTrigger withMetricName(String metricName)
      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

      public String metricNamespace()
      Get the metricNamespace property: the namespace of the metric that defines what the rule monitors.
      Returns:
      the metricNamespace value.
    • withMetricNamespace

      public MetricTrigger withMetricNamespace(String metricNamespace)
      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

      public String metricResourceUri()
      Get the metricResourceUri property: the resource identifier of the resource the rule monitors.
      Returns:
      the metricResourceUri value.
    • withMetricResourceUri

      public MetricTrigger withMetricResourceUri(String metricResourceUri)
      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

      public String metricResourceLocation()
      Get the metricResourceLocation property: the location of the resource the rule monitors.
      Returns:
      the metricResourceLocation value.
    • withMetricResourceLocation

      public MetricTrigger withMetricResourceLocation(String metricResourceLocation)
      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

      public Duration 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

      public MetricTrigger withTimeGrain(Duration timeGrain)
      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

      public MetricStatisticType statistic()
      Get the statistic property: the metric statistic type. How the metrics from multiple instances are combined.
      Returns:
      the statistic value.
    • withStatistic

      public MetricTrigger withStatistic(MetricStatisticType statistic)
      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

      public Duration 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

      public MetricTrigger withTimeWindow(Duration timeWindow)
      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

      public TimeAggregationType 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

      public MetricTrigger withTimeAggregation(TimeAggregationType timeAggregation)
      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

      public ComparisonOperationType operator()
      Get the operator property: the operator that is used to compare the metric data and the threshold.
      Returns:
      the operator value.
    • withOperator

      public MetricTrigger withOperator(ComparisonOperationType operator)
      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

      public MetricTrigger withThreshold(double threshold)
      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

      public List<ScaleRuleMetricDimension> 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

      public MetricTrigger withDimensions(List<ScaleRuleMetricDimension> dimensions)
      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

      public Boolean dividePerInstance()
      Get the dividePerInstance property: a value indicating whether metric should divide per instance.
      Returns:
      the dividePerInstance value.
    • withDividePerInstance

      public MetricTrigger withDividePerInstance(Boolean dividePerInstance)
      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

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

      public static MetricTrigger fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      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.