
                         $   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 create connection profiles for a database migration.    )absolute_import)division)unicode_literals)resource_args)base)flags)create_helper)oracle_flags)
console_ioBCreate a Database Migration Service connection profile for Oracle.z        To create a connection profile my-profile for Oracle:

            $ {command} my-profile --region=us-central1
            --password=123456 --username=my-user
            --host=1.2.3.4 --port=5432
        )DESCRIPTIONEXAMPLESc                   *    e Zd ZdZeZed        Zd Zy)Oracler   c                    t        j                  | d       t        j                  |        t        j                  |        t        j
                  | d       t        j                  | d       t        j                  | d       t        j                  | d       t        j                  |        t        j                  |        t        j                  |        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 createT)requiredN)r   %AddOracleConnectionProfileResourceArgcp_flagsAddNoAsyncFlagAddDisplayNameFlagAddUsernameFlagAddPasswordFlagGroupAddHostFlagAddPortFlagAddSslServerOnlyConfigGroupAddRoleFlagr
   AddDatabaseServiceFlagr   AddLabelsCreateFlags)parsers    Clib/surface/database_migration/connection_profiles/create/oracle.pyArgszOracle.Args2   s     77LF#'Vd3!!&48$/$/((0 ''/	v&    c                 t   |j                   j                  j                         }|j                         j	                         }|j
                  r4t        j                  dj                  |j                              |_
        t        j                         }|j                  | j                         |||d      S )a,  Create 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 create
      operation if the create was successful.
    z4Please Enter Password for the database user {user}: )userORACLE)CONCEPTSconnection_profileParseParentRelativeNameprompt_for_passwordr   PromptPasswordformatusernamepasswordr	   CreateHelpercreateReleaseTrack)selfargsconnection_profile_ref
parent_refhelpers        r    Runz
Oracle.RunG   s     "]]==CCE'..0==?J //
@
G
G== H dm '')F==**,j/xA Ar"   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr!   r8    r"   r    r   r   +   s%     K-' '(Ar"   r   N)r<   
__future__r   r   r   )googlecloudsdk.api_lib.database_migrationr   googlecloudsdk.callioper   -googlecloudsdk.command_lib.database_migrationr   Agooglecloudsdk.command_lib.database_migration.connection_profilesr	   r   r
   googlecloudsdk.core.consoler   r=   ReleaseTracksr2   GADefaultUniverseOnlyCommandr   r@   r"   r    <module>rK      s    F &  ' C ( ? [ _ Z 2 	M	 D%%(()1AT\\ 1A  *1Ar"   