
                         z    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
  G d d	ej                        Zy
)z)Command to snapshot a Cloud Dataflow job.    )absolute_import)division)unicode_literals)apis)base)snapshot_utilsc                   0    e Zd ZdZdddZed        Zd Zy)Createz,Creates a snapshot for a Cloud Dataflow job.z{description}z          To create a Cloud Dataflow snapshot with sources for a running job, run:

            $ {command} --job-id=JOB_ID --region=JOB_REGION --snapshot-sources=true --snapshot-ttl=7d
          )DESCRIPTIONEXAMPLESc                     t        j                  |        t        j                  |        | j                  dt        dd       y)zrRegister flags for this command.

    Args:
      parser: argparse.ArgumentParser to register arguments with.
    z--snapshot-sourcesFz`If true, snapshots will also be created for the Cloud Pub/Sub sources of the Cloud Dataflow job.)typedefaulthelpN)r   ArgsForSnapshotJobRefArgsForSnapshotTtladd_argumentbool)parsers    (lib/surface/dataflow/snapshots/create.pyArgszCreate.Args(   sA     ((0%%f-
-	  .    c                     t        j                  |      }t        j                  j	                  |j
                  |j                  |j                  t        j                  |      |j                        S )zRuns the command.

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

    Returns:
      A Snapshot message.
    )
project_id	region_idttlsnapshot_sources)
r   ExtractSnapshotJobRefr   JobsSnapshotjobId	projectIdlocationExtractSnapshotTtlDurationr   )selfargsjob_refs      r   Runz
Create.Run8   s`     2248G99$$""55d;..  0 0r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r(    r   r   r
   r
      s/    4 		- . .0r   r
   N)r,   
__future__r   r   r   googlecloudsdk.api_lib.dataflowr   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataflowr   Commandr
   r/   r   r   <module>r5      s,    0 &  ' 0 ( >-0T\\ -0r   