
                         n   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dlmZ ddlmZ d ej&                  d      iZej*                   ej,                  ej.                  j0                         G d dej2                                      Zej*                   ej,                  ej.                  j6                         G d de                    Zej*                   ej,                  ej.                  j:                         G d de                    Zy)z(Command for spanner operations describe.    )absolute_import)division)unicode_literalsN)backup_operations)database_operations)instance_config_operations)instance_operations)instance_partition_operations)ssd_cache_operations)base)
exceptions)flagsEXAMPLESaa          To describe a Cloud Spanner instance operation, run:

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

        To describe a Cloud Spanner database operation, run:

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

        To describe a Cloud Spanner backup operation, run:

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

        To describe an instance partition operation, 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)Describe#Describe 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AddCommonDescribeArgs)parsermutex_groups     *lib/surface/spanner/operations/describe.pyArgszDescribe.Args?   sp     """=K//R  
 ))D  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 )This 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   Get	operationr   #CheckExclusiveLROFlagsUnderInstancebackupr   instancedatabaser   instance_partitionr
   r	   )selfargss     r   RunzDescribe.RunW   s     '++D,@,@,0NN< <
 
--d3{{""4==$++t~~NN}} $$T]]DMM%)^^5 5*..
--00$..  ""4==$..AAr!   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr    r.    r!   r   r   r   8   s$     ,-( (.B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 )BetaDescriber   r   z        c                 4    t         t        t          |        y)x  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)superr8   r    r   	__class__s    r   r    zBetaDescribe.Args   s     
,*62r!   )r/   r0   r1   r2   r3   textwrapdedentr4   r5   r    __classcell__r=   s   @r   r8   r8   w   sF     , -
+ohoo ? / -
 	3 	3r!   r8   c                   6     e Zd ZdZe fd       Z fdZ xZS )AlphaDescriber   c                     t         t        t          |        t        j                  dddd      j                  |        y)r:   FTz6The ID of the SSD Cache the operation is executing on.)
positionalr   hiddentextN)r;   rC   r    r   SsdCacheAddToParserr<   s    r   r    zAlphaDescribe.Args   s8     
-,V4	NNE	
 k&r!   c                     |j                   rW|j                  rt        j                  dd      t	        j
                  |j                  |j                   |j                        S t        | %  |      S )r#   z--instance or --ssd-cachez8The `--instance` flag cannot be used with `--ssd-cache`.)
	ssd_cacher)   c_exceptionsInvalidArgumentExceptionr   r%   r&   r$   r;   r.   )r,   r-   r=   s     r   r.   zAlphaDescribe.Run   sg     ~~	33'F
 	
 "%%
..$..$*>*>  7;tr!   )r/   r0   r1   r2   r5   r    r.   r@   rA   s   @r   rC   rC      s$     , $ r!   rC   )r2   
__future__r   r   r   r>   googlecloudsdk.api_lib.spannerr   r   r   r	   r
   r   googlecloudsdk.callioper   r   rL   "googlecloudsdk.command_lib.spannerr   r?   r3   DefaultUniverseOnlyReleaseTracksReleaseTrackGADescribeCommandr   BETAr8   ALPHArC   r6   r!   r   <module>rY      s   / &  '  < > E > H ? ( > 4  ! . D%%(():Bt## :B * :Bz D%%**+38 3 , 3* D%%++,*L * - *r!   