
                             d Z ddlmZ ddlmZ ddlm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dlmZ d ej                   d      iZej$                   ej&                  ej(                  j*                         G d dej,                                      Zej$                   ej&                  ej(                  j0                  ej(                  j2                         G d de                    Zy)z&Command for spanner operations cancel.    )absolute_import)division)unicode_literalsN)backup_operations)database_operations)instance_config_operations)instance_operations)instance_partition_operations)base)flagsEXAMPLESa~          To cancel an instance operation with ID _auto_12345, run:

          $ {command} _auto_12345 --instance=my-instance-id

        To cancel a database operation with ID _auto_12345, run:

          $ {command}  _auto_12345 --instance=my-instance-id
              --database=my-database-id

        To cancel a backup operation with ID _auto_12345, run:

          $ {command}  _auto_12345 --instance=my-instance-id
              --backup=my-backup-id

        To cancel an instance partition operation with ID auto_12345, run:

          $ {command} auto_12345 --instance=my-instance-id --instance-partition=my-partition-id
        c                   *    e Zd ZdZeZed        Zd Zy)Cancel!Cancel a Cloud Spanner operation.c                     | j                  dd      }|j                  dt        j                  d       |j                  dt        j                  d       t        j
                  |        y)	a  Args is called by calliope to gather arguments for this command.

    Please add arguments in alphabetical order except for no- or a clear-
    pair for that argument which can follow the argument itself.
    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)mutexrequiredz--instance-configzCThe ID of the instance configuration the operation is executing on.)	completerhelpz
--instancez5The ID of the instance the operation is executing on.N)	add_groupadd_argumentr   InstanceConfigCompleterInstanceCompleterAddCommonCancelArgs)parsermutex_groups     (lib/surface/spanner/operations/cancel.pyArgszCancel.Args=   sp     """=K//R  
 ))D  F
 
f%    c                 r   |j                   r*t        j                  |j                   |j                        S t	        j
                  |       |j                  r5t        j                  |j                  |j                  |j                        S |j                  r5t        j                  |j                  |j                  |j                        S |j                  r5t        j                  |j                  |j                  |j                        S t        j                  |j                  |j                        S )zThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    )instance_configr   r   	operationr   #CheckExclusiveLROFlagsUnderInstancebackupr   instancedatabaser   instance_partitionr
   r	   )selfargss     r   Runz
Cancel.RunU   s     '..t/C/C/3~~? ?
 
--d3{{%%dmmT[[&*nn6 6 }} ''t}}(,8 8*11
--00$..  %%dmmT^^DDr   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   r*    r   r   r   r   6   s$     *-& &.Er   r   c                   `     e Zd ZdZded    ej                  d      z   iZe fd       Z	 xZ
S )BetaAndAlphaCancelr   r   z        c                 4    t         t        t          |        y)ax  Args is called by calliope to gather arguments for this command.

    Please add arguments in alphabetical order except for no- or a clear-
    pair for that argument which can follow the argument itself.
    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.
    N)superr4   r   )r   	__class__s    r   r   zBetaAndAlphaCancel.Args   s     

06v>r   )r+   r,   r-   r.   r/   textwrapdedentr0   r1   r   __classcell__)r7   s   @r   r4   r4   v   sF     * -
+ohoo ? / -
 	? 	?r   r4   )r.   
__future__r   r   r   r8   googlecloudsdk.api_lib.spannerr   r   r   r	   r
   googlecloudsdk.callioper   "googlecloudsdk.command_lib.spannerr   r9   r/   DefaultUniverseOnlyReleaseTracksReleaseTrackGACommandr   ALPHABETAr4   r2   r   r   <module>rF      s    - &  '  < > E > H ( 4  ! . D%%(();ET\\ ;E * ;E| D%%++T->->-C-CD? ? E ?r   