
                         J    d Z ddlmZ ddlmZ ddlmZ ddlmZ 	 	 	 	 	 ddZy)	z.Utilities for AI Platform operations commands.    )absolute_import)division)unicode_literals)logNc                     t         j                  t         j                  t         j                  d}|r*|j	                  |       ||   |j
                  |       |S | j                  ||||      j                  S )al  Waits for an operation if asynchronous flag is off.

  Args:
    operations_client: api_lib.ai.operations.OperationsClient, the client via
      which to poll.
    op: Cloud AI Platform operation, the operation to poll.
    op_ref: The operation reference to the operation resource. It's the result
      by calling resources.REGISTRY.Parse
    asynchronous: bool, whether to wait for the operation or return immediately
    log_method: Logging method used for synchronous operation. If None, no log
    message: str, the message to display while waiting for the operation.
    kind: str, the resource kind (instance, cluster, project, etc.), which will
      be passed to logging function.
    max_wait_ms: int, number of ms to wait before raising WaitException.

  Returns:
    The result of the operation if asynchronous is true, or the Operation
      message otherwise
  )createdeleteupdate)kind)messagemax_wait_ms)r   CreatedResourceDeletedResourceUpdatedResourcegetnameWaitForOperationresponse)	operations_clientopop_refasynchronous
log_methodr   r   r   logging_functions	            4lib/googlecloudsdk/command_lib/ai/operations_util.pyWaitForOpMayber      s~    < ######
 J'3"z"2776I		+	+&'{ 
, 
H    )FNNNi@w )__doc__
__future__r   r   r   googlecloudsdk.corer   r    r   r   <module>r"      s,    5 &  ' # 	(r   