
                             d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ej                   G d	 d
ej                               Zy)zBImplementation of pause command to pause Anywhere Cache instances.    )base)plurality_checkable_iterator)progress_callbacks)task_executor)task_graph_executor)task_status)pause_anywhere_cache_taskc                   6    e Zd ZdZdddZed        Zd Zd Zy)	PausezPause Anywhere Cache instances.z

        The pause operation can be used to stop the data ingestion of a cache
        instance in RUNNING state (read-only cache) until the Resume is invoked.
      z

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

        $ {command} my-bucket/my-cache-id
      )DESCRIPTIONEXAMPLESc                 6    |j                  dt        dd       y )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     4lib/surface/storage/buckets/anywhere_caches/pause.pyArgsz
Pause.Args-   s#    
(  	    c              #      K   t        j                  |t        |j                               |j                  D ]/  }|j	                  d      \  }}}t        j                  ||       1 y w)N/)r   workload_estimator_callbacklenr   
rpartitionr	   PauseAnywhereCacheTask)selfargstask_status_queueid_strbucket_name_anywhere_cache_ids          r   get_task_iteratorzPause.get_task_iterator:   sb     223tww< ''*0*;*;C*@'k1'%<<
(  s   A)A+c                 <   t         j                  j                         }| j                  ||      }t	        j
                  |      }t        j                  |d|t        j                  t        j                  j                  d       t        |dd            | _        y )NT)increment_typemanifest_pathcontinue_on_errorF)parallelizabler#   progress_manager_argsr,   )r   multiprocessing_contextQueuer(   r   PluralityCheckableIteratorr   execute_tasksr   ProgressManagerArgsIncrementTypeINTEGERgetattr	exit_code)r!   r"   r#   task_iterator!plurality_checkable_task_iterators        r   Runz	Pause.RunE   s    +CCIIK**41BCM$??N & #00)+)==&44<<D
 "$(;UCDNr   N)	__name__
__module____qualname____doc__detailed_helpclassmethodr   r(   r:    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   rA   r   r   <module>rH      sE    I ( K A B H @ f 9DLL 9 9r   