
    D                        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Zej                   ej                  d	ee
       ej                  ej                   j"                  ej                   j$                  ej                   j&                         G d dej(                                             Z G d de      Zy)z:Command for list TPU node and GCE VM combinations created.    )absolute_import)division)unicode_literals)base)flags)utilzThis command is deprecated and will be removed in a future release. We recommend that you use the TPU-VM or Queued Resource API. See https://cloud.google.com/tpu/docs/managing-tpus-tpu-vm for more information.F)
is_removedwarningerrorc                   &    e Zd ZdZed        Zd Zy)ListzList TPU Node+VM groups created by execution group.

  ## EXAMPLES

  To list all active execution groups, run:

    $ {command} --zone=test-zone --project=test-project
  c                 j    t        j                  |dd       |j                  j                  d       y )Ntpulist)resource_typeoperation_typeztable(name, status))r   AddZoneFlagdisplay_info	AddFormat)clsparsers     1lib/surface/compute/tpus/execution_groups/list.pyArgsz	List.Args3   s)    	fE&I
!!"78    c                    t         j                  j                  |       g }i }i }t        j                  | j	                               }|j                  |j                        D ]  }|||j                  <    t        j                  | j	                               }|j                  |j                        D ]  }|||j                  |      <    |j                         D ]  \  }	}|	|j                         vr|j                  t        |	d             4|j                  |      r0|j                  ||	         r|j                  t        |	d             u|j                  t        |	d              t        |      S )NPausedRunningzUnknown Status)	tpu_utilsDefaultArgsValidateZoneInstanceReleaseTrackr   zonenameTPUNodeNodeNameitemskeysappend
ListResult	IsRunningsorted)
selfargs	responses	instancesnodesinstance_helperinstancenode_helpernoder$   s
             r   RunzList.Run8   sB   &&t,IIE(():):)<=O#((3!)i 4 ##D$5$5$78K  +*.eK  &' , $//+h	UZZ\	!D(34$$X.;3H3H
+4D)45D*:;< , )r   N)__name__
__module____qualname____doc__classmethodr   r6    r   r   r   r   "   s      9 9r   r   c                       e Zd Zd Zd Zy)r*   c                      || _         || _        y Nr$   status)r-   r$   rA   s      r   __init__zListResult.__init__S   s    DIDKr   c                 h    | j                   | j                  z   |j                   |j                  z   kD  S r?   r@   )r-   lrs     r   __gt__zListResult.__gt__W   s'    99t{{"RWWryy%888r   N)r7   r8   r9   rB   rE   r<   r   r   r*   r*   Q   s    9r   r*   N)r:   
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   8googlecloudsdk.command_lib.compute.tpus.execution_groupsr   r   _DEPRECATION_WARNINGDefaultUniverseOnly	DeprecateReleaseTracksr"   GABETAALPHAListCommandr   objectr*   r<   r   r   <module>rS      s    A &  ' ( 4 V   
  D%%(($*;*;*@*@%%++-%4 %-	  %P9 9r   