
    b                        d Z ddl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	Z ej                   ej"                  j$                        ej&                   G d
 de	j(                  ej*                                      Zy)zACommand to commit conversion workspaces for a database migration.    N)	Generator)resource_args)base)command_mixin)flags)datamigration_v1_messagesd   c                       e Zd ZdZdddZedej                  ddfd       Zd	ej                  de
ej                  ddf   fd
Zy)DescribeDDLszCDescribe DDLs in a Database Migration Service conversion workspace.zS
        Describe DDLs in a Database Migration Service conversion workspace.
      a          To describe the DDLs of the draft tree in my-conversion-workspace in a
        project and location `us-central1`, run:

            $ {command} my-conversion-workspace --region=us-central1

        To describe the DDLs of the source tree in a conversion workspace in a
        project and location `us-central1`, run:

            $ {command} my-conversion-workspace --region=us-central1 --tree-type=SOURCE
      )DESCRIPTIONEXAMPLESparserreturnNc                 0   t        j                  | d       t        j                  | d       t        j                  |        t        j
                  |        t        j                  j                  | t               | j                  j                  d       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 describe DDLsF)requiredztable(ddl:label=DDLs)N)r   !AddConversionWorkspaceResourceArgcw_flagsAddTreeTypeFlagAddCommitIdFlagAddUncommittedFlagr   PAGE_SIZE_FLAG
SetDefault_DEFAULT_PAGE_SIZEdisplay_info	AddFormat)r   s    Elib/surface/database_migration/conversion_workspaces/describe_ddls.pyArgszDescribeDDLs.Args6   sm     33F<NOVe4V$'""6+=>
!!"=>    argsc           
      4   |j                   j                  j                         }| j                  j                  j                  |j                         |j                  |j                  |j                  | j                  |      |j                  d            S )a  Describe the DDLs for a Database Migration Service conversion workspace.

    Args:
      args: argparse.Namespace, the arguments that this command was invoked
        with.

    Returns:
      A list of DDLs for the specified conversion workspace and arguments.
    	page_size)name	commit_iduncommitted	tree_typefilter_exprr!   )CONCEPTSconversion_workspaceParsecliententitiesr   RelativeNamer#   r$   r%   ExtractBackendFilterGetValue)selfr   conversion_workspace_refs      r   RunzDescribeDDLs.RunF   s|      $}}AAGGI;;,,%224..$$..--d3--, -  r   )__name__
__module____qualname____doc__detailed_helpstaticmethodargparseArgumentParserr   	Namespacer   messages	EntityDdlr1    r   r   r   r      sp     L


	-" ?8** ?t ? ? ##T4/0r   r   )r5   r8   typingr   )googlecloudsdk.api_lib.database_migrationr   googlecloudsdk.callioper   Cgooglecloudsdk.command_lib.database_migration.conversion_workspacesr   r   r   6googlecloudsdk.generated_clients.apis.datamigration.v1r   r;   r   ReleaseTracksReleaseTrackGADefaultUniverseOnly ConversionWorkspacesCommandMixinListCommandr   r=   r   r   <module>rI      sx    H   C ( ] a h  D%%(()<22<  *<r   