
                            S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  SSKJ
r  S
SS.r " S S\5      r\R&                  " \R(                  R*                  5       " S S\\R,                  5      5       r\R&                  " \R(                  R0                  5       " S S\\R,                  5      5       rg)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                   .    \ rS rSrSr\S 5       rS rSrg)	_CloudSQL3   ECreate a Database Migration Service connection profile for Cloud SQL.c                    [         R                  " U S5        [        R                  " U 5        [        R                  " U 5        [        R
                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                   " U 5        [        R"                  " U 5        [        R$                  " U 5        [        R&                  " U 5        [        R(                  " U 5        [        R*                  " U 5        [        R,                  " U 5        [.        R0                  " U 5        g)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Args_CloudSQL.Args6   s,    ::6;OF#'V$##F+&&v.''/!!&)  (  ($$V,v&""6*v&v&**62  !!&)V$	v&    c                     UR                   R                  R                  5       nUR                  5       R	                  5       n[
        R                  " 5       nUR                  U R                  5       UX!S5      $ )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+   Run_CloudSQL.RunU   sg     "]]==CCE'..0==?J'')F==**,j/zC Cr.    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr,   r>   __static_attributes__r@   r.   r+   r   r   3   s    M' '<Cr.   r   c                   ,    \ rS rSrSr\r\S 5       rSr	g)CloudSQLAlphah   r   c                 Z    [         R                  U 5        [        R                  " U SSS9  g )NFsupport_new_versionssupport_version_name)r   r,   r   AddDatabaseVersionGroupr)   s    r+   r,   CloudSQLAlpha.Argsn   s#    NN6$$Ur.   r@   N
rA   rB   rC   rD   rE   DETAILED_HELPdetailed_helprF   r,   rG   r@   r.   r+   rI   rI   h   s    M- r.   rI   c                   ,    \ rS rSrSr\r\S 5       rSr	g)
CloudSQLGAv   r   c                 6   [         R                  U 5        [        R                  " U SSS9  [        R
                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        g )NTrL   )r   r,   r   rO   r   AddCmekResourceArgsr   AddRoleFlagAddAllocatedIpRangeFlagAddEditionFlagAddEnableDataCacheFlagr)   s    r+   r,   CloudSQLGA.Args|   sk    NN6$$T %%f- $$V,F###F+r.   r@   NrQ   r@   r.   r+   rU   rU   v   s    M-	, 	,r.   rU   N)rE   
__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   rR   objectr   ReleaseTracksr8   ALPHACommandrI   GArU   r@   r.   r+   <module>rh      s    F &  ' C ( ? h [ _	4	.2C 2Cj D%%++,
It|| 
 -
 D%%((),DLL , *,r.   