
    =                         d 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  G d
 dej                        Zy)z?Implementation of the gcloud genomics operations list command.
    )absolute_import)division)unicode_literals)
list_pager)filter_rewrite)genomics_util)base)logc                   &    e Zd ZdZed        Zd Zy)ListzrList Genomics operations in a project.

  Prints a table with summary information on operations in the project.
  c                 t    t         j                  j                  |        | j                  ddt        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--filter a          A string for filtering operations created with the v2alpha1 API. In
        addition to typical operators (AND, OR, =, >, etc.) the following
        filter fields are supported:

          metadata.createTime - The time the operation was created as a
                                timestamp YYYY-MM-DD HH:MM:SS<time zone>.  T can
                                also be used as a separator between the date and
                                time.  The time zone is optional and can be
                                specified as an offset from UTC, a name, or 'Z'
                                for UTC. Run $ gcloud topic datetimes
                                to see more examples.
                                    2018-02-15T16:53:38
                                    2018-02-15 16:53:38-5:00
                                    2018-02-15T16:53:38Z
                                    2018-02-15 16:53:38 America/Los_Angeles
                         done - A boolean for whether the operation has
                                completed.
                   error.code - A google.rpc.Code for a completed operation.
              metadata.events - A set of strings for all events on the
                                operation.
                                    events:WorkerStartedEvent
              metadata.labels - A map of string key and value for the operation.
                                    labels.key = value
                                    labels."key with space" = "value with space"
                                For the existence of a key with any value.
                                    labels.key:*
        Run "$ gcloud topic filters" for more information.
        )defaulttypehelpN)r	   
LIMIT_FLAGAddToParseradd_argumentstr)parsers    'lib/surface/genomics/operations/list.pyArgsz	List.Args$   s7     	OO'
	       c                    t        j                  d      }t        j                  d      }d}|j                  rXt	        j
                         }|j                  |j                        \  |_        }t        j                  d|j                  |       |j                  dt        j                         d|      }t        j                  |j                  ||j                  d|j                  d	      S )
zRun 'operations list'.

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

    Returns:
      The list of operations for this project.
    v2alpha1Nz!client_filter=%r server_filter=%rz	projects/z/operations)namefilterpageSize
operations)limitbatch_size_attribute
batch_sizefield)r   GetGenomicsClientGetGenomicsMessagesr   r   OperationsBackendRewriter
   info%GenomicsProjectsOperationsListRequestGetProjectIdr   YieldFromListprojects_operationsr    )selfargsapitools_clientgenomics_messagesrequest_filterrewriterrequests          r   RunzList.RunP   s     $55jAO%99*EN{{113h$,$4$4T[[$A!dk>	hh2DKKPEE)6)C)C)EG F G ##++jj':: r   N)__name__
__module____qualname____doc__staticmethodr   r4    r   r   r   r      s!    
 ) )Vr   r   N)r8   
__future__r   r   r   apitools.base.pyr   googlecloudsdk.api_lib.genomicsr   r   googlecloudsdk.callioper	   googlecloudsdk.corer
   Commandr   r:   r   r   <module>rA      s6    '  ' ' : 9 ( #O4<< Or   