o ckF[a9@s8gdZddlmZGdddeZGdddeZdS))AAAAATXTCNAMEMXPTRSRVSPF) ResultSetcsteZdZdZdZdZdfdd ZddZ   dd d Zd d Z ddZ ddZ fddZ fddZ ZS)ResourceRecordSetsz A list of resource records. :ivar hosted_zone_id: The ID of the hosted zone. :ivar comment: A comment that will be stored with the change. :ivar changes: A list of changes. a@ %(comment)s %(changes)s zM %(action)s %(record)s NcsD||_||_||_g|_d|_d|_d|_tt| dt fgdS)NResourceRecordSet) connectionhosted_zone_idcommentchangesnext_record_namenext_record_typenext_record_identifiersuperr __init__Record)selfr rr __class__5/usr/lib/python3/dist-packages/boto/route53/record.pyr4szResourceRecordSets.__init__cCs@|jrddd|jD}n ddd|D}d|j|fS)N,cSg|]}|qSr__repr__).0crrr @z/ResourceRecordSets.__repr__..cSrrr)r recordrrrr"Br#zs zResourceRecordSets.__repr__Xc  Cs2t|||||||| | | | d } |j|| g| S)a Add a change request to the set. :type action: str :param action: The action to perform ('CREATE'|'DELETE'|'UPSERT') :type name: str :param name: The name of the domain you want to perform the action on. :type type: str :param type: The DNS record type. Valid values are: * A * AAAA * CNAME * MX * NS * PTR * SOA * SPF * SRV * TXT :type ttl: int :param ttl: The resource record cache time to live (TTL), in seconds. :type alias_hosted_zone_id: str :param alias_dns_name: *Alias resource record sets only* The value of the hosted zone ID, CanonicalHostedZoneNameId, for the LoadBalancer. :type alias_dns_name: str :param alias_hosted_zone_id: *Alias resource record sets only* Information about the domain to which you are redirecting traffic. :type identifier: str :param identifier: *Weighted and latency-based resource record sets only* An identifier that differentiates among multiple resource record sets that have the same combination of DNS name and type. :type weight: int :param weight: *Weighted resource record sets only* Among resource record sets that have the same combination of DNS name and type, a value that determines what portion of traffic for the current resource record set is routed to the associated location :type region: str :param region: *Latency-based resource record sets only* Among resource record sets that have the same combination of DNS name and type, a value that determines which region this should be associated with for the latency-based routing :type alias_evaluate_target_health: bool :param alias_evaluate_target_health: *Required for alias resource record sets* Indicates whether this Resource Record Set should respect the health status of any health checks associated with the ALIAS target record which it is linked to. :type health_check: str :param health_check: Health check to associate with this record :type failover: str :param failover: *Failover resource record sets only* Whether this is the primary or secondary resource record set. )alias_hosted_zone_idalias_dns_name identifierweightregionalias_evaluate_target_health health_checkfailover)rrappend)ractionnametypettlr(r)r*r+r,r-r.r/changerrr add_changeFsEzResourceRecordSets.add_changecCs|j||gdS)z@Add an existing record to a change set with the specified actionN)rr0)rr1r5rrradd_change_recordsz$ResourceRecordSets.add_change_recordcCsJd}|jD]}|d|dd}||j|7}q|j|d}|j|S)zcConvert this ResourceRecordSet into XML to be saved via the ChangeResourceRecordSetsRequestr )r1r$)rr)rto_xml ChangeXMLrChangeResourceRecordSetsBody)r changesXMLr5 changeParamsparamsrrrr:s    zResourceRecordSets.to_xmlcCs,|js ddl}||_|j|j|S)zCommit this changer N)r botoconnect_route53 change_rrsetsrr:)rr@rrrcommits zResourceRecordSets.commitcsJ|dkr ||_dS|dkr||_dS|dkr||_dStt||||S)znOverwritten to also add the NextRecordName, NextRecordType and NextRecordIdentifier to the base objectNextRecordNameNextRecordTypeNextRecordIdentifierN)rrrrr endElementrr2valuer rrrrGs   zResourceRecordSets.endElementc#sjtt|}|j}|r3|D]}|Vq|jr*d|_|jj|j|j|j|j d}nd}||_|s dSdS)z,Override the next function to support pagingF)r2r3r*N) rr __iter__ is_truncatedr get_all_rrsetsrrrr)rresults truncatedobjrrrrJs zResourceRecordSets.__iter__)NNN) r'NNNNNNNN)__name__ __module__ __qualname____doc__r<r;rrr6r7r:rCrGrJ __classcell__rrrrr s   N  r c@seZdZdZdZdZdZdZdZdZ dZ d Z d Z dd dZ ddZddZ dddZddZddZddZddZd S) rzAn individual ResourceRecordSetz!%sz %(name)s %(type)s %(weight)s %(body)s %(health_check)s z_ %(identifier)s %(weight)s z_ %(identifier)s %(region)s ze %(identifier)s %(failover)s zh %(ttl)s %(records)s z@ %s z %(hosted_zone_id)s %(dns_name)s %(eval_target_health)s z/%sNr'c CsX||_||_||_|durg}||_||_||_||_||_| |_| |_ | |_ | |_ dSN) r2r3r4resource_recordsr(r)r*r+r,r-r.r/) rr2r3r4rVr(r)r*r+r,r-r.r/rrrrs zRecord.__init__cCsd|j|j|fS)Nz)r2r3to_print)rrrrrszRecord.__repr__cCs|j|dS)zAdd a resource record valueN)rVr0)rrIrrr add_value szRecord.add_valueFcCs||_||_||_dS)z&Make this an alias resource record setN)r(r)r-)rr(r)r-rrr set_aliass zRecord.set_aliascCs8|jdur(|jdur(|jdur|j|jrdnd}nd}|j|j|j|d}nd}|jD] }||j|7}q-|j|j|d}d}|j durW|j durW|j |j |j d}n)|j durl|j durl|j |j |j d}n|j dur|jdur|j|j |jd }d}|jdur|j|j}|j|j|||d }|j|S) z(Spit this resource record set out as XMLNtruefalser8)rdns_nameeval_target_health)r4records)r*r+)r*r,)r*r/)r2r3r+bodyr.)r(r)r-EvaluateTargetHealth AliasBodyrVResourceRecordBodyResourceRecordsBodyr4r*r+WRRBodyr,RRRBodyr/ FailoverBodyr.HealthCheckBodyr2r3XMLBody)rr]r_r^rr+r.r?rrrr:sL        z Record.to_xmlcCsd}|jdur#|jdur#d|jd|j}|jdur"|d|j7}nd|j}|jdur?|jdur?|d|j|jf7}|S|jdurU|jdurU|d|j|jf7}|S|jduri|jduri|d|j|jf7}|S) Nr8zALIAS  z (EvalTarget %s)rz (WRR id=%s, w=%s)z (LBR id=%s, region=%s)z (FAILOVER id=%s, failover=%s)) r(r)r-r%rVr*r+r,r/)rrrrrrrWGs   zRecord.to_printcCs|dkr ||_dS|dkr||_dS|dkr||_dS|dkr'|j|dS|dkr0||_dS|dkr9||_dS|dkrB||_dS|dkrO|d k|_ dS|d krX||_ dS|d kra||_ dS|d krj||_ dS|d krs||_ dSdS)NNameTypeTTLValue HostedZoneIdDNSName SetIdentifierr`rZWeightRegionFailover HealthCheckId)r2r3r4rVr0r(r)r*lowerr-r+r,r/r.rHrrrrG[s2          zRecord.endElementcCsdSrUr)rr2attrsr rrr startElementuszRecord.startElement) NNr'NNNNNNNNN)F)rPrQrRrSrgrhrdrerfrcrbrar`rrrXrYr:rWrGryrrrrrs0  1 rN) RECORD_TYPESboto.resultsetr r objectrrrrrs  *