
                             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  G d d	ej                        Z G d
 dej                        Zy)zOperation Poller.    )absolute_import)division)unicode_literals)lifesciences_client)waiter)
exceptionsc                   (     e Zd ZdZ fdZd Z xZS )OperationPollerz>Class for polling Cloud Life Sciences long running Operations.c                 |    t         t        |   t        j                         j
                  j                  d        y )Nc                     | S )N )xs    ?lib/googlecloudsdk/command_lib/lifesciences/operation_poller.py<lambda>z*OperationPoller.__init__.<locals>.<lambda>   s    ab    )superr
   __init__r   LifeSciencesClientclientprojects_locations_operations)self	__class__s    r   r   zOperationPoller.__init__   s.    	/4)..077UUWbdr   c                     |j                   r7|j                  r*t        |j                  |j                  j                        yy)NTF)doneerrorOperationErrornamemessage)r   	operations     r   IsDonezOperationPoller.IsDone!   s1    ~~	Y^^Y__-D-DEEr   )__name__
__module____qualname____doc__r   r    __classcell__r   s   @r   r
   r
      s    Fdr   r
   c                   "     e Zd ZdZ fdZ xZS )r   zHClass for errors raised when a polled operation completes with an error.c                 L    t         t        |   dj                  ||             y )NzOperation [{}] failed: {})r   r   r   format)r   operation_namedescriptionr   s      r   r   zOperationError.__init__,   s%    	.$()D)K)K*% &r   )r!   r"   r#   r$   r   r%   r&   s   @r   r   r   )   s    P& &r   r   N)r$   
__future__r   r   r   #googlecloudsdk.api_lib.lifesciencesr   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   core_exceptionsCloudOperationPollerNoResourcesr
   Errorr   r   r   r   <module>r3      s@     &  ' C . =f<< &_** &r   