
                             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
rSr\R$                  " \R&                  R(                  5       " S S\R*                  5      5       rg)z:Command to update a Distributed Cloud Edge Network router.    )absolute_import)division)unicode_literals)routers)base)resource_args)flags)loga%  Update a Distributed Cloud Edge Network router.

Note that `update` operations are not thread-safe, meaning that if more than one
user is updating a router at a time, there can be race conditions. Please ensure
that at most one `update` operation is being applied to a given router at a
time.
a      To add a northbound route advertisement for destination range 8.8.0.0/16 for Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:

        $ {command} my-router --add-advertisement-ranges=8.8.0.0/16 --location=us-central1 --zone=us-central1-edge-den1

    To remove a northbound route advertisement for destination range 8.8.0.0/16 for Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:

        $ {command} my-router --remove-advertisement-ranges=8.8.0.0/16 --location=us-central1 --zone=us-central1-edge-den1

    To replace the set of route advertisements with just 8.8.0.0/16 and 1.1.0.0/16, in Distributed Cloud Edge Network router 'my-router' in edge zone 'us-central1-edge-den1' , run:

        $ {command} my-router --set-advertisement-ranges=8.8.0.0/16,1.1.0.0/16 --location=us-central1 --zone=us-central1-edge-den1
   c                   >    \ rS rSrSr\\S.r\S 5       r	S r
S rSrg)	Update2   zuUpdate a Distributed Cloud Edge Network router.

*{command}* is used update a Distributed Cloud Edge Network router.
)DESCRIPTIONEXAMPLESc                     [         R                  " U SS5        [        R                  " U 5        [        R
                  R                  U 5        g )Nzto be updatedT)r   AddRouterResourceArgrouters_flagsAddUpdateArgsr   
ASYNC_FLAGAddToParser)parsers    3lib/surface/edge_cloud/networking/routers/update.pyArgsUpdate.Args;   s4    &&vE'OO'    c                    [         R                  " U R                  5       5      nUR                  R                  R                  5       nU R                  U5      (       d  g UR                  X15      n[        USS5      nU(       d6  UR                  U5      n[        R                  " UR                  5       SS9  U$ [        R                  R                  SR                  UR                  5       UR                   5      5        g )Nasync_FzOperation was successful.)detailsz$Updating [{0}] with operation [{1}].)r   RoutersClientReleaseTrackCONCEPTSrouterParsehas_routes_argChangeAdvertisementsgetattrWaitForOperationr
   UpdatedResourceRelativeNamestatusPrintformatname)selfargsrouters_client
router_refupdate_req_opr   responses          r   Run
Update.RunA   s    **4+<+<+>?N%%++-Jt$$"77
IMT8U+F00?h	

!
!
#-HJoJJ;BB!=#5#57 8r   c                     UR                   UR                  UR                  /n[        S U5      n[	        S U 5       5      nUS:X  a  gUS:X  a  g[        S5      e)Nc              3   &   #    U  H  nS v   M	     g7f)   N ).0_s     r   	<genexpr>(Update.has_routes_arg.<locals>.<genexpr>[   s     +(Qq(s   r   Fr7   TzwInvalid argument: Expected at most one of add_advertisement_ranges remove_advertisement_ranges set_advertisement_ranges)add_advertisement_rangesremove_advertisement_rangesset_advertisement_rangesfiltersum
ValueError)r-   r.   relevant_argsfilterednumber_founds        r   r#   Update.has_routes_argT   sl    %%((%%M
 dM*H+(++Lqq
	?@ @r   r8   N)__name__
__module____qualname____firstlineno____doc__r   r   detailed_helpstaticmethodr   r3   r#   __static_attributes__r8   r   r   r   r   2   s0    
 #.8D-( (
8&@r   r   N)rK   
__future__r   r   r   4googlecloudsdk.api_lib.edge_cloud.networking.routersr   googlecloudsdk.callioper   0googlecloudsdk.command_lib.edge_cloud.networkingr   8googlecloudsdk.command_lib.edge_cloud.networking.routersr	   r   googlecloudsdk.corer
   r   r   ReleaseTracksr   ALPHAUpdateCommandr   r8   r   r   <module>rX      sl    A &  ' H ( J [ # D%%++,0@T 0@ -0@r   