ó FRTc@s¤ddlmZdZdZdZdZdZdZdZd Z d Z egZ gZ eee e gZ ige6Zdefd „ƒYZd efd „ƒYZdS(iÿÿÿÿ(tInvalidLifecycleConfigErrortLifecycleConfigurationtRuletActiontDeletet ConditiontAget CreatedBeforetNumberOfNewerVersionstIsLivecBsVeZdZdddd„Zd„Zd„Zd„Zd„Zd„Z d„Z RS( s A lifecycle rule for a bucket. :ivar action: Action to be taken. :ivar action_params: A dictionary of action specific parameters. Each item in the dictionary represents the name and value of an action parameter. :ivar conditions: A dictionary of conditions that specify when the action should be taken. Each item in the dictionary represents the name and value of a condition. cCs4||_|pi|_|p!i|_t|_dS(N(tactiont action_paramst conditionstRULEt current_tag(tselfR R R ((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyt__init__<s cCs/|j|kr+td||jfƒ‚ndS(sVerify parent of the start tag.s"Invalid tag %s found inside %s tagN(RR(Rttagtparent((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pytvalidateStartTagDscCs/||jkr+td|j|fƒ‚ndS(s%Verify end tag against the start tag.s%Mismatched start and end tags (%s/%s)N(RR(RR((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pytvalidateEndTagJscCsB|tkr|j|tƒn|tkre|j|tƒ|jdk rYtdƒ‚n||_nÐ|tkrÅ|jtkr“td|ƒ‚n|t |jkr5td||jfƒ‚q5np|t krä|j|tƒnQ|t kr%|j|t ƒ||j kr5td|ƒ‚q5ntd|ƒ‚||_dS(Ns+Only one action tag is allowed in each rulesTag %s found outside of actionsTag %s not allowed in action %ssFound duplicate conditions %ssUnsupported tag ( tACTIONRR t LEGAL_ACTIONSR tNoneRtLEGAL_ACTION_PARAMSRtLEGAL_ACTION_ACTION_PARAMSt CONDITIONtLEGAL_CONDITIONSR (Rtnametattrst connection((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyt startElementQs0       cCsÛ|j|ƒ|tkr&|jƒn±|tkr>t|_n™|tkrVt|_n|tkr„|j|_|jƒ|j |/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyt endElementps              cCs;|jstdƒ‚n|js7td|jƒ‚ndS(sValidate the rule.s#No action was specified in the rules(No condition was specified for action %sN(R RR (R((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyR ‡s    cCsOdtd}|dtd7}|jr¢|d|jd7}xItD]A}||jkrE|d|d|j|d|d7}qEqEW|d|jd7}n|d|jd7}|dtd7}|dtd7}xItD]A}||jkrâ|d|d|j|d|d7}qâqâW|dtd7}|dtd7}|S(s0Convert the rule into XML string representation.ts(R RR R RRRR (Rtstparamt condition((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pytto_xmls&  - -N( t__name__t __module__t__doc__RRRRRR#R R)(((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyR.s      tLifecycleConfigcBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(sI A container of rules associated with a lifecycle configuration. cCs t|_dS(N(tFalset has_root_tag(R((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyR¬scCs†|tkr0|jr$tdƒ‚nt|_nR|tkrr|jsXtd|ƒ‚ntƒ}|j|ƒ|Std|ƒ‚dS(Ns'Only one root tag is allowed in the XMLsInvalid root tag sUnsupported tag (tLIFECYCLE_CONFIGR/RtTrueR Rtappend(RRRRtrule((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyR°s        cCs#|tkrntd|ƒ‚dS(NsUnsupported end tag (R0R(RRR"R((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyR#¿s cCsOd}|dtd7}x|D]}||jƒ7}qW|dtd7}|S(s>Convert LifecycleConfig object into XML string representation.s&R$R%s/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyR)Ås  cCs#t|||ƒ}|j|ƒdS(s Add a rule to this Lifecycle configuration. This only adds the rule to the local copy. To install the new rule(s) on the bucket, you need to pass this Lifecycle config object to the configure_lifecycle method of the Bucket object. :type action: str :param action: Action to be taken. :type action_params: dict :param action_params: A dictionary of action specific parameters. Each item in the dictionary represents the name and value of an action parameter. :type conditions: dict :param conditions: A dictionary of conditions that specify when the action should be taken. Each item in the dictionary represents the name and value of a condition. N(RR2(RR R R R3((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pytadd_ruleÎs(R*R+R,RRR#R)R4(((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyR-§s     N(tboto.exceptionRR0R RtDELETERtAGEtCREATED_BEFOREtNUM_NEWER_VERSIONStIS_LIVERRRRtobjectRtlistR-(((s>/opt/freeware/lib/python2.7/site-packages/boto/gs/lifecycle.pyts   y