
    
                        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                  j                          G d
 de
j"                               Zy)z5Implementation of gcloud dataflow jobs show command.
    )absolute_import)division)unicode_literals)apis)job_display)	step_json)base)	job_utilsc                   ,    e Zd ZdZed        Zd Zd Zy)Showz.Shows a short description of the given job.
  c                 ~    t        j                  |        | j                  ddd       | j                  ddd       y)zrRegister flags for this command.

    Args:
      parser: argparse.ArgumentParser to register arguments with.
    z--environment
store_truez+If present, the environment will be listed.)actionhelpz--stepsz%If present, the steps will be listed.N)r
   ArgsForJobRefadd_argument)parsers    !lib/surface/dataflow/jobs/show.pyArgsz	Show.Args#   sJ     F#
:  < ,4  6    c                    t        j                  |      }t        j                  j	                  |j
                  |j                  |j                  t        j                  j                  j                  j                        }t        j                  |      }|j                  r|j                  |_        |j                  r7t        j                   |      D cg c]  }| j#                  |       c}|_        |S c c}w )zRuns the command.

    Args:
      args: The arguments that were provided to this command invocation.

    Returns:
      A Job message.
    )job_id
project_id	region_idview)r
   ExtractJobRefr   JobsGetjobId	projectIdlocationGET_REQUESTViewValueValuesEnumJOB_VIEW_ALLr   DisplayInfoenvironmentstepsr   ExtractSteps_PrettyStep)selfargsjob_refjob	shown_jobsteps         r   RunzShow.Run3   s     %%d+G
))--}}$$""YY""66CC	  EC '',I!ooizz-6-C-CC-HJ-HT$

4
 -HJio Js   C:c                     |d   |d   d   dS )zPrettify a given step, by only extracting certain pieces of info.

    Args:
      step: The step to prettify.
    Returns:
      A dictionary describing the step.
    name
properties	user_name)idr4    )r*   r/   s     r   r)   zShow._PrettyStepO   s"     6l,'4 r   N)__name__
__module____qualname____doc__staticmethodr   r0   r)   r6   r   r   r   r      s%     6 68r   r   N)r:   
__future__r   r   r   googlecloudsdk.api_lib.dataflowr   r   r   googlecloudsdk.callioper	   #googlecloudsdk.command_lib.dataflowr
   ReleaseTracksReleaseTrackBETAGACommandr   r6   r   r   <module>rE      sk     '  ' 0 7 5 ( 9 D%%**D,=,=,@,@A;4<< ; B;r   