
                            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dZ G d de      Z ej&                  ej(                  j*                         G d deej,                               Z ej&                  ej(                  j0                         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)cloudsql_flags)create_helperzCreate a Database Migration Service destination connection profile for Cloud SQL. This will create a Cloud SQL replica. Used for PostgreSQL and MySQL migrations.a*            To create a connection profile for Cloud SQL with database version
          MySQL 5.6:

              $ {command} my-profile --region=us-central1
              --database-version=MYSQL_5_6 --source-id=cp1 --tier=db-n1-standard-1

          To create a connection profile for Cloud SQL and a Cloud SQL replica
          with database version PostgreSQL 10:

              $ {command} my-profile --region=us-central1
              --database-version=POSTGRES_10 --source-id=cp1
              --tier=db-custom-1-3840 --zone=us-central1-a
        )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)	_CloudSQLECreate a Database Migration Service connection profile for Cloud SQL.c                 x   t        j                  | d       t        j                  |        t        j                  |        t        j
                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        t        j                   |        t        j"                  |        t        j$                  |        t        j&                  |        t        j(                  |        t        j*                  |        t        j,                  |        t/        j0                  |        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 createN)r   (AddCloudSqlConnectionProfileResourceArgscp_flagsAddNoAsyncFlagAddDisplayNameFlagAddProviderFlagcs_flagsAddActivationPolicylagAddAuthorizedNetworksFlagAddAutoStorageIncreaseFlagAddDatabaseFlagsFlagAddDataDiskSizeFlagAddDataDiskTypeFlagAddAvailabilityTypeFlagAddEnableIpv4FlagAddPrivateNetworkFlagAddRequireSslFlagAddUserLabelsFlagAddStorageAutoResizeLimitFlagAddTierFlagAddZoneFlagAddSecondaryZoneFlagAddRootPasswordr   AddLabelsCreateFlagsparsers    Elib/surface/database_migration/connection_profiles/create/cloudsql.pyArgsz_CloudSQL.Args6   s,    ::6;OF#'V$##F+&&v.''/!!&)  (  ($$V,v&""6*v&v&**62  !!&)V$	v&    c                     |j                   j                  j                         }|j                         j	                         }t        j                         }|j                  | j                         |||d      S )a:  Create a Database Migration Service connection profile for Cloud SQL.

    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.
    CLOUDSQL)	CONCEPTSconnection_profileParseParentRelativeNamer
   CreateHelpercreateReleaseTrack)selfargsconnection_profile_ref
parent_refhelpers        r*   Runz_CloudSQL.RunU   si     "]]==CCE'..0==?J'')F==**,j/zC Cr,   N)__name__
__module____qualname____doc__staticmethodr+   r<    r,   r*   r   r   3   s    M' '<Cr,   r   c                   $    e Zd ZdZeZed        Zy)CloudSQLAlphar   c                 ^    t         j                  |        t        j                  | dd       y )NFsupport_new_versionssupport_version_name)r   r+   r   AddDatabaseVersionGroupr(   s    r*   r+   zCloudSQLAlpha.Argsn   s#    NN6$$Ur,   Nr=   r>   r?   r@   DETAILED_HELPdetailed_helprA   r+   rB   r,   r*   rD   rD   h   s    M- r,   rD   c                   $    e Zd ZdZeZed        Zy)
CloudSQLGAr   c                 0   t         j                  |        t        j                  | dd       t	        j
                  |        t        j                  |        t        j                  |        t        j                  |        t        j                  |        y )NTrF   )r   r+   r   rI   r   AddCmekResourceArgsr   AddRoleFlagAddAllocatedIpRangeFlagAddEditionFlagAddEnableDataCacheFlagr(   s    r*   r+   zCloudSQLGA.Args|   sk    NN6$$T %%f- $$V,F###F+r,   NrJ   rB   r,   r*   rN   rN   v   s    M-	, 	,r,   rN   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
   r   rK   objectr   ReleaseTracksr6   ALPHACommandrD   GArN   rB   r,   r*   <module>r_      s    F &  ' C ( ? h [ _	4	.2C 2Cj D%%++,
It|| 
 -
 D%%((),DLL , *,r,   