
    {	                         S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSK	Jr  Sr
\R                  " S\R                  5      rS	 rS
 rg)zDCommon classes and functions for organization firewall policy rules.    )absolute_import)division)unicode_literalsN)
exceptionszPROTOCOL[:PORT[-PORT]]z

    (?P<protocol>[a-zA-Z0-9+.-]+) # The protocol group.

    (:(?P<ports>\d+(-\d+)?))?     # The optional ports group.
                                  # May specify a range.

    $                             # End of input marker.
    c                 p   / nU =(       d    /  H  n[         R                  U5      nU(       d*  [        R                  " SR	                  [
        U5      5      eUR                  S5      (       a  UR                  S5      /nO/ nUR                  UR                  S5      US9nUR                  U5        M     U$ )z@Parses protocol:port mappings for --layer4-configs command line.zKOrganization firewall policy rules must be of the form {0}; received [{1}].portsprotocol)
ipProtocolr   )	LEGAL_SPECSmatchr   ArgumentErrorformatALLOWED_METAVARgroup%FirewallPolicyRuleMatcherLayer4Configappend)layer4_conifigsmessage_classeslayer4_config_listspecr   r   layer4_conifigs          @lib/googlecloudsdk/api_lib/compute/firewall_policy_rule_utils.pyParseLayer4Configsr   )   s    ##dd#E$$"F?D9  {{7{{7#$ee$JJ;;z*% K N n- $ 
    c                      [        U 5      nUS:  a  [        R                  " SS5      eU$ ! [         a    [        R                  " SS5      ef = f)Npriorityz.priority must be a valid non-negative integer.r   )int
ValueErrorcalliope_exceptionsInvalidArgumentException)r   int_prioritys     r   ConvertPriorityToIntr"   >   se    x=L
 A

6
6D  
 
 

6
6D s	   , "A)__doc__
__future__r   r   r   regooglecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   compileVERBOSEr   r   r"    r   r   <module>r+      sH    K &  ' 	 E 9*jj JJ*r   