# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::Monitor::Mgmt::V2015_04_01
  module Models
    #
    # The trigger that results in a scaling action.
    #
    class MetricTrigger

      include MsRestAzure

      # @return [String] the name of the metric that defines what the rule
      # monitors.
      attr_accessor :metric_name

      # @return [String] the namespace of the metric that defines what the rule
      # monitors.
      attr_accessor :metric_namespace

      # @return [String] the resource identifier of the resource the rule
      # monitors.
      attr_accessor :metric_resource_uri

      # @return [Duration] 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.
      attr_accessor :time_grain

      # @return [MetricStatisticType] the metric statistic type. How the
      # metrics from multiple instances are combined. Possible values include:
      # 'Average', 'Min', 'Max', 'Sum'
      attr_accessor :statistic

      # @return [Duration] 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.
      attr_accessor :time_window

      # @return [TimeAggregationType] time aggregation type. How the data that
      # is collected should be combined over time. The default value is
      # Average. Possible values include: 'Average', 'Minimum', 'Maximum',
      # 'Total', 'Count', 'Last'
      attr_accessor :time_aggregation

      # @return [ComparisonOperationType] the operator that is used to compare
      # the metric data and the threshold. Possible values include: 'Equals',
      # 'NotEquals', 'GreaterThan', 'GreaterThanOrEqual', 'LessThan',
      # 'LessThanOrEqual'
      attr_accessor :operator

      # @return [Float] the threshold of the metric that triggers the scale
      # action.
      attr_accessor :threshold

      # @return [Array<ScaleRuleMetricDimension>] List of dimension conditions.
      # For example:
      # [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}].
      attr_accessor :dimensions


      #
      # Mapper for MetricTrigger class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'MetricTrigger',
          type: {
            name: 'Composite',
            class_name: 'MetricTrigger',
            model_properties: {
              metric_name: {
                client_side_validation: true,
                required: true,
                serialized_name: 'metricName',
                type: {
                  name: 'String'
                }
              },
              metric_namespace: {
                client_side_validation: true,
                required: false,
                serialized_name: 'metricNamespace',
                type: {
                  name: 'String'
                }
              },
              metric_resource_uri: {
                client_side_validation: true,
                required: true,
                serialized_name: 'metricResourceUri',
                type: {
                  name: 'String'
                }
              },
              time_grain: {
                client_side_validation: true,
                required: true,
                serialized_name: 'timeGrain',
                type: {
                  name: 'TimeSpan'
                }
              },
              statistic: {
                client_side_validation: true,
                required: true,
                serialized_name: 'statistic',
                type: {
                  name: 'Enum',
                  module: 'MetricStatisticType'
                }
              },
              time_window: {
                client_side_validation: true,
                required: true,
                serialized_name: 'timeWindow',
                type: {
                  name: 'TimeSpan'
                }
              },
              time_aggregation: {
                client_side_validation: true,
                required: true,
                serialized_name: 'timeAggregation',
                type: {
                  name: 'Enum',
                  module: 'TimeAggregationType'
                }
              },
              operator: {
                client_side_validation: true,
                required: true,
                serialized_name: 'operator',
                type: {
                  name: 'Enum',
                  module: 'ComparisonOperationType'
                }
              },
              threshold: {
                client_side_validation: true,
                required: true,
                serialized_name: 'threshold',
                type: {
                  name: 'Double'
                }
              },
              dimensions: {
                client_side_validation: true,
                required: false,
                serialized_name: 'dimensions',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ScaleRuleMetricDimensionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ScaleRuleMetricDimension'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end
