# 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
    #
    # Defines a health policy used to evaluate the health of an application or
    # one of its children entities.
    #
    #
    class ApplicationHealthPolicy

      include MsRestAzure

      # @return [Boolean] Indicates whether warnings are treated with the same
      # severity as errors. Default value: false .
      attr_accessor :consider_warning_as_error

      # @return [Integer] The maximum allowed percentage of unhealthy deployed
      # applications. Allowed values are Byte values from zero to 100.
      # The percentage represents the maximum tolerated percentage of deployed
      # applications that can be unhealthy before the application is considered
      # in error.
      # This is calculated by dividing the number of unhealthy deployed
      # applications over the number of nodes where the application is
      # currently deployed on in the cluster.
      # The computation rounds up to tolerate one failure on small numbers of
      # nodes. Default percentage is zero.
      # . Default value: 0 .
      attr_accessor :max_percent_unhealthy_deployed_applications

      # @return [ServiceTypeHealthPolicy]
      attr_accessor :default_service_type_health_policy

      # @return [Array<ServiceTypeHealthPolicyMapItem>]
      attr_accessor :service_type_health_policy_map


      #
      # Mapper for ApplicationHealthPolicy class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'ApplicationHealthPolicy',
          type: {
            name: 'Composite',
            class_name: 'ApplicationHealthPolicy',
            model_properties: {
              consider_warning_as_error: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ConsiderWarningAsError',
                default_value: false,
                type: {
                  name: 'Boolean'
                }
              },
              max_percent_unhealthy_deployed_applications: {
                client_side_validation: true,
                required: false,
                serialized_name: 'MaxPercentUnhealthyDeployedApplications',
                default_value: 0,
                type: {
                  name: 'Number'
                }
              },
              default_service_type_health_policy: {
                client_side_validation: true,
                required: false,
                serialized_name: 'DefaultServiceTypeHealthPolicy',
                type: {
                  name: 'Composite',
                  class_name: 'ServiceTypeHealthPolicy'
                }
              },
              service_type_health_policy_map: {
                client_side_validation: true,
                required: false,
                serialized_name: 'ServiceTypeHealthPolicyMap',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'ServiceTypeHealthPolicyMapItemElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'ServiceTypeHealthPolicyMapItem'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end
