
    H                     j    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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.
    )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   -   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   ?   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(   Q   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   ExtractSnapshotRefr9   _   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.jobsr-   )job_idr   r0   r   r1   r2   r   r3   r4   r5   r6   )r7   jobr8   s      r   ExtractSnapshotJobRefr=   r   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)r7   s    r   ExtractSnapshotTtlDurationrC      s     
t((	)C	//r   )__doc__googlecloudsdk.callioper   #googlecloudsdk.command_lib.dataflowr   googlecloudsdk.corer   r   r@   r   r   r   r(   r9   r=   rC    r   r   <module>rI      s@    0 = * ) 
;"J$J$-:&5&0r   