
    &                        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
KJr  SrSR%                  \S9SS.rSR%                  \S9SS.r " S S\5      r\
R.                  " \
R0                  R2                  5       " S S\\
R4                  5      5       r\
R.                  " \
R0                  R8                  5       " S S\\
R4                  5      5       rg)z:Command to create migration jobs for a database migration.    )absolute_import)division)unicode_literals)api_util)migration_jobs)resource_args)base)flags)logzMhttps://cloud.google.com/database-migration/docs/mysql/configure-connectivityaE  
        Create a Database Migration Service migration job.
        Recommended steps before creating the migration job:
        - Create a source connection profile. See prerequisites [here](https://cloud.google.com/database-migration/docs/mysql/configure-source-database).
        - Create a destination connection profile. For migrating to Cloud SQL for MySQL or Cloud SQL for PostgreSQL, use the cloudsql connection profile for DMS to create the CloudSQL replica for you.
        - Configure the connectivity method. See prerequisites [here]({MYSQL_CONNECTIVITY_DOC}).
        )MYSQL_CONNECTIVITY_DOCa          To create a continuous migration job with IP allowlist connectivity:

            $ {command} my-migration-job --region=us-central1 --type=CONTINUOUS
            --source=cp1 --destination=cp2

        To create a continuous migration job with VPC peering connectivity:

            $ {command} my-migration-job --region=us-central1 --type=CONTINUOUS
            --source=cp1 --destination=cp2
            --peer-vpc=projects/my-project/global/networks/my-network

        To create a one-time migration job with reverse-SSH tunnel connectivity:

            $ {command} my-migration-job --region=us-central1 --type=ONE_TIME
            --source=cp1 --destination=cp2 --vm=vm1 --vm-ip=1.1.1.1
            --vm-port=1111 --vpc=projects/my-project/global/networks/my-network
        )DESCRIPTIONEXAMPLESa  
        Create a Database Migration Service migration job.
        Recommended steps before creating the migration job:
        - Create a source connection profile. See prerequisites [here](https://cloud.google.com/database-migration/docs/mysql/configure-source-database).
        - Create a destination connection profile. For migrating to Cloud SQL for MySQL or Cloud SQL for PostgreSQL, use the cloudsql connection profile for DMS to create the CloudSQL replica for you.
        - Configure the connectivity method. See prerequisites [here]({MYSQL_CONNECTIVITY_DOC}).
        - [Heterogeneous migrations only] Create a conversion workspace.
        a          To create a continuous migration job with IP allowlist connectivity:

            $ {command} my-migration-job --region=us-central1 --type=CONTINUOUS
            --source=cp1 --destination=cp2

        To create a continuous migration job with VPC peering connectivity:

            $ {command} my-migration-job --region=us-central1 --type=CONTINUOUS
            --source=cp1 --destination=cp2
            --peer-vpc=projects/my-project/global/networks/my-network

        To create a one-time migration job with reverse-SSH tunnel connectivity:

            $ {command} my-migration-job --region=us-central1 --type=ONE_TIME
            --source=cp1 --destination=cp2 --vm=vm1 --vm-ip=1.1.1.1
            --vm-port=1111 --vpc=projects/my-project/global/networks/my-network

        To create a heterogeneous continuous migration job:

            $ {command} my-migration-job --region=us-central1 --type=CONTINUOUS
            --source=cp1 --destination=cp2 --conversion-workspace=cw

        To create a continuous SQL Server to SQL Server homogeneous migration
        job with differential backup enabled:
            $ {command} my-migration-job --region=us-central1 --type=CONTINUOUS
            --source=cp1 --destination=cp2
            --sqlserver-diff-backup
            --sqlserver-databases=db1,db2,db3

        To create a continuous SQL Server to SQL Server homogeneous migration
        job with encrypted databases:
            $ {command} my-migration-job --region=us-central1 --type=CONTINUOUS
            --source=cp1 --destination=cp2
            --sqlserver-databases=db1,db2,db3
            --sqlserver-encrypted-databases=PATH/TO/ENCRYPTION/SETTINGS
        c                   .    \ rS rSrSr\S 5       rS rSrg)_Createl   2Create a Database Migration Service migration job.c                 :   [         R                  " U 5        [         R                  " U 5        [         R                  " U SS9  [         R                  " U 5        [         R
                  " U [         R                  R                  SS9  [        R                  " U 5        g)Args 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.
TrequiredN)
mj_flagsAddNoAsyncFlagAddDisplayNameFlagAddTypeFlagAddDumpGroupFlagAddConnectivityGroupFlagApiTypeCREATEr
   AddLabelsCreateFlagsparsers    7lib/surface/database_migration/migration_jobs/create.pyArgs_Create.Argso   so     F#'$/f%%%  ''$ 
v&    c           
         UR                   R                  R                  5       nUR                  5       R	                  5       nUR                   R
                  R                  5       nUR                   R                  R                  5       nU R                  5       [        R                  R                  :X  am  UR                   R                  R                  5       nUR                   R                  R                  5       nUR                   R                  R                  5       nOSnSnSn[        R                  " U R                  5       5      n	U	R                  UUR                   UUUUUU5      n
["        R$                  " U R                  5       5      n["        R&                  " U R                  5       5      n["        R(                  " U R                  5       5      nUR+                  S5      (       a  [,        R.                  R1                  SR3                  UR                   U
R4                  5      5        ["        R6                  " XUR8                  5        [,        R.                  R1                  SR3                  UR                   U
R4                  5      5        gUR                  SU
R4                  UR:                  UR<                  S9nUR>                  RA                  URC                  URD                  S95      $ )a  Create a Database Migration Service migration job.

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.
Nno_asyncz6Waiting for migration job [{}] to be created with [{}]zCreated migration job {} [{}]z+datamigration.projects.locations.operations)operationsId
projectsIdlocationsId)name)#CONCEPTSmigration_jobParseParentRelativeNamesourcedestinationReleaseTrackr	   GAconversion_workspaceoriginal_migration_namecmek_keyr   MigrationJobsClientCreatemigrationJobsIdr   GetClientInstanceGetMessagesModuleGetResourceParserIsKnownAndSpecifiedr   statusPrintformatr+   	HandleLRO projects_locations_migrationJobsr)   r*   projects_locations_operationsGet2DatamigrationProjectsLocationsOperationsGetRequestr(   )selfargsmigration_job_ref
parent_ref
source_refdestination_refconversion_workspace_reforiginal_migration_name_refcmek_key_ref	mj_clientresult_operationclientmessagesresource_parseroperation_refs                  r"   Run_Create.Run   sz    3399;"))+88:J%%++-Jmm//557Od//222!%!C!C!I!I!K
--
/
/
5
5
7 " ]]++113l!%$(!l2243D3D3FGI '')) #	 ''(9(9(;<F))$*;*;*=>H001B1B1DEO
++	jj
B
I
I//1A1F1FHI @@B 
jj6==

+
+-=-B-BD E#**5%**$//%11	 + 3M //33CC++ 	D 	-. .r%    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr#   rV   __static_attributes__rX   r%   r"   r   r   l   s    :' ' ?.r%   r   c                   ,    \ rS rSrSr\r\S 5       rSr	g)CreateGA   r   c                    [         R                  " U SSS9  [        R                  U 5        [        R
                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U SS9  [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        g)r   	to createTr   F)	is_updateN)r   (AddHeterogeneousMigrationJobResourceArgsr   r#   r   AddFilterFlagAddCommitIdFlagAddDumpParallelLevelFlag*AddSqlServerHomogeneousMigrationConfigFlagAddDumpTypeFlag2AddMigrationJobObjectsConfigFlagForCreateAndUpdate#AddHeterogeneousMigrationConfigFlagr    s    r"   r#   CreateGA.Args   s     ::d LL6"V$%%f-77%PV$??G008r%   rX   N)
rY   rZ   r[   r\   r]   DETAILED_HELP_GAdetailed_helpr^   r#   r_   rX   r%   r"   ra   ra      s    :"-9 9r%   ra   c                   ,    \ rS rSrSr\r\S 5       rSr	g)CreateAlpha   r   c                 Z    [         R                  " U SSS9  [        R                  U 5        g)r   rd   Tr   N)r   AddMigrationJobResourceArgsr   r#   r    s    r"   r#   CreateAlpha.Args   s'     --d LLr%   rX   N)
rY   rZ   r[   r\   r]   DETAILED_HELP_ALPHArp   r^   r#   r_   rX   r%   r"   rr   rr      s    :%-
 
r%   rr   N)r]   
__future__r   r   r   )googlecloudsdk.api_lib.database_migrationr   r   r   googlecloudsdk.callioper	   -googlecloudsdk.command_lib.database_migrationr
   <googlecloudsdk.command_lib.database_migration.migration_jobsr   googlecloudsdk.corer   r   rA   rw   ro   objectr   ReleaseTracksr3   r4   Commandra   ALPHArr   rX   r%   r"   <module>r      s    A &  ' > D C ( ? Z #h  F*@FA : F*@FA$. bS.f S.l D%%(()9w 9 *94 D%%++,'4<<  -r%   