
                            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      \	R*                   " S S\	R,                  5      5       5       r\	R$                  " \	R&                  R0                  5       " S S\5      5       r\	R$                  " \	R&                  R4                  5       " S S\5      5       rSS0\l        g)z,Command for updating Compute Engine routers.    )base_classes)routers_utils)poller)waiter)base)flags)router_utils)log)	resources)
console_ioc                   H    \ rS rSrSrSr\S 5       r\S 5       rS r	S r
Srg)	Update   Update a Compute Engine router.Nc                 \   [         R                  " 5       U l        U R                  R                  USS9  [        R
                  R                  U5        [         R                  " U5        [         R                  " U5        [         R                  " U5        [         R                  " US5        g )Nupdate)operation_typerouter)r   RouterArgument
ROUTER_ARGAddArgumentr   
ASYNC_FLAGAddToParserAddKeepaliveIntervalArgAddBgpIdentifierRangeArg	AddAsnArg AddUpdateCustomAdvertisementArgsclsparsers     %lib/surface/compute/routers/update.py_ArgsUpdate._Args%   ss    ))+CNNNvh?OO'	!!&)	""6*	OOF	**68<    c                 &    U R                  U5        g )N)r"   r   s     r!   ArgsUpdate.Args/   s    IIfr$   c           
         [         R                  " U5        [        R                  " U R	                  5       5      nUR
                  R                  nUR
                  R                  R                  nU R                  R                  XR                  5      nUR                  nUR                  U" S0 UR                  5       D65      nUR                  =(       d    UR!                  5       Ul        UR                  R"                  nUR$                  b!  ['        UR                  SUR$                  5        UR(                  b!  ['        UR                  SUR(                  5        UR*                  b!  ['        UR                  SUR*                  5        [         R,                  " U5      (       a}  [         R.                  " X3R                   US9u  pn[         R0                  " UUR                   UU	S9  U	U
US.nUR3                  5        H   u  pUc  M
  ['        UR                  X5        M"     [         R4                  " U5      (       Ga  [         R6                  " UUR                   UR                  S9  UR8                  (       aN  [:        R<                  " UR                   UR8                  S9nUR                  R>                  RA                  U5        URB                  (       aT  [:        R<                  " UR                   URB                  S9n[         RD                  " UUR                   UR                  US	9  URF                  (       aC  [:        RH                  " X1RF                  S
9nUR                  RJ                  RA                  U5        URL                  (       a5  [         RN                  " UUR                   UR                  URL                  S9  [         RP                  " U5      (       a  [R        RT                  " SSS9  / nUR                  R>                  (       d  URW                  S5        UR                  RJ                  (       d  URW                  S5        UR
                  R                  RY                  U5         URZ                  nUR]                  U" UR^                  UR`                  URc                  5       US95      nS S S 5        [        Rd                  Rg                  WRh                  SUR^                  UR`                  S.S9nURj                  (       a6  [l        Rn                  " USRq                  URc                  5       5      SSS9  U$ UR                  Rg                  URc                  5       SUR^                  UR`                  S.S9n[r        Rt                  " UU5      n[v        Rx                  " UUSRq                  URc                  5       5      5      $ ! , (       d  f       GN"= f)NkeepaliveIntervalidentifierRangeasn)messagesresource_classargs)r,   r-   existing_modenew_mode)advertiseModeadvertisedGroupsadvertisedIpRanges)r,   r-   resource)r-   groups)r,   r-   r4   r5   )r,   	ip_ranges)r,   r-   r4   r6   ac  Caution: You can specify custom advertised routes on a Cloud Router and on a BGP session. Custom advertised routes on the Cloud Router apply to all of its BGP sessions. However, if you specify any custom advertised route on a BGP session, all of the Cloud Router's advertised routes are ignored and overridden by the BGP session's custom advertised route.T)messagecancel_on_nozbgp.advertisedGroupszbgp.advertisedIpRanges)projectregionr   routerResourcezcompute.regionOperations)r9   r:   )
collectionparamszrouter [{0}]z[Run the [gcloud compute operations describe] command to check the status of this operation.)kindis_asyncdetailszcompute.routerszUpdating router [{0}] )=r	   CheckIncompatibleFlagsOrRaiser   ComputeApiHolderReleaseTrackclientr,   apitools_clientroutersr   ResolveAsResourcer   ComputeRoutersGetRequestGetAsDictbgp	RouterBgpr1   keepalive_intervalsetattrbgp_identifier_ranger+   HasReplaceAdvertisementFlagsParseAdvertisementsPromptIfSwitchToDefaultModeitems HasIncrementalAdvertisementFlagsValidateCustomModeadd_advertisement_groupsr   ParseGroupsr2   extendremove_advertisement_groupsRemoveGroupsFromAdvertisementsadd_advertisement_rangesParseIpRangesr3   remove_advertisement_ranges RemoveIpRangesFromAdvertisements!HasUpdateAdvertisementRangesFlagsr   PromptContinueappendIncludeFieldsComputeRoutersPatchRequestPatchr9   r:   NameREGISTRYParsenameasync_r
   UpdatedResourceformatr   Pollerr   WaitFor)selfr.   holderr,   service
router_refrequest_typereplacementr/   moder5   rangesattrsattrvaluegroups_to_addgroups_to_removeip_ranges_to_addcleared_fieldsresultoperation_reftarget_router_refoperation_pollers                          r!   _RunUpdate._Run3   s   ..t4**4+<+<+>?F}}%%Hmm++33G2249I9IJJ44L++lAZ->->-@ABK!oo=););)=KOOO11M*koo2D4K4KL  ,koo0$2K2KLxxkooudhh/0066)==,>,>TdF ..!++%	  $ &e +$
+//4
/ ' 44T::%%!++?? 
	&	&%11#--00
 	((//>		)	)(44#--33
 	33#-- __#		
 
	&	&(66)F)F
 	**112BC		)	)55#-- __66		
 55d;;? 
 N??++23??--45		&	&	4	4^	D88l}}
 ((&&__&(	f 
E &&,,-!)) ''
 - M {{	
$$Z__%677 m((..$!)) ''
 /  }}W.?@>>&&z'89 U 
E	Ds   :AW
W+c                 $    U R                  U5      $ )zSee base.UpdateCommand.)r   )ro   r.   s     r!   Run
Update.Run   s    99T?r$   rA   )__name__
__module____qualname____firstlineno____doc__r   classmethodr"   r&   r   r   __static_attributes__rA   r$   r!   r   r      s>     (*= =  Zxr$   r   c                       \ rS rSrSrSrg)
UpdateBeta   r   rA   Nr   r   r   r   r   r   rA   r$   r!   r   r          'r$   r   c                       \ rS rSrSrSrg)UpdateAlpha   r   rA   Nr   rA   r$   r!   r   r      r   r$   r   DESCRIPTIONzH
        *{command}* is used to update a Compute Engine router.
        N)r   googlecloudsdk.api_lib.computer   r   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   *googlecloudsdk.command_lib.compute.routersr   r	   googlecloudsdk.corer
   r   googlecloudsdk.core.consoler   ReleaseTracksrD   GAUniverseCompatibleUpdateCommandr   BETAr   ALPHAr   detailed_helprA   r$   r!   <module>r      s    3 8 8 < . ( < C # ) 2 D%%(()qT q  *qh D%%**+  , D%%++,*  -   r$   