
                         l   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 dd	lmZ d
Zej&                   ej(                  dee       ej*                  ej,                  j.                  ej,                  j0                         G d dej2                                             Zy)z;Command for suspending the TPU node and GCE VM combination.    )absolute_import)division)unicode_literals)HttpNotFoundError)base)flags)util)logzThis 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)SuspendzDeletes Google Compute TPU and suspends the VM.

  ## EXAMPLES

  To delete the TPU and suspend the VM, run:

    $ {command} test-execution-group --zone=test-zone --project=test-project

  c                 ^    t        j                  |dd       t        j                  |       y )Ntpususpend)resource_typeoperation_type)r   AddZoneFlag
tpus_flagsAddTpuNameArg)clsparsers     4lib/surface/compute/tpus/execution_groups/suspend.pyArgszSuspend.Args6   s"    	fE)LV$    c                 J   t         j                  j                  |       g }t        j                  | j	                               }d }	 |j                  |j                  |j                        }d }t        j                  | j	                               }	 |j                  |j                  |j                        }|r$	 |j                  |d      }|j!                  |       |r$	 |j!                  |j                  |d             |S |S # t        $ r; t        j                  j                  dj                  |j                               Y w xY w# t        $ r; t        j                  j                  dj                  |j                               Y w xY w# t        $ r; t        j                  j                  dj                  |j                               Y w xY w# t        $ r< t        j                  j                  dj                  |j                               Y |S w xY w)Nz0Instance:{} not found, possibly already deleted.z0TPU Node:{} not found, possibly already deleted.zSuspending GCE VMzDeleting TPU node)	tpu_utilsDefaultArgsValidateZoneInstanceReleaseTrackStopexecution_group_namezoner   r
   statusPrintformatTPUNodeDeleteWaitForOperationNoResourcesappend)selfargs	responsesinstanceinstance_operation_reftpu_operation_refr   instance_delete_responses           r   RunzSuspend.Run;   s   &&t,I!!$"3"3"56H!*'}}T-F-F-1YY 8 


D--/
0C***T%>%>		J ,#+#G#G"$7$9 12 ,++!#68	9 9E  *	jj
<
C
C'')**  *	jj
<
C
C'')**  ,

>EE))+	,,  ,

>EE))+	, ,sL   &D &E =#F #!G AEEAFFAGGAH"!H"N)__name__
__module____qualname____doc__classmethodr   r4    r   r   r   r   %   s      % %+r   r   N)r8   
__future__r   r   r   apitools.base.py.exceptionsr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   'googlecloudsdk.command_lib.compute.tpusr   8googlecloudsdk.command_lib.compute.tpus.execution_groupsr	   r   googlecloudsdk.corer
   _DEPRECATION_WARNINGDefaultUniverseOnly	DeprecateReleaseTracksr"   BETAALPHACommandr   r:   r   r   <module>rI      s    B &  ' 9 ( 4 G V #   
  D%%**D,=,=,C,CD;dll ; E	  ;r   