# encoding: utf-8 # Code generated by Microsoft (R) AutoRest Code Generator 0.17.0.0 # Changes may cause incorrect behavior and will be lost if the code is # regenerated. module Azure::ARM::Web module Models # # AutoHealTriggers - describes the triggers for auto-heal. # class AutoHealTriggers include MsRestAzure # @return [RequestsBasedTrigger] Requests - Defines a rule based on # total requests attr_accessor :requests # @return [Integer] PrivateBytesInKB - Defines a rule based on private # bytes attr_accessor :private_bytes_in_kb # @return [Array] StatusCodes - Defines a rule # based on status codes attr_accessor :status_codes # @return [SlowRequestsBasedTrigger] SlowRequests - Defines a rule based # on request execution time attr_accessor :slow_requests # # Validate the object. Throws ValidationError if validation fails. # def validate @requests.validate unless @requests.nil? @status_codes.each{ |e| e.validate if e.respond_to?(:validate) } unless @status_codes.nil? @slow_requests.validate unless @slow_requests.nil? end # # Serializes given Model object into Ruby Hash. # @param object Model object to serialize. # @return [Hash] Serialized object in form of Ruby Hash. # def self.serialize_object(object) object.validate output_object = {} serialized_property = object.requests unless serialized_property.nil? serialized_property = RequestsBasedTrigger.serialize_object(serialized_property) end output_object['requests'] = serialized_property unless serialized_property.nil? serialized_property = object.private_bytes_in_kb output_object['privateBytesInKB'] = serialized_property unless serialized_property.nil? serialized_property = object.status_codes unless serialized_property.nil? serializedArray = [] serialized_property.each do |element| unless element.nil? element = StatusCodesBasedTrigger.serialize_object(element) end serializedArray.push(element) end serialized_property = serializedArray end output_object['statusCodes'] = serialized_property unless serialized_property.nil? serialized_property = object.slow_requests unless serialized_property.nil? serialized_property = SlowRequestsBasedTrigger.serialize_object(serialized_property) end output_object['slowRequests'] = serialized_property unless serialized_property.nil? output_object end # # Deserializes given Ruby Hash into Model object. # @param object [Hash] Ruby Hash object to deserialize. # @return [AutoHealTriggers] Deserialized object. # def self.deserialize_object(object) return if object.nil? output_object = AutoHealTriggers.new deserialized_property = object['requests'] unless deserialized_property.nil? deserialized_property = RequestsBasedTrigger.deserialize_object(deserialized_property) end output_object.requests = deserialized_property deserialized_property = object['privateBytesInKB'] deserialized_property = Integer(deserialized_property) unless deserialized_property.to_s.empty? output_object.private_bytes_in_kb = deserialized_property deserialized_property = object['statusCodes'] unless deserialized_property.nil? deserialized_array = [] deserialized_property.each do |element1| unless element1.nil? element1 = StatusCodesBasedTrigger.deserialize_object(element1) end deserialized_array.push(element1) end deserialized_property = deserialized_array end output_object.status_codes = deserialized_property deserialized_property = object['slowRequests'] unless deserialized_property.nil? deserialized_property = SlowRequestsBasedTrigger.deserialize_object(deserialized_property) end output_object.slow_requests = deserialized_property output_object end end end end