
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ e	j                   G d
 de	j                                Zddde_        y)zDCommand for removing a route policy term of a Compute Engine router.    )absolute_import)division)unicode_literals)base_classes)arg_parsers)base)flags)route_policy_utilsc                   *    e Zd ZdZdZed        Zd Zy)RemoveRoutePolicyTermz6Remove a route policy term of a Compute Engine router.Nc           	          t        j                         t        _        t        j                  j	                  |d       |j                  ddd       |j                  dddt        j                  d	d
             y )Nzremove a route policy term from)operation_typez--policy-namez?Name of the route policy from which the term should be removed.T)helprequiredz
--priorityz$Order of the term within the policy.r   i)lower_boundupper_bound)r   r   type)r	   RouterArgumentr   
ROUTER_ARGAddArgumentadd_argumentr   
BoundedInt)clsparsers     7lib/surface/compute/routers/remove_route_policy_term.pyArgszRemoveRoutePolicyTerm.Args"   s    ',';';'=$$$00@ 1  R  
 7##zJ	      c                 d   t        j                  | j                               }|j                  }|j                  j                  }|j                  j
                  j                  }t        j                  j                  ||j                  t        j                  |            }|j                   |j                  di |j                         d|j                   i      j"                  }t%        j&                  ||j(                        }|j*                  j-                  |       g }	|j*                  s|	j/                  d       |d |j0                  di |j                         d|if}
|j
                  j3                  |	      5  |j5                  |
g      }d d d        |S # 1 sw Y   S xY w)N)scope_listerpolicytermsPatchRoutePolicyroutePolicy )r   ComputeApiHolderReleaseTrackclientmessagesapitools_clientroutersr   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerGetRoutePolicy#ComputeRoutersGetRoutePolicyRequestAsDictpolicy_nameresourcer
   FindPolicyTermOrRaisepriorityr!   removeappend%ComputeRoutersPatchRoutePolicyRequestIncludeFieldsMakeRequests)selfargsholderr'   r(   service
router_refroute_policytermcleared_fieldsrequestresults               r   RunzRemoveRoutePolicyTerm.Run4   s   **4+<+<+>?F]]F}}%%Hmm++33G&11CC"88@ D J
 ))444 	
!	
*.*:*:	
 h	  33L$--PDd#NG$ 	666 	
!	
$	
G 
			-	-n	=""G9-f 
>M 
>Ms   F%%F/)__name__
__module____qualname____doc__r   classmethodr   rE   r$   r   r   r   r      s!    >* "#r   r   z6*{command}* removes a term of a route policy.
        z         To remove a route policy term with priority 0 from a route policy `my-policy` from a router `my-router` in region `us-central1`, run:

              $ {command} my-router --region=us-central1 --policy-name=my-policy --priority=0
          )DESCRIPTIONEXAMPLESN)rI   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r-   *googlecloudsdk.command_lib.compute.routersr
   UniverseCompatibleDeleteCommandr   detailed_helpr$   r   r   <module>rU      sc    K &  ' 7 / ( E < I :D.. : :z		'  #r   