
    r                         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  \R                  " \R                  R                  5      \R                   " S S	\R                   \R"                  5      5       5       rg)
z^Command to import rules in a conversion workspaces for a database migration from config files.    N)resource_args)base)command_mixin)flags)logc                   x    \ rS rSrSrSSS.r\S\R                  SS4S	 j5       r	S
\R                  SS4S jrSrg)ImportRules   zJImport mapping rules in a Database Migration Service conversion workspace.z
        Import mapping rules in a Database Migration Service conversion
        workspace from a configuration file. For example, for Oracle to
        PostgreSQL migrations that could be an Ora2Pg config file.
      z        To import rules in a conversion workspace:

            $ {command} my-conversion-workspace --region=us-central1
            --file-format=ORA2PG --config-files=PATH1/config1.conf,PATH2/config2.conf
        )DESCRIPTIONEXAMPLESparserreturnNc                     [         R                  " U S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to import rulesN)r   !AddConversionWorkspaceResourceArgcw_flagsAddImportFileFormatFlagAddConfigFilesFlagAddAutoCommitFlag)r   s    Dlib/surface/database_migration/conversion_workspaces/import_rules.pyArgsImportRules.Args-   s?     33F<MN$$V,'v&    argsc                    UR                   R                  R                  5       nU R                  R                  R                  UR                  5       UR                  UR                  UR                  S9nUR                  bE  [        R                  R                  SUR                   SUR                  R                   S35        g[        R                  R                  SUR                   35        g)zImport rules in a Database Migration Service conversion workspace.

Args:
  args: argparse.Namespace, The arguments that this command was invoked
    with.
)nameconfig_filesfile_formatauto_commitNz0Imported mapping rules for conversion workspace z failed with error [])CONCEPTSconversion_workspaceParseclient
operationsr	   RelativeNamer   r   r   errorr   statusPrintconversionWorkspacesIdmessage)selfr   conversion_workspace_refresult_operations       r   RunImportRules.Run:   s      $}}AAGGI {{--99%224&&$$$$	 :  )	jj&==> ?%++334A7 
jj&==>@r    )__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodargparseArgumentParserr   	Namespacer.   __static_attributes__r0   r   r   r	   r	      sZ     S

- 
'8** 
't 
' 
'h(( T r   r	   )r5   r8   )googlecloudsdk.api_lib.database_migrationr   googlecloudsdk.callioper   Cgooglecloudsdk.command_lib.database_migration.conversion_workspacesr   r   r   googlecloudsdk.corer   ReleaseTracksReleaseTrackGADefaultUniverseOnly ConversionWorkspacesCommandMixinCommandr	   r0   r   r   <module>rF      si    e  C ( ] a # D%%(():-@@$,, :  *:r   