
    N                     ^   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  \R                  " \R                  R                   \R                  R"                  5      \R$                   " S S\R&                  5      5       5       rS\	R*                  SS4S jrg)z+Command for listing Cloud Run Integrations.    )absolute_import)division)unicode_literals)types_utils)base)parser_extensions)deprecation_util)flags)run_apps_operationsc                   8    \ rS rSrSrSSS.r\S 5       rS rSr	g	)
List   zList Cloud Run Integrations.z"          {description}
          aN            List all Cloud Run Integrations within the current project

              $ {command}

          List all Cloud Run Integrations of a particular type

              $ {command} --type=redis

          List all Cloud Run Integrations attached to a particular Service

              $ {command} --service=my-service

         )DESCRIPTIONEXAMPLESc                 \    [         R                  " U5        [         R                  " U5        g)zPSet up arguments for this command.

Args:
  parser: An argparse.ArgumentParser.
N)r
   ListIntegrationsOfServiceListIntegrationsOfType)clsparsers     $lib/surface/run/integrations/list.pyArgs	List.Args8   s      
##F+	  (    c                 6   [         R                  " 5         [         R                  " 5         [        U5        UR                  nUR
                  nU R                  5       nUR                  S5      (       a  SO[        R                  n[        R                  " X5       nUR                  S5      (       a  UR                  5         U(       a  [        R                  " U5        UR                  X#U[        R                  5      sSSS5        $ ! , (       d  f       g= f)a.  Lists all the Cloud Run Integrations.

All regions are listed by default similar to Cloud Run services unless
a specific region is provided with the --region flag.

Args:
  args: ArgumentParser, used to reference the inputs provided by the user.

Returns:
  dict with a single key that maps to a list of integrations.
  This will be used by the integration_list_printer to format all
  the entries in the list.

  The reason this is not a list is because the printer will only recieve
  one entry at a time and cannot easily format all entries into a table.
regionN)r	   CheckIfEndOfSaleAppliesDeprecationNotice
_SetFormattypeserviceReleaseTrackIsSpecifiedr   ALL_REGIONSConnectVerifyLocationr   CheckValidIntegrationTypeListIntegrationsSERVICE_TYPE)selfargsintegration_typeservice_namerelease_trackr   clients          r   RunList.RunB   s    " ,,.&&(tyy<<L%%'M&&x00d&22  
	$	$T	9V 
		(	#	#	--.>?$$
&+2J2J 
:	9	9s   A$D


D N)
__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr   r/   __static_attributes__r1   r   r   r   r      s1     %-, ) )$r   r   	namespacereturnNc                     / SQnU R                  5       R                  SR                  SR                  U5      S95        g )N)z'formatted_latest_resource_status:label=z"integration_name:label=INTEGRATIONzintegration_type:label=TYPEzregion:label=REGIONzservices:label=SERVICEztable({columns}),)columns)GetDisplayInfo	AddFormatformatjoin)r:   r>   s     r   r   r   i   s<    ' &&(9:r   )r6   
__future__r   r   r   'googlecloudsdk.api_lib.run.integrationsr   googlecloudsdk.callioper   r   +googlecloudsdk.command_lib.run.integrationsr	   r
   r   ReleaseTracksr!   ALPHABETADefaultUniverseOnlyListCommandr   	Namespacer   r1   r   r   <module>rM      s    2 &  ' ? ( 5 H = K D%%++T->->-C-CDG4 G  EGT+55 $ r   