
                            d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 d Z G d d	      Z G d
 d      Z ej                  dd       ej                  ej                   j"                         G d deej$                                      Z ej                  ej                   j(                         G d deej$                               Zy)z2Implementation of connection profile list command.    )connection_profiles)base)resource_args)concept_parsers)
propertiesc                 \    t        j                         j                  | j                        S )z/Gets the resource URI for a connection profile.)r   ConnectionProfilesClientGetUriname)connection_profile_infos    2lib/surface/datastream/connection_profiles/list.py_GetUrir      s)     
	5	5	7	>	>""
$ $    c                       e Zd ZdZd Zy)_ConnectionProfileInfoz<Container for connection profile data using in list display.c                 x    |j                   | _        |j                  | _        || _        |j                  | _        y )N)displayNamedisplay_namer   type
createTimecreate_time)selfmessagedb_types      r   __init__z_ConnectionProfileInfo.__init__#   s0    ++DDIDI))Dr   N)__name__
__module____qualname____doc__r    r   r   r   r       s
    D*r   r   c                   ,    e Zd ZdZed        Zd Zd Zy)_Listz6Base class for listing Datastream connection profiles.c                     t         j                  j                  dt        j                         dd      j                  |       |j                  j                  d       y)z Register flags for this command.z
--locationz:The location you want to list the connection profiles for.T)
group_helprequiredz
          table(
            display_name,
            name:label=ID,
            type,
            create_time.date():label=CREATED
          )
        N)r   ConceptParserForResourcer   GetLocationResourceSpecAddToParserdisplay_info	AddFormat)clsparsers     r   Argsz
_List.Args-   sW     !!----/O	 .  #{6*
!! # r   c           	         t        j                         }t        j                  j                  j
                  j                  d      }|j                  ||      }|D cg c]  }t        || j                  |             c}S c c}w )zRuns the command.

    Args:
      args: All the arguments that were provided to this command invocation.

    Returns:
      An iterator over objects containing connection profile data.
    T)r%   )
r   r	   r   VALUEScoreprojectGetListr   _GetType)r   args	cp_client
project_idprofilesprofiles         r   Runz	_List.Run@   s~     $<<>I""''//33T3BJ~~j$/H  G 	wg(>?  s   "Bc                     t         )zGets DB type of a connection profile.

    Args:
      profile: A connection configuration type of a connection profile.

    Returns:
      A String representation of the provided profile DB type.
      Default is None.
    )NotImplementedErrorr   r:   s     r   r5   z_List._GetTypeR   s
     r   N)r   r   r   r   classmethodr.   r;   r5   r    r   r   r"   r"   *   s!    > $$
r   r"   FznDatastream beta version is deprecated. Please use`gcloud datastream connection-profiles list` command instead.)
is_removedwarningc                       e Zd ZdZd Zy)ListBetau  List Datastream connection profiles.

  List connection profiles.

  ## API REFERENCE
    This command uses the datastream/v1 API. The full documentation
    for this API can be found at: https://cloud.google.com/datastream/

  ## EXAMPLES
    To list all connection profiles in a project and location 'us-central1',
    run:

        $ {command} --location=us-central1

  c                 l    |j                   ry|j                  ry|j                  ry|j                  ryy )NMySQLOracleGoogle Cloud Storage
SQL Server)mysqlProfileoracleProfile
gcsProfilesqlServerProfiler>   s     r   r5   zListBeta._GetTypev   s5    						#		!	!r   Nr   r   r   r   r5   r    r   r   rC   rC   _   s     
r   rC   c                       e Zd ZdZd Zy)r4   rD   c                     |j                   ry|j                  ry|j                  ry|j                  ry|j                  ry|j
                  ry|j                  ry|j                  ryy )	NrF   rG   
PostgreSQLrH   rI   
SalesforceBigQueryMongoDB)rJ   rK   postgresqlProfilerL   rM   salesforceProfilebigqueryProfilemongodbProfiler>   s     r   r5   zList._GetType   se    					"	"			#		!	!		"	"		 	 			r   NrN   r    r   r   r4   r4      s     r   r4   N)r   !googlecloudsdk.api_lib.datastreamr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.datastreamr   (googlecloudsdk.command_lib.util.conceptsr   googlecloudsdk.corer   r   r   r"   	DeprecateReleaseTracksReleaseTrackBETAListCommandrC   GAr4   r    r   r   <module>rd      s    9 B ( ? D *$* *2 2j E
 D%%**+ud&&  ,< D%%(()#5$"" # *#r   