
                         $   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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ddZ ej&                  ej(                  j*                        ej,                   G d dej.                                      Zy)z=Command to test connection profiles for a database migration.    )absolute_import)division)unicode_literals)Any)api_util)connection_profiles)resource_args)base)flags)logzL
        Validates a Database Migration Service connection profile.
        zg        To test a connection profile:

            $ {command} my-profile --region=us-central1
        )DESCRIPTIONEXAMPLESc                   6    e Zd ZdZeZedd       ZdedefdZ	y)Testz5Test a Database Migration Service connection profile.returnNc                 Z    t        j                  | d       t        j                  |        y)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go on
        the command line after this command. Positional arguments are allowed.
    zto testN)r	   AddConnectionProfileResourceArgcp_flagsAddNoAsyncFlag)parsers    :lib/surface/database_migration/connection_profiles/test.pyArgsz	Test.Args2   s"     11&)DF#    argsc                    |j                   j                  j                         }t        j                  | j                               }|j                  |j                               }t        j                  | j                               }t        j                  | j                               }t        j                  | j                               }|j                  d      rt        j                  j                  dj!                  |j"                  |j$                               t        j&                  |||j(                         t        j                  j                  dj!                  |j"                  |j$                               y|j+                  d|j$                  |j,                  |j.                        }|j0                  j3                  |j5                  |j6                              S )a  Test a Database Migration Service connection profile.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
        with.

    Returns:
      A dict object representing the operations resource describing the test
      operation.
    no_asyncz8Waiting for connection profile [{}] to be test with [{}]z!Tested connection profile {} [{}]Nz+datamigration.projects.locations.operations)operationsId
projectsIdlocationsId)name)CONCEPTSconnection_profileParser   ConnectionProfilesClientReleaseTrackr   RelativeNamer   GetClientInstanceGetMessagesModuleGetResourceParserIsKnownAndSpecifiedr   statusPrintformatconnectionProfilesIdr    	HandleLRO%projects_locations_connectionProfilesCreater   r   projects_locations_operationsGet2DatamigrationProjectsLocationsOperationsGetRequestr   )	selfr   connection_profile_ref	cp_clientresult_operationclientmessagesresource_parseroperation_refs	            r   RunzTest.Run=   s    "]]==CCE#<<I !~~&<&I&I&KL''(9(9(;<F))$*;*;*=>H001B1B1DEO
+	jj
D
K
K$99;K;P;P 
"F$P$P 
jj
-
4
4$99;K;P;P
 #**5%**)44*66	 + M //33CC++ 	D 	
 r   )r   N)
__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   r   r=    r   r   r   r   +   s1     >-$ $3c 3c 3r   r   N)rA   
__future__r   r   r   typingr   )googlecloudsdk.api_lib.database_migrationr   r   r	   googlecloudsdk.callioper
   Agooglecloudsdk.command_lib.database_migration.connection_profilesr   r   googlecloudsdk.corer   rB   ReleaseTracksr%   GADefaultUniverseOnlyCommandr   rE   r   r   <module>rP      s    D &  '  > I C ( _ #		 D%%(()C4<< C  *Cr   