# 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::ServiceFabric::Mgmt::V2017_07_01_preview
  module Models
    #
    # Represents the health policy used to evaluate the health of services
    # belonging to a service type.
    #
    #
    class ServiceTypeHealthPolicy

      include MsRestAzure

      # @return [Integer] The maximum allowed percentage of unhealthy
      # partitions per service. Allowed values are Byte values from zero to 100
      #
      # The percentage represents the maximum tolerated percentage of
      # partitions that can be unhealthy before the service is considered in
      # error.
      # If the percentage is respected but there is at least one unhealthy
      # partition, the health is evaluated as Warning.
      # The percentage is calculated by dividing the number of unhealthy
      # partitions over the total number of partitions in the service.
      # The computation rounds up to tolerate one failure on small numbers of
      # partitions. Default percentage is zero.
      # . Default value: 0 .
      attr_accessor :max_percent_unhealthy_partitions_per_service

      # @return [Integer] The maximum allowed percentage of unhealthy replicas
      # per partition. Allowed values are Byte values from zero to 100.
      #
      # The percentage represents the maximum tolerated percentage of replicas
      # that can be unhealthy before the partition is considered in error.
      # If the percentage is respected but there is at least one unhealthy
      # replica, the health is evaluated as Warning.
      # The percentage is calculated by dividing the number of unhealthy
      # replicas over the total number of replicas in the partition.
      # The computation rounds up to tolerate one failure on small numbers of
      # replicas. Default percentage is zero.
      # . Default value: 0 .
      attr_accessor :max_percent_unhealthy_replicas_per_partition

      # @return [Integer] The maximum maximum allowed percentage of unhealthy
      # services. Allowed values are Byte values from zero to 100.
      #
      # The percentage represents the maximum tolerated percentage of services
      # that can be unhealthy before the application is considered in error.
      # If the percentage is respected but there is at least one unhealthy
      # service, the health is evaluated as Warning.
      # This is calculated by dividing the number of unhealthy services of the
      # specific service type over the total number of services of the specific
      # service type.
      # The computation rounds up to tolerate one failure on small numbers of
      # services. Default percentage is zero.
      # . Default value: 0 .
      attr_accessor :max_percent_unhealthy_services


      #
      # Mapper for ServiceTypeHealthPolicy class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ServiceTypeHealthPolicy',
          type: {
            name: 'Composite',
            class_name: 'ServiceTypeHealthPolicy',
            model_properties: {
              max_percent_unhealthy_partitions_per_service: {
                client_side_validation: true,
                required: false,
                serialized_name: 'MaxPercentUnhealthyPartitionsPerService',
                default_value: 0,
                type: {
                  name: 'Number'
                }
              },
              max_percent_unhealthy_replicas_per_partition: {
                client_side_validation: true,
                required: false,
                serialized_name: 'MaxPercentUnhealthyReplicasPerPartition',
                default_value: 0,
                type: {
                  name: 'Number'
                }
              },
              max_percent_unhealthy_services: {
                client_side_validation: true,
                required: false,
                serialized_name: 'MaxPercentUnhealthyServices',
                default_value: 0,
                type: {
                  name: 'Number'
                }
              }
            }
          }
        }
      end
    end
  end
end
