
                             S r SSKrSSKJr  SSKJr  SSKJr  SSKJr  SSK	J
r
  SSKJr  SS	KJr  S
SS.rSrSrSr " S S\
R&                  5      rg)zList operation command.    N)
list_pager)	constants)dataproc)util)base)flags)
propertiesACTIVE
NON_ACTIVE)activeinactiveoperation_state_matchercluster_name
project_idc                   .    \ rS rSrSr\S 5       rS rSrg)List%   a(  View the list of all operations.

View a list of operations in a project. An optional filter can be used to
constrain the operations returned. Filters are case-sensitive and have the
following syntax:

  field = value [AND [field = value]] ...

where `field` is either of `status.state` or `labels.[KEY]`, where `[KEY]` is
a label key. `value` can be ```*``` to match all values. `status.state` is
one of: `PENDING`, `ACTIVE`, `DONE`. Only the logical `AND` operator is
supported; space-separated items are treated as having an implicit `AND`
operator.

## EXAMPLES

To see the list of all operations in Dataproc's 'us-central1' region, run:

  $ {command} --region='us-central1'

To see the list of all create cluster operations in Dataproc's 'global'
region, run:

  $ {command} --region='global' --filter='operationType = CREATE'

To see the list of all active operations in a cluster named 'mycluster'
located in Dataproc's 'global' region, run:

  $ {command} --region='global' --filter='status.state = RUNNING AND
    clusterName = mycluster'

To see a list of all pending operations with the label `env=staging` on
cluster `mycluster` located in Dataproc's 'us-central1' region, run:

  $ {command} --region='us-central1' --filter='status.state = PENDING
    AND labels.env = staging AND clusterName = mycluster'
c                 n   [         R                  R                  U 5        [         R                  R	                  U [
        R                  5        [        R                  " U 5        U R                  SSS9  U R                  S[        [        R                  5       5      SS9  [        R                  " U 5        g )Nz	--clusterzRestrict to the operations of this Dataproc cluster. This flag is ignored when --filter is specified. The equivalent term in a --filter expression is: `clusterName = myclustername`)helpz--state-filterzFilter by cluster state. This flag is ignored when --filter is specified. The equivalent term in a --filter expression is: `status.state = ACTIVE`)choicesr   )r   URI_FLAGRemoveFromParserPAGE_SIZE_FLAG
SetDefaultr   DEFAULT_PAGE_SIZEr   AddRegionFlagadd_argumentsortedSTATE_MATCHER_MAPkeysAddListOperationsFormat)parsers    'lib/surface/dataproc/operations/list.pyArgs	List.ArgsL   s    MM""6*""69+F+FG	
H  J (--/0(  * 
!!&)    c           	         [         R                  " U R                  5       5      n[        R                  n[
        R                  R                  R                  R                  nUR                  R                  S X4S.SS9n[        5       nUR                  (       a  [        UR                     U[        '   UR                   (       a  UR                   U["        '   S nUR$                  (       a  UR$                  nS Ul        O[&        R(                  " U5      nUR*                  R-                  UR/                  5       US9n[0        R2                  " UR4                  R6                  UUR8                  SUR:                  SS9$ )N)regionId	projectIdz)dataproc.projects.regions.operations_list)params
collection)namefilter
operationspageSize)limitfield
batch_sizebatch_size_attribute)dpDataprocReleaseTrackr   ResolveRegionr	   VALUEScoreproject	GetOrFail	resourcesParsedictstate_filterr   STATE_MATCHER_FILTERclusterCLUSTER_NAME_FILTERr-   jsondumpsmessages,DataprocProjectsRegionsOperationsListRequestRelativeNamer   YieldFromListclientprojects_regions_operationsr0   	page_size)	selfargsr   region_callbackproject_callbackoperation_list_reffilter_dict	op_filterrequests	            r#   RunList.Runb   s8   {{4,,./H((O!((--55??!++11+K> 2 @
 &K*;D<M<M*Nk&'||)-k%&I{{++i dk**[)iLL,,.y M BG ##33jj>>') )r&    N)	__name__
__module____qualname____firstlineno____doc__staticmethodr$   rT   __static_attributes__rV   r&   r#   r   r   %   s!    $L * **$)r&   r   )r[   rC   apitools.base.pyr   googlecloudsdk.api_lib.dataprocr   r   r4   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataprocr   googlecloudsdk.corer	   r   r@   rB   PROJECT_FILTERListCommandr   rV   r&   r#   <module>re      sV       ' 5 : 0 ( 5 *  (\B 0 $ a)4 a)r&   