
    D                         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  SS	KJr  \	R                   " S
 S\	R                   5      5       rS rSSS.\l        g)zDCommand for updating a route policy term of a Compute Engine router.    )absolute_import)division)unicode_literals)base_classes)arg_parsers)base)flags)route_policy_utilsc                   2    \ rS rSrSrSr\S 5       rS rSr	g)UpdateRoutePolicyTerm   zEUpdates a term of 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-namez=Name of the route policy to which the term should be updated.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     7lib/surface/compute/routers/update_route_policy_term.pyArgsUpdateRoutePolicyTerm.Args"   s    ',';';'=$$$00x 1  P  
 7##zJ	   7  
 e  37      c                    [         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[$        R&                  " XqR(                  5      n[+        XU5        USUR,                  " S0 UR                  5       DSU0D64n	UR/                  U	/5      S   $ )N)scope_listerpolicyPatchRoutePolicyroutePolicyr    )r   ComputeApiHolderReleaseTrackclientmessagesapitools_clientroutersr   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerGetRoutePolicy#ComputeRoutersGetRoutePolicyRequestAsDictpolicy_nameresourcer
   FindPolicyTermOrRaisepriority_UpdatePolicyTermMessage%ComputeRoutersPatchRoutePolicyRequestMakeRequests)
selfargsholderr.   r/   service
router_refroute_policytermrequests
             r"   RunUpdateRoutePolicyTerm.Run@   s5   **4+<+<+>?F]]F}}%%Hmm++33G&11CC"88@ D J
 ))44 	
!	
*.*:*:	
 h	  33L--PDTT266 	
!	
$	
G y)!,,r%   r+   )
__name__
__module____qualname____firstlineno____doc__r   classmethodr#   rH   __static_attributes__r+   r%   r"   r   r      s!    M* :-r%   r   c                     UR                  UR                  S9U l        UR                   Vs/ s H  nUR                  US9PM     snU l        g s  snf )N)
expression)Exprmatchactions)rF   r/   rA   cel_expressions       r"   r=   r=   _   sM    }}

}3$* !LL(. mm~m.($, s   Az>        *{command}* updates a term of a route policy.
        a          To update a term with priority 128 with match `destination == '192.168.0.0/24'` and actions `med.set(12345);asPath.prependSequence([1, 2])` of a route policy `example-policy-name` of a router `example-router` in region `router-region`, run:

          $ {command} example-router --region=router-region --policy-name=example-policy-name --priority=128 --match="destination == '192.168.0.0/24'" --actions="med.set(12345);asPath.prependSequence([1, 2])"

        )DESCRIPTIONEXAMPLESN)rN   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r4   *googlecloudsdk.command_lib.compute.routersr
   UniverseCompatibleUpdateCommandr   r=   detailed_helpr+   r%   r"   <module>ra      sh    K &  ' 7 / ( E < I ?-D.. ?- ?-D'  #r%   