<s> """<STR_LIT>""" <EOL> class HealthCheck ( object ) : <EOL> """<STR_LIT>""" <EOL> POSTXMLBody = """<STR_LIT>""" <EOL> XMLIpAddrPart = """<STR_LIT>""" <EOL> XMLFQDNPart = """<STR_LIT>""" <EOL> XMLStringMatchPart = """<STR_LIT>""" <EOL> XMLRequestIntervalPart = """<STR_LIT>""" <EOL> valid_request_intervals = ( <NUM_LIT:10> , <NUM_LIT:30> ) <EOL> def __init__ ( self , ip_addr , port , hc_type , resource_path , fqdn = None , string_match = None , request_interval = <NUM_LIT:30> , failure_threshold = <NUM_LIT:3> ) : <EOL> """<STR_LIT>""" <EOL> self . ip_addr = ip_addr <EOL> self . port = port <EOL> self . hc_type = hc_type <EOL> self . resource_path = resource_path <EOL> self . fqdn = fqdn <EOL> self . string_match = string_match <EOL> self . failure_threshold = failure_threshold <EOL> if request_interval in self . valid_request_intervals : <EOL> self . request_interval = request_interval <EOL> else : <EOL> raise AttributeError ( <EOL> "<STR_LIT>" % <EOL> "<STR_LIT:U+002C>" . join ( str ( i ) for i in self . valid_request_intervals ) ) <EOL> if failure_threshold < <NUM_LIT:1> or failure_threshold > <NUM_LIT:10> : <EOL> raise AttributeError ( <EOL> '<STR_LIT>' ) <EOL> def to_xml ( self ) : <EOL> params = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:port>' : self . port , <EOL> '<STR_LIT:type>' : self . hc_type , <EOL> '<STR_LIT>' : self . resource_path , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : "<STR_LIT>" , <EOL> '<STR_LIT>' : ( self . XMLRequestIntervalPart % <EOL> { '<STR_LIT>' : self . request_interval } ) , <EOL> '<STR_LIT>' : self . failure_threshold , <EOL> } <EOL> if self . fqdn is not None : <EOL> params [ '<STR_LIT>' ] = self . XMLFQDNPart % { '<STR_LIT>' : self . fqdn } <EOL> if self . ip_addr : <EOL> params [ '<STR_LIT>' ] = self . XMLIpAddrPart % { '<STR_LIT>' : self . ip_addr } <EOL> if self . string_match is not None : <EOL> params [ '<STR_LIT>' ] = self . XMLStringMatchPart % { '<STR_LIT>' : self . string_match } <EOL> return self . POSTXMLBody % params </s>
