
                             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	\R                  5      r " S
 S\R                  5      rg)z?Command for removing an interface from a Compute Engine router.    )encoding)base_classes)arg_parsers)base)flags)
exceptionsc                   ,   ^  \ rS rSrSrU 4S jrSrU =r$ )InterfaceNotFoundError   z&Raised when an interface is not found.c                    > SSR                  S/[        U5      -  5      -   [        U5      -  S-   n[        [        U ]  U5        g )Nz
interface z, z%sz
 not found)joinlentuplesuperr
   __init__)self	name_list	error_msg	__class__s      /lib/surface/compute/routers/remove_interface.pyr   InterfaceNotFoundError.__init__   sO    			Y!! !$))$457CDI	
 $      )__name__
__module____qualname____firstlineno____doc__r   __static_attributes____classcell__)r   s   @r   r
   r
      s    . r   r
   c                   Z    \ rS rSrSrSr\S 5       r\S 5       rS r	S r
S rS	 rS
 rSrg)RemoveInterface%   zrRemove an interface from a Compute Engine router.

*{command}* removes an interface from a Compute Engine router.
Nc                     [         R                  " 5       U l        U R                  R                  USS9  UR	                  SS9nUR                  SSS9  UR                  S[        R                  " 5       S	S
S9  g )Nupdate)operation_typeT)requiredz--interface-namez(The name of the interface being removed.)helpz--interface-namesINTERFACE_NAMEz/The list of names for interfaces being removed.)typemetavarr(   )r   RouterArgument
ROUTER_ARGAddArgumentadd_mutually_exclusive_groupadd_argumentr   ArgList)clsparserinterface_parsers      r   _ArgsRemoveInterface._Args-   s    ))+CNNNvh?::D:I!!!K " M!!  " >	 " @r   c                 &    U R                  U5        g N)r5   )r2   r3   s     r   ArgsRemoveInterface.Args<   s    IIfr   c                     UR                   R                  SUR                  R                  UR	                  5       UR
                  UR                  S94$ )NGet)routerregionproject)apitools_clientroutersmessagesComputeRoutersGetRequestNamer>   r?   )r   client
router_refs      r   GetGetRequestRemoveInterface.GetGetRequest@   sQ    ""**OO44!(!(("** 5 ,- -r   c           	          UR                   R                  SUR                  R                  UR	                  5       UUR
                  UR                  S94$ )NPatch)r=   routerResourcer>   r?   )r@   rA   rB   ComputeRoutersPatchRequestrD   r>   r?   )r   rE   rF   replacements       r   GetSetRequestRemoveInterface.GetSetRequestH   sT    ""**OO66!(*!(("**	 7 ,- -r   c                 L   UR                   (       a  UR                   O/ nUUR                  (       a  UR                  /O/ -   nSn/ n[        R                  " U5      n[        R                  " U5      nUR                   Ho  n	U	R
                  U;   d  M  U	nUR                  R                  U5        UR                  (       d  UR                  S5        UR                  UR
                  5        Mq     [        [        U5      [        U5      -
  5      n
U
(       a  [        U
5      eU$ )zBMutate the router and record any cleared_fields for Patch request.N
interfaces)interface_namesinterface_namer   CopyProtoMessagerQ   nameremoveappendlistsetr
   )r   argsexistingcleared_fieldsinput_remove_list	interfaceacutal_remove_listrM   existing_routerinot_found_interfaces              r   ModifyRemoveInterface.ModifyQ   s     150D0D,,")040C0C /3.A.A-BIKM I++H5K//9O''	
$	$	%%i0%%



-!!)..1 ( s#45<N8OOP"#677r   c                    [         R                  " U R                  5       5      nUR                  nU R                  R                  XR                  5      nU R                  X45      nUR                  U/5      n/ nU R                  XS   U5      nUR                  R                  U5         UR                  U R                  X4U5      /5      n	U	sS S S 5        $ ! , (       d  f       g = f)Nr   )r   ComputeApiHolderReleaseTrackrE   r-   ResolveAsResource	resourcesrG   MakeRequestsrc   r@   IncludeFieldsrN   )
r   rZ   holderrE   rF   get_requestobjectsr\   
new_objectresults
             r   _RunRemoveInterface._Runm   s    **4+<+<+>?F]]F2249I9IJJ$$V8K!!;-0G NT1:~>J				-	-n	=""f*=
>@f	 
>	=	=s   +$C
C'c                 $    U R                  U5      $ r8   )rq   )r   rZ   s     r   RunRemoveInterface.Run   s    99T?r   r   )r   r   r   r   r   r-   classmethodr5   r9   rG   rN   rc   rq   rt   r   r   r   r   r"   r"   %   sO    
 *@ @  --8&r   r"   N)r   apitools.base.pyr   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   *googlecloudsdk.command_lib.compute.routersr   googlecloudsdk.corer   Errorr
   UpdateCommandr"   r   r   r   <module>r~      sE     F & 7 / ( < *Z-- \d(( \r   