
    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  \R                  \R                  " \R                  R                   5       " S
 S\R"                  5      5       5       rSSS.\l        g)zCommand for listing spokes.    )absolute_import)division)unicode_literals)networkconnectivity_api)base)parser_arguments)filter_rewrite)flagsc                   J    \ rS rSrSr\S\R                  4S j5       rS r	Sr
g)QueryStatus   zBQuery the status of Private Service Connect propagation for a hub.parserc                     [         R                  R                  U 5        [        R                  " U S5        U R                  SSS9  U R                  R                  S5        g )Nz0to query Private Service Connect propagation forz
--group-byaO  
        Comma-separated list of resource field key names to group by. Aggregated
        values will be displayed for each group. If `--group-by` is set, the value
        of the `--sort-by` flag must be the same as or a subset of the `--group-by`
        flag.

        Accepted values are:
        - 'psc_propagation_status.source_spoke'
        - 'psc_propagation_status.source_group'
        - 'psc_propagation_status.source_forwarding_rule'
        - 'psc_propagation_status.target_spoke'
        - 'psc_propagation_status.target_group'
        - 'psc_propagation_status.code'
        )helpae  
      table(
        pscPropagationStatus.sourceForwardingRule.basename(),
        pscPropagationStatus.sourceSpoke.basename(),
        pscPropagationStatus.sourceGroup.basename(),
        pscPropagationStatus.targetSpoke.basename(),
        pscPropagationStatus.targetGroup.basename(),
        pscPropagationStatus.code:label=CODE,
        count)
        )r   URI_FLAGRemoveFromParserr
   AddHubResourceArgadd_argumentdisplay_info	AddFormat)r   s    5lib/surface/network_connectivity/hubs/query_status.pyArgsQueryStatus.Args"   sb     	MM""6*	F   " !! 	# 	    c                   ^ 1 SkmU R                  5       n[        R                  " U5      nUR                  R                  R                  5       n/ nUR                  (       a  UR                  R                  SS5      R                  S5      n[        U4S jU 5       5      (       dW  [        SR                  SR                  [        [        U5      T-
  5      5      SR                  [        T5      5      5      5      eSnUR                  (       a0  [         R"                  " 5       R%                  UR                  5      u  pvSUl        / nUR&                  (       a}  UR&                  n[        U4S	 jU 5       5      (       dW  [        S
R                  SR                  [        [        U5      T-
  5      5      SR                  [        T5      5      5      5      eSn	UR(                  (       a  UR(                  n	Sn
UR*                  (       a  UR*                  n
UR-                  UUSR                  U5      SR                  U5      U
U	S9$ )N>   psc_propagation_status.code#psc_propagation_status.source_group#psc_propagation_status.source_spoke#psc_propagation_status.target_group#psc_propagation_status.target_spoke-psc_propagation_status.source_forwarding_rule  ,c              3   ,   >#    U  H	  oT;   v   M     g 7fN .0xvalid_fieldss     r   	<genexpr>"QueryStatus.Run.<locals>.<genexpr>U   s     >o|#o   z0Invalid group-by fields: {} valid fields are:
{}z, 
c              3   ,   >#    U  H	  oT;   v   M     g 7fr&   r'   r(   s     r   r,   r-   i   s     =n|#nr.   z0Invalid sort-by fields: {}, valid fields are:
{}i  d   )filter_expressiongroup_byorder_by	page_sizelimit)ReleaseTrackr   
HubsClientCONCEPTShubParser3   replacesplitall
ValueErrorformatjoinsortedsetfilterr	   BackendFilterRewriteRewritesort_byr6   r5   QueryHubStatus)selfargsrelease_trackclienthub_refgroup_by_fieldsr2   _sort_by_fieldsr6   r5   r+   s              @r   RunQueryStatus.RunF   s   L %%'M$//>Fmm%%'G!#O}}#'==#8#8b#A#G#G#Lo>o>>>?FF		&#o"6"EGH		&./
 	
  {{+@@BJJ
++a DKN||"&,,n=n===?FF		&#n"5"DFG		&./
 	
 EzzjjeI~~..i  +/*.) !  r   r'   N)__name__
__module____qualname____firstlineno____doc__staticmethodr   ArgumentInterceptorr   rQ   __static_attributes__r'   r   r   r   r      s.     K!#77 ! !F:r   r   a     To query the Private Service Connect propagation status of a hub, run:

        $ {command} HUB

  To query the Private Service Connect propagation status of a hub grouped by source spoke and code, run:

        $ {command} HUB --group-by="psc_propagation_status.source_spoke,psc_propagation_status.code"

  To query the Private Service Connect propagation status of a hub sorted by the source forwarding rule, run:

        $ {command} HUB --sort-by="psc_propagation_status.source_forwarding_rule"

  z   This command uses the networkconnectivity/v1 API. The full documentation
  for this API can be found at:
  https://cloud.google.com/network-connectivity/docs/reference/networkconnectivity/rest
  )EXAMPLESzAPI REFERENCEN)rW   
__future__r   r   r   +googlecloudsdk.api_lib.network_connectivityr   googlecloudsdk.callioper   r   /googlecloudsdk.command_lib.network_connectivityr	   r
   DefaultUniverseOnlyReleaseTracksr7   GAListCommandr   detailed_helpr'   r   r   <module>re      s     " &  ' O ( 4 J A D%%(()a$"" a * aJ r   