# 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::CDN::Mgmt::V2020_09_01
  module Models
    #
    # The JSON object that contains the properties to determine origin health
    # using real requests/responses.
    #
    class ResponseBasedOriginErrorDetectionParameters

      include MsRestAzure

      # @return [ResponseBasedDetectedErrorTypes] Type of response errors for
      # real user requests for which origin will be deemed unhealthy. Possible
      # values include: 'None', 'TcpErrorsOnly', 'TcpAndHttpErrors'
      attr_accessor :response_based_detected_error_types

      # @return [Integer] The percentage of failed requests in the sample where
      # failover should trigger.
      attr_accessor :response_based_failover_threshold_percentage

      # @return [Array<HttpErrorRangeParameters>] The list of Http status code
      # ranges that are considered as server errors for origin and it is marked
      # as unhealthy.
      attr_accessor :http_error_ranges


      #
      # Mapper for ResponseBasedOriginErrorDetectionParameters class as Ruby
      # Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ResponseBasedOriginErrorDetectionParameters',
          type: {
            name: 'Composite',
            class_name: 'ResponseBasedOriginErrorDetectionParameters',
            model_properties: {
              response_based_detected_error_types: {
                client_side_validation: true,
                required: false,
                serialized_name: 'responseBasedDetectedErrorTypes',
                type: {
                  name: 'Enum',
                  module: 'ResponseBasedDetectedErrorTypes'
                }
              },
              response_based_failover_threshold_percentage: {
                client_side_validation: true,
                required: false,
                serialized_name: 'responseBasedFailoverThresholdPercentage',
                constraints: {
                  InclusiveMaximum: 100,
                  InclusiveMinimum: 0
                },
                type: {
                  name: 'Number'
                }
              },
              http_error_ranges: {
                client_side_validation: true,
                required: false,
                serialized_name: 'httpErrorRanges',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'HttpErrorRangeParametersElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'HttpErrorRangeParameters'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end
