
    "                         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  \R                   " S	 S
\R                  5      5       rg)zIImplementation of disable command for disabling Anywhere Cache Instances.    )base)progress_callbacks)storage_url)task_executor)task_graph_executor)task_status)disable_anywhere_cache_taskc                   >    \ rS rSrSrSSS.r\S 5       rS rS r	S	r
g
)Disable   z!Disable Anywhere Cache instances.aV  

        Disables one or more Anywhere Cache instances.

        The cache instance will be set to DISABLED state. The existing entries
        can be read from the cache but new entries will not be written to the
        cache. The L4 SSD cache would not be deleted by the cache manager until
        the min TTL (1h) has been reached (cache instance is kept for at least
        1h). Google Cloud Storage defines the min TTL which is applied to all
        cache instances. Cach disablement could be canceled by using
        anywhere-caches resume command before the instance is deleted.
      z

      The following command disables the anywhere cache instance of bucket
      ``my-bucket'' having anywhere_cache_id ``my-cache-id'':

        $ {command} my-bucket/my-cache-id
      )DESCRIPTIONEXAMPLESc                 0    UR                  S[        SSS9  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help)add_argumentstr)clsparsers     6lib/surface/storage/buckets/anywhere_caches/disable.pyArgsDisable.Args5   s#    
(  	    c              #      #    [         R                  " U[        UR                  5      5        UR                   H=  nUR	                  [
        R                  5      u  pEn[        R                  " XF5      v   M?     g 7f)N)	r   workload_estimator_callbacklenr   
rpartitionr   CLOUD_URL_DELIMITERr	   DisableAnywhereCacheTask)selfargstask_status_queueid_strbucket_name_anywhere_cache_ids          r   _get_task_iteratorDisable._get_task_iteratorB   sg     223tww< ''*0*;*;

)
)+'k' (@@
 	 s   A9A;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Queuer*   r   execute_tasksr   ProgressManagerArgsIncrementTypeINTEGER	exit_code)r#   r$   r%   task_iterators       r   RunDisable.RunO   sa    +CCIIK++DDM"00+)==&44<<D
	DNr   )r7   N)__name__
__module____qualname____firstlineno____doc__detailed_helpclassmethodr   r*   r9   __static_attributes__ r   r   r   r      s4    )

-, 
 
r   r   N)r?   googlecloudsdk.callioper   "googlecloudsdk.command_lib.storager   r   (googlecloudsdk.command_lib.storage.tasksr   r   r   @googlecloudsdk.command_lib.storage.tasks.buckets.anywhere_cachesr	   DefaultUniverseOnlyCommandr   rC   r   r   <module>rJ      sG    P ) A : B H @ h >dll > >r   