o
    `j                     @   s,   d dl mZ G dd dZG dd dZdS )    )TopicPartitionReplicac                   @   ,   e Zd ZdZdZedd Zedd ZdS )DescribeLogDirszdescribe-log-dirsz#Get topic log directories and statsc                 C   s,   |j dtdddd |j dtdddd d S )	Nz--brokerappendbrokerszQuery specific broker(s))typeactiondesthelpz--topictopicsz Get data about specific topic(s))add_argumentintstrclsparser r   ^/home/djax/ivt_ai_plugin/venv/lib/python3.10/site-packages/kafka/cli/admin/cluster/log_dirs.pyadd_arguments   s   zDescribeLogDirs.add_argumentsc                 C   s   |j |j|jdS )N)topic_partitionsr   )describe_log_dirsr   r   )r   clientargsr   r   r   command   s   zDescribeLogDirs.commandN__name__
__module____qualname__COMMANDHELPclassmethodr   r   r   r   r   r   r      s    
r   c                   @   r   )AlterLogDirszalter-log-dirsz>Move replicas between log directories on their hosting brokersc              
   C   s   |j ddtddg ddd d S )Nz-az--assignmentr   assignmentsTzTOPIC:PARTITION:BROKER_ID=/absolute/log/dir/path (repeatable). Instructs BROKER_ID to move its replica of TOPIC:PARTITION into the given log directory.)r   r   r	   defaultrequiredr
   )r   r   r   r   r   r   r      s
   
zAlterLogDirs.add_argumentsc                 C   sj   i }|j D ]!}|dd\}}|dd\}}}	t|t|t|	}
|||
< q||}dd | D S )N=   :   c                 S   s.   i | ]\}}|j  d |j d |j |jqS )r'   )topic	partition	broker_idr   ).0tprerrr   r   r   
<dictcomp>(   s    z(AlterLogDirs.command.<locals>.<dictcomp>)r"   rsplitr   r   alter_replica_log_dirsitems)r   r   r   r"   spectpr_strlog_dirr)   r*   r+   r-   resultr   r   r   r      s   


zAlterLogDirs.commandNr   r   r   r   r   r!      s    
r!   N)kafka.structsr   r   r!   r   r   r   r   <module>   s    