
    
                        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  e
j                  e
j                   j"                        e
j$                   G d
 de
j&                                      Zy)zGImplementation of gcloud dataflow jobs resume-unsupported-sdk command.
    )absolute_import)division)unicode_literals)apis)
exceptions)base)	job_utils)logc                   &    e Zd ZdZed        Zd Zy)Resumez~Resumes job running with the specified job id.

     Resumes a pipeline job which is running on an unsupported SDK version.
  c                 V    t        j                  |        | j                  ddd       y)z Register flags for this command.z--tokenz#The resume token unique to the job.T)helprequiredN)r	   ArgsForJobRefadd_argument)parsers    3lib/surface/dataflow/jobs/resume_unsupported_sdk.pyArgszResume.Args&   s.     F#
3      c           	      B   t        j                  |      }	 t        j                  j	                  |j
                  d|j                  z   |j                  |j                         t        j                  j                  dj                  |j
                               y# t        j                  $ rm}t        j                  j                  dj                  |j
                  |j                  j                   |j                  |j                               Y d}~yd}~ww xY w)zThis is what gets called when the user runs this command.

    Args:
      args: all the arguments that were provided to this command invocation.
    z)unsupported_sdk_temporary_override_token=)
project_id	region_idzResuming job running on unsupported SDK version [{0}]. This job may be cancelled in the future. For more details, see https://cloud.google.com/dataflow/docs/support/sdk-version-support-status.zFailed to resume job [{0}]: {1} Ensure that you have permission to access the job, the `--region` flag, {2}, is correct for the job and the `--token` flag, {3}, corresponds to the job.N)r	   ExtractJobRefr   JobsResumeUnsupportedSDKjobIdtoken	projectIdlocationr
   statusPrintformatr   HttpExceptionpayloadstatus_message)selfargsjob_referrors       r   Runz
Resume.Run0   s     %%d+G
ii$$
--
5


B&&$$	 % &
 
jj = >DV"==>*+
 ## 	jjI Fmmmm**jj	 s   BB D1A#DDN)__name__
__module____qualname____doc__staticmethodr   r*    r   r   r   r      s     
  r   r   N)r.   
__future__r   r   r   googlecloudsdk.api_lib.dataflowr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataflowr	   googlecloudsdk.corer
   ReleaseTracksReleaseTrackALPHADefaultUniverseOnlyCommandr   r0   r   r   <module>r<      sj     '  ' 0 2 ( 9 # D%%++,.T\\ .  -.r   