ó FRTc@s\dZddlZddlmZddlmZddlmZdefd„ƒYZ dS(i<iÿÿÿÿN(tTooManyRecordsException(tResourceRecordSets(tStatustZonecBsOeZdZd„Zd„Zd„Zdd„Zdddd„Zdddd„Z dd „Z dddd „Z dddd „Z dddd „Z d edd„Zed„Zed„Zed„Zdddd„Zdddd„Zdddd„Zded„Zded„Zded„Zd„Zd„Zd„ZRS(sŸ A Route53 Zone. :ivar route53connection: A :class:`boto.route53.connection.Route53Connection` connection :ivar id: The ID of the hosted zone cCs`||_xP|D]H}|dkr>|djddƒ|_q|j|jƒ||ƒqWdS(NtIds /hostedzone/t(troute53connectiontreplacetidt __setattr__tlower(tselfRt zone_dicttkey((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt__init__(s    cCs d|jS(Ns (tname(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt__repr__0scCs|jƒ}|ddS(s¿ Commit a set of changes and return the ChangeInfo portion of the response. :type changes: ResourceRecordSets :param changes: changes to be committed t ChangeResourceRecordSetsResponset ChangeInfo(tcommit(R tchangestresponse((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt_commit3s Rc CsÖd}d} |dk r_y&t|dƒ|d}|d}Wq_|d} |d}q_Xn|jd|||d|d|d| ƒ} t|ƒtttgkrÅx+|D]} | j| ƒq«Wn | j|ƒdS(sw Add a CREATE change record to an existing ResourceRecordSets :type changes: ResourceRecordSets :param changes: change set to append to :type name: str :param name: The name of the resource record you want to perform the action on. :type resource_type: str :param resource_type: The DNS record type :param value: Appropriate value for resource_type :type ttl: int :param ttl: The resource record cache time to live (TTL), in seconds. :type identifier: tuple :param identifier: A tuple for setting WRR or LBR attributes. Valid forms are: * (str, int): WRR record [e.g. ('foo',10)] * (str, str): LBR record [e.g. ('foo','us-east-1') :type comment: str :param comment: A comment that will be stored with the change. iitCREATEt identifiertweighttregionN(tNonetintt add_changettypetlistttupletsett add_value( R Rt resource_typeRtvaluetttlRtcommentRRtchangetrecord((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt _new_record>s"      i<cCsPt|j|j|ƒ}|j|||||||ƒt|j|j|ƒƒS(s€ Add a new record to this Zone. See _new_record for parameter documentation. Returns a Status object. (RRRR)RR(R R#RR$R%RR&R((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt add_recordosc Cs|p t}tj|ƒ}t|j|j|ƒ}|jd|ƒ|j||j|j||||ƒt |j|j |ƒƒS(s  Update an existing record in this Zone. Returns a Status object. :type old_record: ResourceRecord :param old_record: A ResourceRecord (e.g. returned by find_records) See _new_record for additional parameter documentation. tDELETE( t default_ttltcopyRRRtadd_change_recordR)RRRR(R t old_recordt new_valuetnew_ttltnew_identifierR&R(R((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt update_recordzs cCs€t|j|j|ƒ}t|ƒtttgkrWx1|D]}|jd|ƒq:Wn|jd|ƒt|j|j |ƒƒS(s8 Delete one or more records from this Zone. Returns a Status object. :param record: A ResourceRecord (e.g. returned by find_records) or list, tuple, or set of ResourceRecords. :type comment: str :param comment: A comment that will be stored with the change. R+( RRRRRR R!R.RR(R R(R&Rtr((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt delete_recordŒs  cCs^|p t}|jj|ƒ}|jj|ƒ}|jddd|d|d|d|d|ƒS(s† Add a new CNAME record to this Zone. See _new_record for parameter documentation. Returns a Status object. R#tCNAMERR$R%RR&(R,Rt_make_qualifiedR*(R RR$R%RR&((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt add_cnamežs cCsL|p t}|jj|ƒ}|jddd|d|d|d|d|ƒS(s‚ Add a new A record to this Zone. See _new_record for parameter documentation. Returns a Status object. R#tARR$R%RR&(R,RR7R*(R RR$R%RR&((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytadd_a­s cCsL|p t}|jj|ƒ}|jddd|d|d|d|d|ƒS(sƒ Add a new MX record to this Zone. See _new_record for parameter documentation. Returns a Status object. R#tMXRR$R%RR&(R,RR7R*(R RtrecordsR%RR&((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytadd_mx»s ic Cs|jj|ƒ}|jj|jd|d|ƒ}g}x=|D]5}|j|krt|j|krt|j|ƒq@Pq@Wd } d } |d k rÄyt|dƒ|d} WqÄ|d} qÄXn| d k rg|D].}|j | kr×|j |dkr×|^q×}n| d k rXg|D].}|j | kr!|j |dkr!|^q!}n| rÙt |ƒ|krÙd||f} | d7} | dj g|D]%}d|j|j|jƒf^q›ƒ7} t| ƒ‚n4t |ƒdkrï|St |ƒdkr |dSd Sd S( sæ Search this Zone for records that match given parameters. Returns None if no results, a ResourceRecord if one result, or a ResourceRecordSets if more than one result. :type name: str :param name: The name of the records should match this parameter :type type: str :param type: The type of the records should match this parameter :type desired: int :param desired: The number of desired results. If the number of matching records in the Zone exceeds the value of this parameter, throw TooManyRecordsException :type all: Boolean :param all: If true return all records that match name, type, and identifier parameters :type identifier: Tuple :param identifier: A tuple specifying WRR or LBR attributes. Valid forms are: * (str, int): WRR record [e.g. ('foo',10)] * (str, str): LBR record [e.g. ('foo','us-east-1') RRiisSearch: name %s type %ss Found: s, s%s %s %sN(RR7tget_all_rrsetsRRRtappendRRRRRtlentjointto_printR( R RRtdesiredtallRtreturnedtresultsR4RRtmessage((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt find_recordsÉsB    " "  3cCs|j|dd|ƒS(sþ Search this Zone for CNAME records that match name. Returns a ResourceRecord. If there is more than one match return all as a ResourceRecordSets if all is True, otherwise throws TooManyRecordsException. R6RD(RH(R RRD((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt get_cnames cCs|j|dd|ƒS(sú Search this Zone for A records that match name. Returns a ResourceRecord. If there is more than one match return all as a ResourceRecordSets if all is True, otherwise throws TooManyRecordsException. R9RD(RH(R RRD((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytget_as cCs|j|dd|ƒS(sû Search this Zone for MX records that match name. Returns a ResourceRecord. If there is more than one match return all as a ResourceRecordSets if all is True, otherwise throws TooManyRecordsException. R;RD(RH(R RRD((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytget_mx*s c Csg|jj|ƒ}|jj|ƒ}|j|ƒ}|p?|j}|j|d|d|d|d|ƒS(sæ Update the given CNAME record in this Zone to a new value, ttl, and identifier. Returns a Status object. Will throw TooManyRecordsException is name, value does not match a single record. R0R1R2R&(RR7RIR%R3(R RR$R%RR&R/((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt update_cname6s c CsU|jj|ƒ}|j|ƒ}|p-|j}|j|d|d|d|d|ƒS(sâ Update the given A record in this Zone to a new value, ttl, and identifier. Returns a Status object. Will throw TooManyRecordsException is name, value does not match a single record. R0R1R2R&(RR7RJR%R3(R RR$R%RR&R/((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytupdate_aHs c Csg|jj|ƒ}|jj|ƒ}|j|ƒ}|p?|j}|j|d|d|d|d|ƒS(sã Update the given MX record in this Zone to a new value, ttl, and identifier. Returns a Status object. Will throw TooManyRecordsException is name, value does not match a single record. R0R1R2R&(RR7RKR%R3(R RR$R%RR&R/((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt update_mxYs cCs=|jj|ƒ}|j|dd|d|ƒ}|j|ƒS(sý Delete a CNAME record matching name and identifier from this Zone. Returns a Status object. If there is more than one match delete all matching records if all is True, otherwise throws TooManyRecordsException. R6RRD(RR7RHR5(R RRRDR(((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt delete_cnameks cCs=|jj|ƒ}|j|dd|d|ƒ}|j|ƒS(sú Delete an A record matching name and identifier from this Zone. Returns a Status object. If there is more than one match delete all matching records if all is True, otherwise throws TooManyRecordsException. R9RRD(RR7RHR5(R RRRDR(((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytdelete_axs cCs=|jj|ƒ}|j|dd|d|ƒ}|j|ƒS(sû Delete an MX record matching name and identifier from this Zone. Returns a Status object. If there is more than one match delete all matching records if all is True, otherwise throws TooManyRecordsException. R;RRD(RR7RHR5(R RRRDR(((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt delete_mx…s cCs|jj|jƒS(sS Return a ResourceRecordsSets for all of the records in this zone. (RR>R(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyt get_records’scCs|jj|jƒdS(s> Request that this zone be deleted by Amazon. N(Rtdelete_hosted_zoneR(R ((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytdelete˜scCs1|j|jdƒ}|dk r-|j}n|S(s+ Get the list of nameservers for this zone.tNSN(RHRRtresource_records(R tns((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pytget_nameserversžs  N(t__name__t __module__t__doc__RRRR)RR*R3R5R8R:R=tFalseRHRIRJRKRLRMRNRORPRQRRRTRX(((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyR!s4   0  I     ( R,R-tboto.exceptionRtboto.route53.recordRtboto.route53.statusRtobjectR(((s>/opt/freeware/lib/python2.7/site-packages/boto/route53/zone.pyts