
    q                     @   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 r\R(                  \R*                  " \R,                  R.                  5       " S S\R0                  5      5       5       rSSS.\l        g)zCommand for updating hubs.    )absolute_import)division)unicode_literals)networkconnectivity_api)networkconnectivity_util)waiter)base)flags)labels_util)log)	resourcesc                    U R                  S5      (       d-  U R                  S5      (       d  U R                  S5      (       d  gUc  U R                  S4$ U R                  b.  U R                  (       a  SUl        SU4$ SUl        SUl        SU4$ U R                  b  U R                  Ul        U R
                  b  U R
                  Ul        UR                  =(       d    UR                  nX!4$ )aJ  UpdatedPscFields returns the updated PSC field values.

This method uses the existing hub and the flags to determine the new values.

Args:
  args: The arguments that the user specified.
  export_psc_config: The existing hub's exportPscConfig.

Returns:
  A tuple of the updated exportPsc field and updated exportPscConfig field.

export_psc6export_psc_published_services_and_regional_google_apisexport_psc_global_google_apis)NNNTF)IsSpecifiedr   &publishedServicesAndRegionalGoogleApisglobalGoogleApisr   r   )argsexport_psc_configupdated_export_pscs      /lib/surface/network_connectivity/hubs/update.pyUpdatedPscFieldsr   !   s    |$$			
B
 
 
		9	:	:
 ??D   
__ AE>$$$ @E<).&### 
@@LCC < 
''3)-)K)K&
 >> ,		+	+  
	..    c                   .    \ rS rSrSr\S 5       rS rSrg)Update\   z,Update a hub.

Update the details of a hub.
c                     [         R                  " U S5        [         R                  " U S5        [         R                  " U 5        [         R                  " U 5        [
        R                  " U 5        g )Nzto be updatedzNew description of the hub.)r
   AddHubResourceArgAddDescriptionFlagAddPscGroupAddAsyncFlagr   AddUpdateLabelsFlags)parsers    r   ArgsUpdate.Argsd   sM    	FO4	V%BC	f	v$$V,r   c                 ,   [         R                  " U R                  5       S9nUR                  R                  R                  5       n/ nUR                  nUb  UR                  S5        UR                  U5      n[        XR                  5      u  pxUb"  UR                  S5        UR                  S5        S n	[        R                  R                  U5      n
U
R                  5       (       ah  U
R                  UR                   R"                  R$                  UR&                  5      nUR(                  (       a  UR&                  n	UR                  S5        UR                   R#                  UUUU	S9nUR+                  X<U5      n[,        R.                  R1                  SR3                  UR5                  5       5      5        UR6                  (       a:  [,        R.                  R1                  SR3                  UR8                  5      5        U$ [:        R<                  R?                  UR8                  S	[@        RB                  U R                  5          S
9n[D        RF                  " URH                  URJ                  5      nURL                  (       a4  [,        RN                  " UR5                  5       SS9  URQ                  U5      $ [D        RR                  " UUSR3                  UR8                  5      SS9n[,        RN                  " UR5                  5       SS9  U$ )N)release_trackdescription	exportPscexportPscConfiglabels)r)   r*   r+   r,   zUpdate request issued for: [{}]z Check operation [{}] for status.z1networkconnectivity.projects.locations.operations)
collectionapi_versionhub)kindz&Waiting for operation [{}] to completei6 )max_wait_ms)*r   
HubsClientReleaseTrackCONCEPTSr/   Parser)   appendGetr   r+   r   DiffFromUpdateArgsMayHaveUpdatesApplymessages'GoogleCloudNetworkconnectivityV1betaHubLabelsValuer,   needs_updateUpdateHubBetar   statusPrintformatNameasync_namer   REGISTRYParseRelativeNamer   VERSION_MAPr   CloudOperationPollerhub_serviceoperation_servicedoneUpdatedResource	GetResultWaitFor)selfr   clienthub_refupdate_maskr)   original_hubr   updated_export_psc_configr,   labels_difflabels_updater/   op_refop_resourcepollerress                    r   Run
Update.Runl   s   $//'')F mm%%'GK""K' ::g&L4D**51
 %%*+ F""11$7K!!##!''
//
A
A
M
M


m 
	#	#%%8$
//
A
A$1	 B C !!'<FJJ6==gllnMN{{	jj9@@MNm$$66F,889J9J9LM 7 K
 ((F44F {{	',,.u5k**
..077D	C U3Jr    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr%   r]   __static_attributes__r_   r   r   r   r   \   s!    
 - -Cr   r   z   To update the description of a hub named ``my-hub'', run:

    $ {command} my-hub --description="The new description of my-hub".
  z   This command uses the networkconnectivity/v1beta API. The full documentation
  for this API can be found at:
  https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest
  )EXAMPLESzAPI REFERENCEN)rd   
__future__r   r   r   +googlecloudsdk.api_lib.network_connectivityr   r   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   /googlecloudsdk.command_lib.network_connectivityr
   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   r   DefaultUniverseOnlyReleaseTracksr3   BETACommandr   detailed_helpr_   r   r   <module>rt      s   " ! &  ' O P . ( A < # )8/v D%%**+QT\\ Q , Qj
 r   