
    
                     8   S 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	KJr  SS
KJr  \
R"                  " \
R$                  R&                  \
R$                  R(                  5      \
R*                   " S S\
R,                  5      5       5       rg)z6Implementation of gcloud dataflow jobs cancel command.    )absolute_import)division)unicode_literals)apis)
exceptions)base)	job_utils)log)
console_ioc                   .    \ rS rSrSr\S 5       rS rSrg)Cancel   z7Cancels all jobs that match the command line arguments.c                 P    [         R                  " U SS9  U R                  SSSS9  g)z Register flags for this command.+)nargsz--force
store_truezForcibly cancels a Dataflow job. Regular cancel must have been attempted at least 30 minutes prior for a job to be force cancelled.)actionhelpN)r	   ArgsForJobRefsadd_argument)parsers    #lib/surface/dataflow/jobs/cancel.pyArgsCancel.Args"   s2     V3/
	      c           	         [         R                  " U5       H  n UR                  (       a  [        R                  " SSS9  [
        R                  R                  UR                  UR                  UR                  UR                  S9  [        R                  R                  SR                  UR                  5      5        M     g! [        R                    ad  n[        R                  R                  SR                  UR                  UR"                  R$                  UR                  5      5         SnAGM"  SnAff = f)zThis is what gets called when the user runs this command.

Args:
  args: all the arguments that were provided to this command invocation.
zeForce cancellation will leak VMs the cancelled Dataflow job created that must be manually cleaned up.T)messagecancel_on_no)
project_id	region_idzCancelled job [{0}]zFailed to cancel job [{0}]: {1} Ensure that you have permission to access the job and that the `--region` flag, {2}, matches the job's region.N)r	   ExtractJobRefsforcer   PromptContinuer   Jobsr   jobId	projectIdlocationr
   statusPrintformatr   HttpExceptionpayloadstatus_message)selfargsjob_referrors       r   Run
Cancel.Run0   s     ++D1
::

#
#} 			MMJJ((&&	 	 	(
 	

.55gmmDE 2 %% 


#Vu}};;W=M=M	
 	

s   B&CD>AD99D> N)	__name__
__module____qualname____firstlineno____doc__staticmethodr   r2   __static_attributes__r4   r   r   r   r      s     @ 
r   r   N)r9   
__future__r   r   r   googlecloudsdk.api_lib.dataflowr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataflowr	   googlecloudsdk.corer
   googlecloudsdk.core.consoler   ReleaseTracksReleaseTrackBETAGADefaultUniverseOnlyCommandr   r4   r   r   <module>rI      sx    = &  ' 0 2 ( 9 # 2 D%%**D,=,=,@,@A+
T\\ +
  B+
r   