
                             S r SSKJr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	KJr  S
\\\4   S\4S jrS
\\\4   S\4S jr\R(                   " S S\R*                  5      5       rg)zList cluster command.    )AnyDict)
list_pager)	constants)dataproc)util)base)flags)
propertiesclusterreturnc                 X    SU ;   a$  SU S   ;   a  U S   S   nSU;   d  SU;   d  SU;   a  gg)NconfiglifecycleConfigidleDeleteTtlautoDeleteTtlautoDeleteTimeenabled  r   lifecycle_configs     %lib/surface/dataproc/clusters/list.py_HasScheduledDeleter      sI    .'(2CCx():;++..//	    c                 X    SU ;   a$  SU S   ;   a  U S   S   nSU;   d  SU;   d  SU;   a  gg)Nr   r   idleStopTtlautoStopTtlautoStopTimer   r   r   r   s     r   _HasScheduledStopr    (   sI    .'(2CCx():;)),,--	r   c                   >    \ rS rSrSr\S 5       rS r\S 5       rSr	g)List4   a  View a list of clusters in a project.

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

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

where `field` is one of `status.state`, `clusterName`, or `labels.[KEY]`,
and `[KEY]` is a label key. `value` can be ```*``` to match all values.
`status.state` can be one of the following: `ACTIVE`, `INACTIVE`,
`CREATING`, `RUNNING`, `ERROR`, `DELETING`, or `UPDATING`. `ACTIVE`
contains the `CREATING`, `UPDATING`, and `RUNNING` states. `INACTIVE`
contains the `DELETING` and `ERROR` states. `clusterName` is the name of the
cluster provided at creation time. 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 clusters in Dataproc's 'us-central1' region, run:

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

To show a cluster in Dataproc's 'global' region with the name 'mycluster',
run:

  $ {command} --region='global' --filter='clusterName = mycluster'

To see the list of all clusters in Dataproc's 'global' region with specified
labels, run:

  $ {command} --region='global' --filter='labels.env = staging AND
    labels.starred = *'

To see a list of all active clusters in Dataproc's 'europe-west1' region with
specified labels, run:

  $ {command} --region='europe-west1' --filter='status.state = ACTIVE AND
    labels.env = staging AND labels.starred = *'
c                 L   [         R                  " U 5        [        R                  R	                  U 5        [        R
                  R                  U [        R                  5        U R                  R                  S5        U R                  R                  [        [        S.5        g )Na  
          table(
            clusterName:label=NAME,
            config.gceClusterConfig.yesno(yes=GCE, no=GKE):label=PLATFORM,
            config.workerConfig.numInstances:label=PRIMARY_WORKER_COUNT,
            config.secondaryWorkerConfig.numInstances:label=SECONDARY_WORKER_COUNT,
            status.state:label=STATUS,
            config.firstof(
                gkeClusterConfig.namespacedGkeDeploymentTarget.targetGkeCluster,
                gceClusterConfig.zoneUri
              ).scope('locations').segment(0):label=ZONE,
            has_scheduled_delete():label=SCHEDULED_DELETE,
            has_scheduled_stop():label=SCHEDULED_STOP
          )
    )has_scheduled_deletehas_scheduled_stop)r
   AddRegionFlagr	   URI_FLAGRemoveFromParserPAGE_SIZE_FLAG
SetDefaultr   DEFAULT_PAGE_SIZEdisplay_info	AddFormatAddTransformsr   r    )parsers    r   Args	List.Args`   sx    	MM""6*""69+F+FG
!! # 	 %% 3/' r   c           	         [         R                  " U R                  5       5      n[        R                  R
                  R                  R                  5       n[        R                  " 5       nU R                  UR                  X4U5      n[        R                  " UR                  R                  UUR                   SUR"                  SS9$ )NclusterspageSize)limitfield
batch_sizebatch_size_attribute)dpDataprocReleaseTrackr   VALUEScoreproject	GetOrFailr   ResolveRegion
GetRequestmessagesr   YieldFromListclientprojects_regions_clustersr6   	page_size)selfargsr   r?   regionrequests         r   RunList.Runy   s    {{4,,./H$$,,668G!Fooh//$GG##11jj>>' r   c                 n    S nUR                   (       a  UR                   nS Ul         U R                  XUS9$ )N)	projectIdrJ   filter)rP   *DataprocProjectsRegionsClustersListRequest)rC   r?   rJ   rI   backend_filters        r   rB   List.GetRequest   s=     N{{{{ndk>> ?  r   r   N)
__name__
__module____qualname____firstlineno____doc__staticmethodr1   rL   rB   __static_attributes__r   r   r   r"   r"   4   s5    (T  0" 
 
r   r"   N)rX   typingr   r   apitools.base.pyr   googlecloudsdk.api_lib.dataprocr   r   r:   r   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataprocr
   googlecloudsdk.corer   strr   r    UniverseCompatibleListCommandr"   r   r   r   <module>rd      s       ' 5 : 0 ( 5 *	c3h 	C 		tCH~ 	# 	 `4 ` `r   