
    M                        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
ddZdZdZdZdZdZdZdZdez   Zd Zd Zd Z ej2                  ej4                  j6                         G d dej8                               Zy)zCommand to list GDCE clusters.    )
list_pager)util)base)resource_args)log)
properties)	resourcesz*        List Edge Container clusters.
    zc    To list the clusters in region us-central1, run:

      $ {command} --location=us-central1
    z    This command uses the edgecontainer/v1alpha API. The full documentation for    this API can be found at: https://cloud.google.com/edge-cloud
    )DESCRIPTIONEXAMPLESzAPI REFERENCEa  
      table(
        name.basename():label=NAME,
        endpoint:label=ENDPOINT,
        labels:label=LABELS,
        controlPlaneVersion:label=CONTROL_PLANE_VERSION,
        nodeVersion:label=NODE_VERSION,
        createTime.date():label=CREATED
      )
      )edgecontainer.projects.locations.clustersv1v1alphaz
--locationzMParent Edge Container location to list all contained Edge Container clusters.zWhttps://cloud.google.com/distributed-cloud/edge/latest/docs/release-notes#March_14_2024zDEPRECATION: Cluster {} is hosting a control plane in the cloud, which is now deprecated. Please migrate all clusters to host the control plane locally on edge-cloud machines: c                       fd}|S )Nc                     |d<   d|d<   t        j                  j                  | j                  fi |j	                         S )Napi_versionr   
collection)r	   REGISTRYParsenameSelfLink)clusterkwargsr   s     1lib/surface/edge_cloud/container/clusters/list.pyUriFuncz'GetUriFromResourceFunc.<locals>.UriFuncI   s@    'F=FF<##GLL;F;DDFF     )r   r   s   ` r   GetUriFromResourceFuncr   H   s    G 
.r   c                 R    | j                   d u xs | j                   j                  d u S )N)controlPlanelocalr   s    r   IsRCPClusterr"   P   s)    				%	K)=)=)C)Ct)KKr   c                     t        |       rA| j                  dk7  r2t        j                  t        j                  | j                               y)NPROVISIONINGT)r"   statusr   warningDEPRECATION_WARNING_TEMPLATEformatr   r!   s    r   PrintWarningsAndReturnTruer)   T   s4    'w~~?KK,33GLLAB	r   c                   *    e Zd ZdZeZed        Zd Zy)	ListAlphazList Edge Container clusters.c                     t        j                  |        | j                  j                  t               | j                  j                  t        t                     y)zRegister flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
    N)r   (AddLocationOptionalResourceArgForListingdisplay_info	AddFormatDISPLAY_TABLE
AddUriFuncr   V1_ALPHA_API_VERSION)parsers    r   ArgszListAlpha.Argsb   sA     ::6B
!!-0
""#9:N#OPr   c           	      R   t        j                  | j                               }t        j                  | j                               }t        j
                  }|j                  xs& |j                  j                  j                  d      }|j                  xs& |j                  j                  j                  d      }t        j                  |j                  |j                  d| d| |j                  |j                         |j                  d|j"                  dt$              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.
    T)requiredz	projects/z/locations/)parentpageSizefilterclustersr8   )
batch_sizefieldlimitbatch_size_attribute	predicate)r   GetClientInstanceReleaseTrackGetMessagesModuler   VALUESprojectcoreGetlocationedge_containerr   YieldFromListprojects_locations_clusters1EdgecontainerProjectsLocationsClustersListRequest	page_sizer9   r=   r)   )selfargscluster_clientmessagesvals
project_idrG   s          r   RunzListAlpha.Runn   s     ++D,=,=,?@N%%d&7&7&9:HDE!2!2!6!6!6!EJ}}O 3 3 < < @ @$ @ OH##22BBzl+hZ@^^;; 	C 	

 >>jj',. .r   N)	__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr4   rS   r   r   r   r+   r+   \   s#    %-	Q 	Q.r   r+   N)rW   apitools.base.pyr   +googlecloudsdk.api_lib.edge_cloud.containerr   googlecloudsdk.callioper   /googlecloudsdk.command_lib.edge_cloud.containerr   googlecloudsdk.corer   r   r	   rX   r0   CLUSTERS_COLLECTION_NAMEV1_API_VERSIONr2   LOC_FLAGLOC_FLAG_HELP"RCP_DEPRECATION_RELEASE_NOTES_LINKr'   r   r"   r)   ReleaseTracksrA   ALPHAListCommandr+   r   r   r   <module>rh      s    % ' < ( I # * )			$	
 G   (" #')KL L D%%++,-.   -. --.r   