
                             S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSKJr  \	R                   " S	 S
\	R                  5      5       rSSS.\l        g)zQCommand for adding a term to an existing Route Policy of a Compute Engine router.    )absolute_import)division)unicode_literals)base_classes)arg_parsers)base)flagsc                   2    \ rS rSrSrSr\S 5       rS rSr	g)AddRoutePolicyTerm   zFAdds a new term to an existing route policy of a Comute Engine router.Nc           
      T   [         R                  " 5       [        l        [        R                  R	                  USS9  UR                  SSSS9  UR                  SSS[        R                  " S	S
S9S9  UR                  SSSS9  UR                  SSS[        R                  " SS9SS9  g )Nupdate)operation_typez--policy-namez2Name of the route policy to which to add the term.T)helprequiredz
--priorityz$Order of the term within the policy.r   i)lower_boundupper_bound)r   r   typez--matchz$CEL expression for matching a route.z	--actionszRSemicolon separated CEL expressions for the actions to take when the rule matches.;)custom_delim_charACTION)r   r   r   metavar)	r	   RouterArgumentr   
ROUTER_ARGAddArgumentadd_argumentr   
BoundedIntArgList)clsparsers     4lib/surface/compute/routers/add_route_policy_term.pyArgsAddRoutePolicyTerm.Args#   s    $)$8$8$:!!!--fX-N
E  
 7##zJ	   7  
 e  37      c                 B   [         R                  " U R                  5       5      nUR                  nUR                  R                  nUR                  R
                  R                  n[        R                  R                  UUR                  [        R                  " U5      S9nUR                  UR                  " S0 UR                  5       DSUR                   0D65      R"                  nUR%                  UR&                  UR)                  UR*                  S9UR,                   Vs/ s H  nUR)                  US9PM     snS9n	UR.                  R1                  U	5        USUR2                  " S0 UR                  5       DSU0D64n
UR5                  U
/5      S   $ s  snf )	N)scope_listerpolicy)
expression)prioritymatchactionsPatchRoutePolicyroutePolicyr    )r   ComputeApiHolderReleaseTrackclientmessagesapitools_clientroutersr   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerGetRoutePolicy#ComputeRoutersGetRoutePolicyRequestAsDictpolicy_nameresourceRoutePolicyPolicyTermr)   Exprr*   r+   termsappend%ComputeRoutersPatchRoutePolicyRequestMakeRequests)selfargsholderr1   r2   service
router_refroute_policycel_expressionnew_termrequests              r!   RunAddRoutePolicyTerm.Run?   s   **4+<+<+>?F]]F}}%%Hmm++33G#..@@"88@ A J
 ))44 	
!	
*.*:*:	
 h	 
 --mmtzzm2 #',,
". MM^M4".
 . H h' 	66 	
!	
$	
G y)!,,
s   'Fr.   )
__name__
__module____qualname____firstlineno____doc__r   classmethodr"   rM   __static_attributes__r.   r$   r!   r   r      s!    N* 6"-r$   r   z/  *{command}* adds a term to a route policy.
  af            To add a term with priority 0  with match `destination == '192.168.0.0/16'` and actions `drop()` to a route policy `my-policy` of a router `my-router` in region `us-central1`, run:

              $ {command} my-router --region=us-central1 --policy-name=my-policy --priority=0 --match="destination == '192.168.0.0/16'" --actions="drop()"

          )DESCRIPTIONEXAMPLESN)rS   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r7   *googlecloudsdk.command_lib.compute.routersUniverseCompatibleUpdateCommandr   detailed_helpr.   r$   r!   <module>r`      sc     X &  ' 7 / ( E < C-++ C- C-N	
$   r$   