
    z
                     p    S r SSK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r	S	r
S
 rS rS rS rSrg)z'Local gcloud cache for Cloud Workflows.    N)config)
exceptions)log)	resources)filesz:workflowexecutions.projects.locations.workflows.executionsz#.workflows-cached-execution-id.jsonc                     [        5       n [        R                  R                  U 5      (       d  [        R
                  " [        5      e [        R                  " U 5      n[        R                  R                  U[        S9n[        R                  R                  SR!                  UR#                  5       5      5        U$ ! [$         a    [        R
                  " [        5      ef = f)zUGets the cached execution object.

Returns:
  execution: the execution resource name
)
collectionzUsing cached execution name: {})_get_cache_pathospathisfiler   Error_NO_CACHE_MESSAGEr   ReadFileContentsr   REGISTRYParseEXECUTION_COLLECTIONr   statusPrintformatRelativeName	Exception)
cache_pathcached_executionexecution_refs      -lib/googlecloudsdk/api_lib/workflows/cache.pyget_cached_execution_idr      s      *	
	#	#


,
--.--j9&&,,%9 - ;MJJ6==""$& '	 .


,
--.s   
A5C   %C%c                 x     [         R                  " [        5       U 5        g! [         R                   a     gf = f)ziSaves the execution resource to a named cache file.

Args:
  execution_name: the execution resource name
N)r   WriteFileContentsr
   r   )execution_names    r   cache_execution_idr!   4   s2    		O-~>	 	 			s   " 99c                  b     [         R                  " [        5       5        g! [         a     gf = f)zgClears the execution cache.

Returns:
  bool: True if the file was found and deleted, false otherwise.
FT)r   remover
   OSError     r   delete_execution_cacher'   C   s/    IIo  
 
 s   ! 
..c                      [         R                  " 5       R                  n [        R                  R                  U [        5      $ )N)r   Pathsglobal_config_dirr   r   joinWORKFLOW_CACHE_FILE)
config_dirs    r   r
   r
   P   s)    ||~//*	j"5	66r&   z[NOT FOUND] There are no cached executions available. Use gcloud list and describe commands or https://console.developers.google.com/ to check resource state.)__doc__r   googlecloudsdk.corer   r   r   r   googlecloudsdk.core.utilr   r   r,   r   r!   r'   r
   r   r%   r&   r   <module>r1      sN    . 
 & * # ) * A ; .*	
7
F r&   