
                            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  SS
KJr  SS	KJr  SSKJr  \
R0                  " \
R2                  R4                  5       " S S\
R6                  5      5       r\
R0                  " \
R2                  R:                  5       " S S\5      5       r\
R0                  " \
R2                  R>                  5       " S S\5      5       r g)z=Command for updating an interface on a Compute Engine router.    )absolute_import)division)unicode_literals)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._Args1   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.ArgsF       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Namer4   r5   )selfclient
router_refs      r&   GetGetRequestUpdateInterface.GetGetRequestJ   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)r3   routerResourcer4   r5   )r6   r7   r8   ComputeRoutersPatchRequestr:   r4   r5   )r;   r<   r=   replacements       r&   GetSetRequestUpdateInterface.GetSetRequestU   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_versionr8   RouterInterfaceIpVersionValueValuesEnum	ipVersionvpn_tunnel_regionr4   
vpn_tunnelr   ResolveAsResourcecompute_flagsGetDefaultScopeListerSelfLinklinkedVpnTunnelinterconnect_attachment_regioninterconnect_attachmentr!   linkedInterconnectAttachmentr	   ArgumentException)
r;   r<   	resourcesargsexistingrD   ifaceivpn_refattachment_refs
             r&   ModifyUpdateInterface.Modifya   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ReleaseTrackr<   r   rY   rb   r>   MakeRequestsri   r   statusPrintrP   rK   rE   )r;   rc   holderr<   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+   ru   r;   rc   s     r&   RunUpdateInterface.Run       99T?r)    )__name__
__module____qualname____firstlineno____doc__r   r   r!   classmethodr'   r.   r>   rE   ri   ru   rz   __static_attributes__r}   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+   rx   ry   s     r&   rz   UpdateInterfaceBeta.Run   r|   r)   c                 $    U R                  U5      $ r+   r,   r-   s     r&   r.   UpdateInterfaceBeta.Args   r0   r)   r}   N)	r~   r   r   r   r   rz   r   r.   r   r}   r)   r&   r   r      s       r)   r   c                       \ rS rSrSrSrg)UpdateInterfaceAlpha   r   r}   N)r~   r   r   r   r   r   r}   r)   r&   r   r      s     r)   r   N)!r   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r	   "googlecloudsdk.command_lib.computer
   rZ   <googlecloudsdk.command_lib.compute.interconnects.attachmentsr   *googlecloudsdk.command_lib.compute.routersr   r   .googlecloudsdk.command_lib.compute.vpn_tunnelsr   googlecloudsdk.corer   ReleaseTracksrm   GAUpdateCommandr   BETAr   ALPHAr   r}   r)   r&   <module>r      s    D &  ' % 7 ( 1 E M C $ D%%(()Ud(( U *Up D%%**+/  , D%%++,.  -r)   