
    !                         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Jr  \R                   " S
 S\R                  5      5       rg)zGImplementation of update command for updating Anywhere Cache instances.    )arg_parsers)base)flags)progress_callbacks)task_executor)task_graph_executor)task_status)patch_anywhere_cache_taskc                   >    \ rS rSrSrSSS.r\S 5       rS rS r	S	r
g
)Update   z Update Anywhere Cache instances.z

      Update one or more Anywhere Cache instances. A cache instance can be
      updated if its state is created or pending creation.
      a=  

      The following command updates cache entry's ttl, and admisson policy of
      anywhere cache instance in bucket ``my-bucket'' having anywhere_cache_id
      ``my-cache-id'':

        $ {command} my-bucket/my-cache-id --ttl=6h --admission-policy='ADMIT_ON_SECOND_MISS'

      The following command updates cache entry's ttl of anywhere cache
      instances in bucket ``bucket-1'' and ``bucket-2'' having anywhere_cache_id
      ``my-cache-id-1'', and ``my-cache-id-2'' respectively:

        $ {command} bucket-1/my-cache-id-1 bucket-2/my-cache-id-2 --ttl=6h
      )DESCRIPTIONEXAMPLESc                     UR                  S[        SSS9  UR                  S[        R                  " 5       SS9  [        R
                  " U5        g )Nid+zIdentifiers for a Anywhere Cache Instance.They are combination of bucket_name/anywhere_cache_id. For example : test-bucket/my-cache-id.)typenargshelpz--ttlz9Cache entry time-to-live. Default to 24h if not provided.)r   r   )add_argumentstrr   Durationr   add_admission_policy_flag)clsparsers     5lib/surface/storage/buckets/anywhere_caches/update.pyArgsUpdate.Args5   sZ    
(  	 !!#H   
##F+    c              #   J  #    [         R                  " U[        UR                  5      5        UR                  (       a  [        UR                  5      S-   OS nUR                   H:  nUR                  S5      u  pVn[        R                  " UUUR                  US9v   M<     g 7f)Ns/)admission_policyttl)
r   workload_estimator_callbacklenr   r$   r   
rpartitionr
   PatchAnywhereCacheTaskr#   )selfargstask_status_queuer$   id_strbucket_name_anywhere_cache_ids           r   get_task_iteratorUpdate.get_task_iteratorJ   s     223tww< "&#dhh-#
tC''*0*;*;C*@'k'%<<

00	  s   B!B#c           
          [         R                  R                  5       nU R                  X5      n[        R
                  " USU[        R                  " [        R                  R                  S S9S9U l
        g )NT)increment_typemanifest_path)parallelizabler+   progress_manager_args)r   multiprocessing_contextQueuer0   r   execute_tasksr	   ProgressManagerArgsIncrementTypeINTEGER	exit_code)r)   r*   r+   task_iterators       r   Run
Update.RunZ   sa    +CCIIK**4CM"00+)==&44<<D
	DNr   )r=   N)__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr   r0   r?   __static_attributes__ r   r   r   r      s4    (


-, , ,( r   r   N)rE   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.storager   r   (googlecloudsdk.command_lib.storage.tasksr   r   r	   @googlecloudsdk.command_lib.storage.tasks.buckets.anywhere_cachesr
   DefaultUniverseOnlyUpdateCommandr   rI   r   r   <module>rP      sM    N / ( 4 A B H @ f IT I Ir   