
                  	       2   S r SSK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  \R                  \R                   " \R"                  R$                  5      \R&                   " S
 S\
R(                  \R*                  5      5       5       5       rg)zBCommand to convert conversion workspaces for a database migration.    N)resource_args)application_code_converter)conversion_params)base)command_mixin)flags)concept_parsersc                   t    \ rS rSrSrSSS.r\S\R                  SS4S	 j5       r	S
\R                  4S jrSrg)ConvertApplicationCode   zConvert the application code.z
        Convert the provided source code from accessing the source database to
        accessing the destination database.
      zz        To convert the application code:

            $ {command} --source-file=Path/to/source --region=us-central1
      )DESCRIPTIONEXAMPLESparserreturnNc                 8   [         R                  R                  S[        R                  " 5       SSS9R                  U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " U 5        [        R                  " 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--regionzThe location of the resource.T)
group_helprequiredN)r	   ConceptParserForResourcer   GetRegionResourceSpecAddToParsercw_flagsAddSourceDialectFlagAddTargetDialectFlagAddSourceDetailsFlagAddTargetPathFlag)r   s    Plib/surface/database_migration/conversion_workspaces/convert_application_code.pyArgsConvertApplicationCode.Args1   sv     !!--++-2	 . 
 k&!!&)!!&)!!&)v&    argsc           	      l   [         R                  " UR                  R                  R	                  5       R                  5       UR                  UR                  UR                  UR                  UR                  S9n[        R                  " UU R                  R                  S9nUR                  5         g)zwConvert the application code.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
    with.
)namesource_dialecttarget_dialectsource_foldertarget_pathsource_file)params	ai_clientN)r   ApplicationCodeConversionParamsCONCEPTSregionParseRelativeNamer$   r%   r&   r'   r(   r   ApplicationCodeConverterclientaiConvert)selfr!   r)   	converters       r   RunConvertApplicationCode.RunD   s     >>]]!!'')668****(($$$$F +CC++..I r     )__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodargparseArgumentParserr   	Namespacer6   __static_attributes__r8   r    r   r   r      sR     &


- '8** 't ' '$h(( r    r   )r=   r@   )googlecloudsdk.api_lib.database_migrationr   Sgooglecloudsdk.api_lib.database_migration.conversion_workspaces.app_code_conversionr   r   googlecloudsdk.callioper   Cgooglecloudsdk.command_lib.database_migration.conversion_workspacesr   r   r   (googlecloudsdk.command_lib.util.conceptsr	   HiddenReleaseTracksReleaseTrackGADefaultUniverseOnly ConversionWorkspacesCommandMixinCommandr   r8   r    r   <module>rP      s}    I  C z q ( ] a D D%%(()822LL8  * 8r    