
                         `    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 Z	 G d d	e
      Zy
)zCFacility for displaying information about a Job message to a user.
    )absolute_import)division)unicode_literals)apis)timesc                     t        j                  |       }t        j                  |      syt        j                  |d      S )z=Returns a yyyy-mm-dd hh:mm:ss formatted date/time for string.Nz%Y-%m-%d %H:%M:%S)r   ParseDateTimeGetTimeStampFromDateTimeFormatDateTime)stringdts     2lib/googlecloudsdk/api_lib/dataflow/job_display.pyr   r      s7    6""		'	'	+			b"5	66    c                   6    e Zd ZdZd Zed        Zed        Zy)DisplayInfoaS  Information about a job displayed in command output.

  Fields:
    id: the job ID
    name: the job name
    type: one of 'batch', 'streaming'
    state: string representing the current job status
    creationTime: in the form yyyy-mm-dd hh:mm:ss
    stateTime: in the form yyyy-mm-dd hh:mm:ss
    location: the job's regional endpoint
  c                 b   |j                   | _         |j                  | _        t        j                  |j                        | _        t        j                  |j                        | _        |j                  | _        t        |j                        | _        t        |j                        | _        y )N)idnamer   _JobTypeForJobtype_StatusForJobcurrentStatestatelocationr   currentStateTime	stateTime
createTimecreationTime)selfjobs     r   __init__zDisplayInfo.__init__0   sv    ffDGDI**3884DI**3+;+;<DJLLDM $C$8$89DN&s~~6Dr   c                     t        j                         j                  j                  }|j                  d|j
                  di}|j                  | d      S )zReturn a string describing the job type.

    Args:
      job_type: The job type enum
    Returns:
      string describing the job type
    Batch	StreamingUnknown)r   GetMessagesModuleJobTypeValueValuesEnumJOB_TYPE_BATCHJOB_TYPE_STREAMINGget)job_typetype_value_enum	value_maps      r   r   zDisplayInfo._JobTypeForJobD   sN     ,,.22FFO&&**KI ==9--r   c                    t        j                         j                  j                  }|j                  d|j
                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d|j                  d	|j                  d
|j                  di}|j                  | d      S )zReturn a string describing the job state.

    Args:
      job_state: The job state enum
    Returns:
      string describing the job state
    	Cancelled
CancellingDoneDrainedDrainingFailedPendingQueuedRunningStoppedUpdatedr%   )r   r&   r'   CurrentStateValueValuesEnumJOB_STATE_CANCELLEDJOB_STATE_CANCELLINGJOB_STATE_DONEJOB_STATE_DRAINEDJOB_STATE_DRAININGJOB_STATE_FAILEDJOB_STATE_PENDINGJOB_STATE_QUEUEDJOB_STATE_RUNNINGJOB_STATE_STOPPEDJOB_STATE_UPDATEDr+   )	job_statestate_value_enumr.   s      r   r   zDisplayInfo._StatusForJobT   s     --/33OO,,k--|''**I++Z))8**I))8**I**I**II ==I..r   N)__name__
__module____qualname____doc__r!   staticmethodr   r    r   r   r   r   #   s4    
7( . . / /r   r   N)rL   
__future__r   r   r   googlecloudsdk.api_lib.dataflowr   googlecloudsdk.core.utilr   r   objectr   rN   r   r   <module>rS      s.     '  ' 0 *7H/& H/r   