
                            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  SSKJr  \R(                  " \R*                  R,                  5       " S	 S
\R.                  5      5       r\R(                  " \R*                  R2                  5       " S S\5      5       r\R(                  " \R*                  R6                  5       " S S\5      5       rg)z=Command for updating an interface on a Compute Engine router.    )encoding)base_classes)base)parser_errors)flags)router_utils)logc                   b    \ rS rS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)UpdateInterface"   xUpdate an interface on a Compute Engine router.

*{command}* is used to update an interface on a Compute Engine
router.
Nc                    [         R                  " 5       U l        U R                  R                  USS9  UR	                  SS9n[
        R                  " SSS9U l        U R                  R                  U5        [        R                  " SSS9U l
        U R                  R                  U5        [         R                  " USS9  g )	Nupdate)operation_typeF)requiredupdated)r   r   T)
for_update)router_flagsRouterArgument
ROUTER_ARGAddArgumentadd_mutually_exclusive_groupvpn_tunnel_flagsVpnTunnelArgumentForRouterVPN_TUNNEL_ARGattachment_flags'InterconnectAttachmentArgumentForRouterINTERCONNECT_ATTACHMENT_ARGAddInterfaceArgs)clsparserlink_parsers      /lib/surface/compute/routers/update_interface.py_ArgsUpdateInterface._Args.   s    !002CNNNvh?55u5EK)DDyC "";/ 	@@9	
 #
 ##//<!!&T:    c                 $    U R                  U5      $ Nr$   r    r!   s     r#   ArgsUpdateInterface.ArgsC       99V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Namer1   r2   )selfclient
router_refs      r#   GetGetRequestUpdateInterface.GetGetRequestG   sQ    &&00??$$$&& 	1 	
 r&   c           	          UR                   R                  SUR                  R                  UR	                  5       UUR
                  UR                  S94$ )NPatch)r0   routerResourcer1   r2   )r3   r4   r5   ComputeRoutersPatchRequestr7   r1   r2   )r8   r9   r:   replacements       r#   GetSetRequestUpdateInterface.GetSetRequestR   sT    &&22??$&$$&&	 	3 	
	 	r&   c                 N   [         R                  " U5      nS nUR                   H!  nUR                  UR                  :X  d  M  Un  O   Uc   [
        R                  " UR                  5      eUR                  b9  UR                  b,  SR                  UR                  UR                  5      Ul
        O/UR                  c  UR                  b  [
        R                  " 5       eUR                  b4  UR                  R                  R                  UR                  5      Ul        UR"                  (       d  UR$                  Ul        UR&                  bD  U R(                  R+                  UU[,        R.                  " U5      S9nUR1                  5       Ul        UR4                  (       d  UR$                  Ul        UR6                  b0  U R8                  R+                  X25      n	U	R1                  5       Ul        UR2                  b#  UR:                  b  [<        R>                  " S5      eU$ )Nz{0}/{1})scope_listerzJcannot have both vpn-tunnel and interconnect-attachment for the interface.) r   CopyProtoMessage
interfacesnameinterface_namer   InterfaceNotFoundError
ip_addressmask_lengthformatipRange"RequireIpAddressAndMaskLengthError
ip_versionr5   RouterInterfaceIpVersionValueValuesEnum	ipVersionvpn_tunnel_regionr1   
vpn_tunnelr   ResolveAsResourcecompute_flagsGetDefaultScopeListerSelfLinklinkedVpnTunnelinterconnect_attachment_regioninterconnect_attachmentr   linkedInterconnectAttachmentr   ArgumentException)
r8   r9   	resourcesargsexistingrA   ifaceivpn_refattachment_refs
             r#   ModifyUpdateInterface.Modify^   s   ++H5KE##	
4&&	& $
 }//0C0CDD 	#$*:*:*F&&t8H8HIem
//
%4+;+;+G;;=="
//
)
)
B
Boo o !!*11d"##55

$::6B 6 g
 &..0e..,7,>,>d)##/77II
n ,:+B+B+De( 	)..:++ 
 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U R                  UUR                  UUS   5      nUS   U:X  a=  [        R                  R                  SR                  US   R                  5      5        U$ UR                  U R                  X4U5      /5      $ )z=Issues requests necessary to update interfaces of the Router.r   z/No change requested; skipping update for [{0}].)r   ComputeApiHolderReleaseTrackr9   r   rV   r_   r;   MakeRequestsrf   r	   statusPrintrM   rH   rB   )r8   r`   holderr9   r:   get_requestobjects
new_objects           r#   _RunUpdateInterface._Run   s    **4+<+<+>?F]]F2249I9IJJ$$V8K!!;-0G
	J qzZ	jj
;
B
Bajoo
 n			F
	;< r&   c                 $    U R                  U5      $ r(   rr   r8   r`   s     r#   RunUpdateInterface.Run       99T?r&    )__name__
__module____qualname____firstlineno____doc__r   r   r   classmethodr$   r+   r;   rB   rf   rr   rw   __static_attributes__rz   r&   r#   r   r   "   sZ     *. $; ;(  	
7r@r&   r   c                   .    \ rS rSrSrS r\S 5       rSrg)UpdateInterfaceBeta   r   c                 $    U R                  U5      $ r(   ru   rv   s     r#   rw   UpdateInterfaceBeta.Run   ry   r&   c                 $    U R                  U5      $ r(   r)   r*   s     r#   r+   UpdateInterfaceBeta.Args   r-   r&   rz   N)	r{   r|   r}   r~   r   rw   r   r+   r   rz   r&   r#   r   r      s       r&   r   c                       \ rS rSrSrSrg)UpdateInterfaceAlpha   r   rz   N)r{   r|   r}   r~   r   r   rz   r&   r#   r   r      s     r&   r   N)r   apitools.base.pyr   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer   rW   <googlecloudsdk.command_lib.compute.interconnects.attachmentsr   *googlecloudsdk.command_lib.compute.routersr   r   .googlecloudsdk.command_lib.compute.vpn_tunnelsr   googlecloudsdk.corer	   ReleaseTracksrj   GAUpdateCommandr   BETAr   ALPHAr   rz   r&   r#   <module>r      s    D & 7 ( 1 E M C $ D%%(()Ud(( U *Up D%%**+/  , D%%++,.  -r&   