
                             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 Zd Z G d dej&                        Zy)z!bigtable operations list command.    )absolute_import)division)unicode_literalsN)
list_pager)util)base)	arguments)
properties)	resourcesc                 t    t         j                  j                  | j                  d      j	                         S )Nzbigtableadmin.operations
collection)r   REGISTRYParseRelativeNamenameSelfLink)resources    'lib/surface/bigtable/operations/list.py_GetUriFunctionr      s1    				-	-mm+ 
. 
--5XZ8    c                 r    | j                  d      }|j                  d      }dj                  |dd       }|S )z*Get operation name without project prefix.r   /   N)getsplitjoin)r   operation_nameresults
short_names       r   _TransformOperationNamer    %   s<     <<'.  %'xx$*	r   c                   p    e Zd ZdZ ej
                  d       ej
                  d      dZed        Zd Z	y)ListOperationszList Cloud Bigtable operations.z4          List Cloud Bigtable operations.
          z          To list all operations for the default project, run:

            $ {command}

          To list all operations for instance INSTANCE_NAME, run:

            $ {command} --instance=INSTANCE_NAME
          )DESCRIPTIONEXAMPLESc                     t        j                  | dd       | j                  j                  d       | j                  j	                  t
               | j                  j                  dt        i       y)z Register flags for this command.zto list operations forFrequireda)  
          table(
             name():label=NAME,
             done,
             metadata.firstof(startTime, requestTime, progress.start_time).date():label=START_TIME:sort=1:reverse,
             metadata.firstof(endTime, finishTime, progress.end_time).date():label=END_TIME
           )
        r   N)r	   AddInstanceResourceArgdisplay_info	AddFormat
AddUriFuncr   AddTransformsr    )parsers    r   ArgszListOperations.ArgsA   se     $$V%=.35 !! #  ""?3
%%v/F&GHr   c                    t        j                         }dt        j                  j	                  t
        j                  j                  j                  j                  d      d      j                         z   }|j                  d      r|dz   |j                  z   }t        j                         j                  |      }t        j                   |j"                  |d	d
      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.
    zoperations/Tr&   zbigtableadmin.projectsr   instancez/instances/)r   
operationsN)fieldbatch_size_attribute)r   GetAdminClientr   r   Parser
   VALUEScoreprojectGetRelativeNameIsSpecifiedr0   GetAdminMessages4BigtableadminOperationsProjectsOperationsListRequestr   YieldFromListoperations_projects_operations)selfargscliref_namemsgs        r   RunzListOperations.RunR   s     


Cy1177&&**D*9+  8  --9\^<H 
#M)DMM9h 		=	= 
> 
 
 ##**!	# #r   N)
__name__
__module____qualname____doc__textwrapdedentdetailed_helpstaticmethodr.   rE    r   r   r"   r"   /   sQ    ' %X__ &  "(// # 	- I I #r   r"   )rI   
__future__r   r   r   rJ   apitools.base.pyr   googlecloudsdk.api_lib.bigtabler   googlecloudsdk.callioper   #googlecloudsdk.command_lib.bigtabler	   googlecloudsdk.corer
   r   r   r    ListCommandr"   rN   r   r   <module>rV      sD    ( &  '  ' 0 ( 9 * )8>#T%% >#r   