
                            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  ej                  ej                   j"                        ej$                   G d	 d
e	j&                  ej(                                      Zy)z@Command to apply conversion workspaces for a database migration.    N)Optional)resource_args)base)command_mixin)flags)datamigration_v1_messagesc                       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                     fd
Zy)Applyz8Apply a Database Migration Service conversion workspace.zTApply Database Migration Service conversion workspace onto the destination database.z        To apply a conversion workspace:

            $ {command} my-conversion-workspace --region=us-central1
            --destination-connection-profile=projects/1234/locations/us-central1/connectionProfiles/destination-connection-profile-name
        )DESCRIPTIONEXAMPLESparserreturnNc                     t        j                  | d       t        j                  |        t        j                  |        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 applyN)r   &AddConversionWorkspaceApplyResourceArgcw_flagsAddNoAsyncFlagAddFilterFlag)r   s    =lib/surface/database_migration/conversion_workspaces/apply.pyArgsz
Apply.Args-   s0     88LF#6"    argsc                 `   |j                   j                  j                         }| j                  j                  j                  |j                         |j                   j                  j                         | j                  |            }| j                  ||d|j                  d            S )a+  Apply a Database Migration Service conversion workspace.

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

    Returns:
      A dict object representing the operations resource describing the apply
      operation if the apply was successful.
    )name"destination_connection_profile_reffilter_exprAppliedno_async)conversion_workspace_refresult_operationoperation_namesync)CONCEPTSconversion_workspaceParseclient
operationsr
   RelativeNamedestination_connection_profileExtractBackendFilterHandleOperationResultIsKnownAndSpecified)selfr   r   r   s       r   Runz	Apply.Run9   s      $}}AAGGI{{--33%224+/==+W+W+]+]+_--d3 4 
 %%!9) %%j1	 &  r   )__name__
__module____qualname____doc__detailed_helpstaticmethodargparseArgumentParserr   	Namespacer   messages	Operationr-    r   r   r
   r
      se     A#- 	#8** 	#t 	# 	#h(( Xh6H6H-I r   r
   )r1   r4   typingr   )googlecloudsdk.api_lib.database_migrationr   googlecloudsdk.callioper   Cgooglecloudsdk.command_lib.database_migration.conversion_workspacesr   r   r   6googlecloudsdk.generated_clients.apis.datamigration.v1r   r7   ReleaseTracksReleaseTrackGADefaultUniverseOnly ConversionWorkspacesCommandMixinCommandr
   r9   r   r   <module>rE      sn    G   C ( ] a h D%%(()2M::DLL 2  *2r   