
    L                     z    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  SS	KJr  S
 rS rS rg)z'Utils for common jobs API interactions.    )absolute_import)division)unicode_literals)apis)	name_util)
properties)progress_tracker)retryc                 &    AU R                   (       + $ )zGTakes TransferJob Apitools object and returns if it lacks an operation.)latestOperationName)resultretryer_states     0lib/googlecloudsdk/api_lib/transfer/jobs_util.py_has_not_created_operationr      s    ''	''    c                 <   [         R                  " SS5      n[         R                  " SS5      n[        R                  " U 5      nUR
                  R                  UR                  U[        R                  R                  R                  R                  5       S95      $ )z0Returns job details from API as Apitools object.transferv1)jobName	projectId)r   GetClientInstanceGetMessagesModuler   add_job_prefixtransferJobsGet%StoragetransferTransferJobsGetRequestr   VALUEScoreproject)nameclientmessagesformatted_job_names       r   api_getr$   "   s    !!*d3&##J5( //5				 	 44$%%**22668 5 :
; ;r   c                 0   [         R                  " SS9   [        R                  " 5       R	                  [
        U /[        [        R                  R                  R                  R                  5       S9R                  sSSS5        $ ! , (       d  f       g= f)zABlocks until job creates an operation and returns operation name.z!Polling for latest operation name)message)argsshould_retry_ifsleep_msN)r	   ProgressTrackerr
   RetryerRetryOnResultr$   r   r   r   r   no_async_polling_interval_msGetIntr   )r    s    r   block_until_operation_createdr/   .   sm    ''13==?((V2&&CCJJL )  3 3 3s   A(B
BN)__doc__
__future__r   r   r   googlecloudsdk.api_lib.utilr   #googlecloudsdk.command_lib.transferr   googlecloudsdk.corer   googlecloudsdk.core.consoler	   googlecloudsdk.core.utilr
   r   r$   r/    r   r   <module>r8      s1    . &  ' , 9 * 8 *(	;
r   