
                            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
ZdZ G d de      Z ej(                  ej*                  j,                         G d deej.                               Z ej(                  ej*                  j2                         G d de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)
console_ioACreate a Database Migration Service connection profile for MySQL.a      To create a connection profile for MySQL:

        $ {{command}} my-profile --region=us-central1 --password=123456
        --username=my-user --host=1.2.3.4 --port=3306

    If the source is a Cloud SQL database, run:

        $ {{command}} my-profile --region=us-central1 --password=123456
        --username=my-user --host=1.2.3.4 --port=3306
        --{instance}=my-instance --provider=CLOUDSQL
    c                   &    e Zd ZdZed        Zd Zy)_MySQLr   c                    t        j                  | d       t        j                  |        t        j                  |        t        j
                  | d       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 createF)require_passwordN)	r   AddConnectionProfileResourceArgcp_flagsAddNoAsyncFlagAddDisplayNameFlagAddDatabaseParamsFlagsAddProviderFlagr   AddLabelsCreateFlagsparsers    Blib/surface/database_migration/connection_profiles/create/mysql.pyArgsz_MySQL.Args/   s\     11&+FF#'##FUCV$	v&    c                 @   |j                   j                  j                         }|j                         j	                         }|j
                  rt        j                  d      |_        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.
    zPlease Enter Password: MYSQL)CONCEPTSconnection_profileParseParentRelativeNameprompt_for_passwordr
   PromptPasswordpasswordr	   CreateHelpercreateReleaseTrack)selfargsconnection_profile_ref
parent_refhelpers        r   Runz
_MySQL.Run?   s     "]]==CCE'..0==?J //0IJdm'')F==**,j/w@ @r   N)__name__
__module____qualname____doc__staticmethodr   r.    r   r   r   r   ,   s    I' '@r   r   c                   J    e Zd ZdZeej                  d      dZed        Z	y)
MySQLAlphar   instancer7   DESCRIPTIONEXAMPLESc                     t         j                  |        t        j                  | t        j
                  j                         t        j                  |        y N)r   r   r   AddSslConfigGroupr   r(   ALPHAAddInstanceFlagr   s    r   r   zMySQLAlpha.Args^   s8    
KKvt'8'8'>'>?V$r   N
r/   r0   r1   r2   r:   r;   formatdetailed_helpr3   r   r4   r   r   r6   r6   U   s3    I !//:/6-
 % %r   r6   c                   J    e Zd ZdZeej                  d      dZed        Z	y)MySQLGAr   zcloudsql-instancer8   r9   c                     t         j                  |        t        j                  | t        j
                  j                         t        j                  |        t        j                  |        y r=   )	r   r   r   r>   r   r(   GAAddCloudSQLInstanceFlagAddRoleFlagr   s    r   r   zMySQLGA.Argsn   sF    
KKvt'8'8';';<$$V, r   NrA   r4   r   r   rE   rE   e   s4    I !//+>/?-
 ! !r   rE   N)r2   
__future__r   r   r   )googlecloudsdk.api_lib.database_migrationr   googlecloudsdk.callioper   -googlecloudsdk.command_lib.database_migrationr   Agooglecloudsdk.command_lib.database_migration.connection_profilesr	   r   googlecloudsdk.core.consoler
   r:   r;   objectr   ReleaseTracksr(   r?   Commandr6   rG   rE   r4   r   r   <module>rS      s    F &  ' C ( ? [ _ 2&@V &@R D%%++,% % -% D%%(()!fdll ! *!r   