
    %-                     `   % 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SKJr  S	r\\S
'   Sr\\S'   \\-
  r\\S'    " S S\
R$                  5      rS1S jrS1S jr S1S jrS rS\R0                  SS4S jrS2S jrS rS rS rS\R0                  SS4S jrS3S\R0                  S\SS4S jjr S\R0                  SS4S jr!S\R0                  SS4S  jr"S\R0                  SS4S! jr#\4S\R0                  S"\$S#\SS4S$ jjr% S3S\R0                  S\SS4S% jjr&S\4S\R0                  S"\$S\S#\SS4
S& jjr' S3S\R0                  S\SS4S' jjr( S3S\R0                  S\SS4S( jjr) S3S\R0                  S\SS4S) jjr* S3S\R0                  S\SS4S* jjr+ S3S\R0                  S\SS4S+ jjr, S3S\R0                  S\SS4S, jjr- S3S\R0                  S\SS4S- jjr. S3S\R0                  S\SS4S. jjr/ S3S\R0                  S\SS4S/ jjr0 S3S\R0                  S\SS4S0 jjr1g)4z<Flags and helpers for the compute network policies commands.    )absolute_import)division)unicode_literalsN)arg_parsers)
completers)flagsi_RULES_PRIORITY_UPPER_LIMITi   _RESERVED_UPPER_PRIORITIES_COUNT(_USER_CREATED_RULES_PRIORITY_UPPER_LIMITc                   (   ^  \ rS rSrU 4S jrSrU =r$ )NetworkPoliciesCompleter"   c                 4   > [         [        U ]
  " SSSS.UD6  g )Ncompute.regionNetworkPoliciesz#compute network-policies list --uri)
collectionlist_command )superr   __init__)selfkwargs	__class__s     @lib/googlecloudsdk/command_lib/compute/network_policies/flags.pyr   !NetworkPoliciesCompleter.__init__$   s(    	
"D2 2:     r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__)r   s   @r   r   r   "   s     r   r   Fc                 ^    [         R                  " SS[        UU SSR                  U5      SS9$ )NNETWORK_POLICYnetwork policynetwork policiesz"name of the network policy to {0}.r   )nameresource_name	completerpluralrequiredcustom_plural
short_helpregional_collection)compute_flagsResourceArgumentr   formatr*   r)   	operations      r   NetworkPolicyArgumentr3   ,   s8    		'	'$(&5<<YG9	
 	r   c           	      <    [         R                  " SSUU SU S3SS9$ )N--network-policyr$   z Network policy ID with which to z rule.r   )r&   r'   r)   r*   r,   r-   r.   r/   r1   s      r   NetworkPolicyRuleArgumentr7   9   s0    		'	'$3I;fE9
 r   c           
      >    [         R                  " SSUU SSU S3SS9$ )Nr5   r$   r%   z Network Policy ID with which to z association.r   )r&   r'   r)   r*   r+   r,   r-   r6   r1   s      r    NetworkPolicyAssociationArgumentr9   D   s5     
	'	'$&3I;mL9
 r   c                 $    U R                  SSS9  g)z/Adds the arguments for network policy creation.--description8An optional, textual description for the network policy.helpNadd_argumentparsers    r   AddArgNetworkPolicyCreationrC   R       E  r   rB   returnc                 $    U R                  SSS9  g)z-Adds the arguments for network policy update.r;   r<   r=   Nr?   rA   s    r   AddArgsUpdateNetworkPolicyrG   Z   rD   r   c           
      R    [         R                  " SS[        R                  SUSU S9$ )N	--networknetworkFzcompute.networks)r&   r'   r(   r)   r*   global_collectionr,   )r.   r/   compute_completersNetworksCompleter)r,   r*   s     r   NetworkArgumentForOtherResourcerN   b   s0    		'	'"44*
 r   c                 F    U R                  SSS9  U R                  SSSS9  g)	z;Adds the arguments for network policy association creation.--namez[      Name of the new association. If not specified, the name will be
      auto-generated.r=   rI   Tz:Name of the network with which the association is created.r*   r>   Nr?   rA   s    r   AddArgsCreateAssociationrR   n   s;       	G  r   c                 &    U R                  SSSS9  g)z:Adds the arguments for network policy association removal.rP   Tz"Name of the association to remove.rQ   Nr?   rA   s    r   AddArgsRemoveAssociationrT   }   s    /  r   c                 &    U R                  SSSS9  g)z>Adds the arguments for network policy association description.rP   Tz$Name of the association to describe.rQ   Nr?   rA   s    r   AddArgsDescribeAssociationrV      s    1  r   c                 
   [        U SS9  [        U SSS9  [        U SS9  [        U SS9  [	        U SS9  [        U SS9  [        U SS9  [        U SS9  [        U SS9  [        U SS9  [        U SS9  [        U SS9  [        U SS9  g)z7Adds the arguments for network policy add rules method.Fr*   addedTr2   r*   N)AddDescriptionAddRulePriorityAddRuleNameAddSrcIpRangesAddDestIpRangesAddLayer4ConfigsAddTrafficClassAddDscpModeAddDscpValueAddDisabledAddTargetServiceAccountsAddTargetSecureTags	AddActionrA   s    r   AddArgsAddRulerh      s    %(
 fu%%(&4(6D)&4(ft$v&fu%6E2fu-FT"r   r*   c                 .    U R                  SS/S USS9  g)z)Adds the action argument to the argparse.z--actionapply_traffic_classificationc                 "    U R                  5       $ Nlowerxs    r   <lambda>AddAction.<locals>.<lambda>   
    QWWYr   z:Action to take if the request matches the match condition.)choicestyper*   r>   Nr?   rB   r*   s     r   rg   rg      s'    -.G  r   c                     [        U SSS9  g)z:Adds the arguments for network policy remove rules method.removedTrZ   N)r\   rA   s    r   AddArgsRemoveRulery      s    r   c                 $    [        U SS[        S9  g)z<Adds the arguments for network policy describe rules method.	describedT)r2   r*   upper_limitN)r\   r	   rA   s    r   AddArgsDescribeRuler}      s    -	r   c                    [        U SSS9  [        U 5        [        U 5        [        U 5        [	        U SS9  [        U SS9  [        U SS9  [        U 5        [        U SS9  [        U 5        [        U 5        [        U 5        [        U SS9  g)	z:Adds the arguments for network policy update rules method.updatedTrZ   FrX   update)r2   N)r\   r[   r_   rd   ra   rb   rc   r`   AddNewPriorityr^   rf   re   rg   rA   s    r   AddArgsUpdateRuler      s    
 &f&5)fu%v&68,f6"FU#r   r2   r|   c           	      Z    U R                  S[        R                  " SUS9SU SU S3S9  g)	z3Adds the new network policy rule priority argument.z--new-priority   lower_boundupper_boundzNew priority for the rule to z. Valid priority range: [1, ].)ru   r>   Nr@   r   
BoundedInt)rB   r2   r|   s      r   r   r      sB     	!!a[I)) 5''2m27	  r   c                 D    U R                  SU[        R                  SS9  g)z$Adds the option to disable the rule.z
--disabledzJUse this flag to disable the rule. Disabled rules will not affect traffic.)r*   actionr>   N)r@   r   StoreTrueFalseActionrv   s     r   rd   rd      s+     	--  r   c           
      \    U R                  SU[        R                  " SUS9SU SU S3S9  g)	z0Adds the rule priority argument to the argparse.z
--priorityr   r   zPriority of the rule to be z. Valid in [1, r   )r*   ru   r>   Nr   )rB   r2   r*   r|   s       r   r\   r\      sE     	!!a[I'	{ 3%b*  r   c                 &    U R                  SUSS9  g)z"Adds the description of this rule.r;   z.An optional, textual description for the rule.rQ   Nr?   rv   s     r   r[   r[     s      	;  r   c                 &    U R                  SUSS9  g)zAdds the name of this rule.rP   z-An optional name for the network policy rule.rQ   Nr?   rv   s     r   r]   r]     s      	:  r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the source IP ranges.z--src-ip-rangesSRC_IP_RANGEzCIDR IP address range.ru   r*   metavarr>   Nr@   r   ArgListrv   s     r   r^   r^     s/     	 #  r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the destination IP ranges.z--dest-ip-rangesDEST_IP_RANGEz-Destination IP ranges to match for this rule.r   Nr   rv   s     r   r_   r_   +  s/     	 :  r   c           	      2    U R                  S/ SQS USSS9  g)z Adds the traffic class argument.z--traffic-class)tc1tc2tc3tc4tc5tc6c                 "    U R                  5       $ rl   rm   ro   s    r   rq   !AddTrafficClass.<locals>.<lambda>?  rs   r   TRAFFIC_CLASSz5The traffic class that be applied to matching packet.rt   ru   r*   r   r>   Nr?   rv   s     r   ra   ra   8  s)     	8B  r   c           	      2    U R                  SSS/S USSS9  g)	zAdds the DSCP mode argument.z--dscp-modeautocustomc                 "    U R                  5       $ rl   rm   ro   s    r   rq   AddDscpMode.<locals>.<lambda>M  rs   r   	DSCP_MODEzWhen set to AUTO, the DSCP value will be picked automatically based on selected traffic class. Otherwise, DSCP value must be specified.r   Nr?   rv   s     r   rb   rb   F  s1     	x Q  
r   c                 P    U R                  S[        R                  " SSS9USSS9  g)	zAdds the DSCP value argument.z--dscp-valuer   ?   r   
DSCP_VALUEz"Custom DSCP value from 0-63 range.r   Nr   rv   s     r   rc   rc   W  s3     	!!aR@/  r   c                 P    U R                  S[        R                  " 5       USSS9  g)zAdds the layer4 configs.z--layer4-configsLAYER4_CONFIGzVA list of destination protocols and ports to which the network policy rule will apply.r   Nr   rv   s     r   r`   r`   d  s1     	 %  	r   c                 P    U R                  S[        R                  " 5       SUSS9  g)z.Adds the target service accounts for the rule.z--target-service-accountsTARGET_SERVICE_ACCOUNTSz-List of target service accounts for the rule.ru   r   r*   r>   Nr   rv   s     r   re   re   t  s/     	! ':  r   c                 P    U R                  S[        R                  " 5       SUSS9  g)z&Adds a target secure tag to this rule.z--target-secure-tagsTARGET_SECURE_TAGSzdAn optional, list of target secure tags with a name of the format tagValues/ or full namespaced namer   Nr   rv   s     r   rf   rf     s1     	 "6  	r   )FFN)T)F)2__doc__
__future__r   r   r   argparsegooglecloudsdk.callioper   "googlecloudsdk.command_lib.computer   rL   r   r.   r	   int__annotations__r
   r   ListCommandCompleterr   r3   r7   r9   rC   ArgumentParserrG   rN   rR   rT   rV   rh   boolrg   ry   r}   r   strr   rd   r\   r[   r]   r^   r_   ra   rb   rc   r`   re   rf   r   r   r   <module>r      sV   C &  '  / O E#- S -(,  # ,"BB )# 
1FF 
 -1x'>'> 4 	#822 #t #*h--  $ h55 $  7 7 D $h55 $$ $0 @##  
	" 7<##/3	$ ?	##  	
 
& 7<##/3	 7<##/3	 7<
##
/3
	
 7<
##
/3
	
 7<##/3	 7<##/3	$ 7<
##
/3
	
 7<##/3	" 7<
##
/3
	
 7<##/3	r   