
                             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rS
 rS rS rS rS rS rS rg	)zHHelpers for writing commands interacting with Cloud Dataflow snapshots.
    )absolute_import)division)unicode_literals)arg_parsers)dataflow_util)
properties)	resourcesNc                 J    U R                  SSSS9  U R                  SSSSS	9  g
)zRegister flags for specifying a single Snapshot ID.

Args:
  parser: The argparse.ArgParser to configure with snapshot arguments.
snapshotSNAPSHOT_IDz"ID of the Cloud Dataflow snapshot.)metavarhelp--regionT	REGION_IDz,Region ID of the snapshot regional endpoint.requiredr   r   Nadd_argumentparsers    9lib/googlecloudsdk/command_lib/dataflow/snapshot_utils.pyArgsForSnapshotRefr      sA     	/  1 	9	  ;    c                 L    U R                  SSSSS9  U R                  SSSSS9  g	)
zRegister flags for specifying a single Job ID.

Args:
  parser: The argparse.ArgParser to configure with job-filtering arguments.
--job-idTJOB_IDzThe job ID to snapshot.r   r   r   :The region ID of the snapshot and job's regional endpoint.Nr   r   s    r   ArgsForSnapshotJobRefr   0   sE     	$	  &
 	H	  Jr   c                 L    U R                  SSSSS9  U R                  SSSS	S9  g
)zRegister flags for listing Cloud Dataflow snapshots.

Args:
  parser: The argparse.ArgParser to configure with job-filtering arguments.
r   Fr   z/The job ID to use to filter the snapshots list.r   r   Tr   r   Nr   r   s    r   ArgsForListSnapshotr    B   sE     	<	  >
 	H	  Jr   c           
      P    U R                  SSS[        R                  " SSS9SS9  g	)
zxRegister flags for specifying a snapshot ttl.

Args:
  parser: the argparse.ArgParser to configure with a ttl argument.
z--snapshot-ttl7dDURATION1h30d)lower_boundupper_boundzTime to live for the snapshot.)defaultr   typer   N)r   r   Durationr   s    r   ArgsForSnapshotTtlr+   T   s3     	DeD+  -r   c                     U R                   n[        R                  " U 5      n[        R                  R                  U[        R                  R                  R                  R                  US.SS9$ )zExtract the Snapshot Ref for a command. Used with ArgsForSnapshotRef.

Args:
  args: The command line arguments.
Returns:
  A Snapshot resource.
	projectIdlocationz%dataflow.projects.locations.snapshotsparams
collection)r   r   	GetRegionr	   REGISTRYParser   VALUEScoreproject	GetOrFail)argsr   regions      r   ExtractSnapshotRefr<   b   sf     ]](""4(&				!	!!((--55?? 9 
" 
: :r   c                     U R                   n[        R                  " U 5      n[        R                  R                  U[        R                  R                  R                  R                  US.SS9$ )zExtract the Job Ref for a command. Used with ArgsForSnapshotJobRef.

Args:
  args: The command line arguments.
Returns:
  A Job resource.
r-   z dataflow.projects.locations.jobsr0   )job_idr   r3   r	   r4   r5   r   r6   r7   r8   r9   )r:   jobr;   s      r   ExtractSnapshotJobRefr@   u   sf     	#""4(&				!	!	!((--55?? 4 
" 
5 5r   c                 H    [         R                  " U R                  5      S-   $ )zExtract the Duration string for the Snapshot ttl.

Args:
  args: The command line arguments.
Returns:
  A duration string for the snapshot ttl.
s)six	text_typesnapshot_ttl)r:   s    r   ExtractSnapshotTtlDurationrF      s     
t((	)C	//r   )__doc__
__future__r   r   r   googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataflowr   googlecloudsdk.corer   r	   rC   r   r   r    r+   r<   r@   rF    r   r   <module>rM      sI    '  ' / = * ) 
;"J$J$-:&5&0r   