
    	                         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  G d d	ej                        Zy
)zWait operations command.    )absolute_import)division)unicode_literals)
exceptions)util)basec                   0    e Zd ZdZdddZed        Zd Zy)Waitz!Poll an operation for completion.z{description}zk          To poll an operation for completion, run:

            $ {command} sample-operation-id
          )DESCRIPTIONEXAMPLESc                 *    | j                  dd       y)zRegister flags for this command.

    Args:
      parser: An argparse.ArgumentParser-like object. It is mocked out in order
        to capture some information, but behaves like an ArgumentParser.
    operation_idzThe operation id to poll.)helpN)add_argument)parsers    (lib/surface/container/operations/wait.pyArgsz	Wait.Args*   s     -HI    c                 ~   | j                   d   }| j                   d   } ||      }|j                  |j                  |      }	 |j                  |       |j	                  |dj                  |j                              S # t        j                  $ r)}t        j                  |t        j                        d}~ww xY w)zThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    api_adapterlocation_getzWaiting for {0} to completeN)contextParseOperationr   GetOperationWaitForOperationformatoperationIdapitools_exceptions	HttpErrorr   HttpExceptionr   HTTP_ERROR_FORMAT)selfargsadapterr   locationoperation_referrors          r   RunzWait.Run4   s     ll=)G<</LD!H**4+<+<hGMD=)%%

'
.
.}/H/H
IK K (( D$$UD,B,BCCDs   ;B   B<$B77B<N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r(    r   r   r
   r
      s2    ) 		- J JDr   r
   N)r,   
__future__r   r   r   apitools.base.pyr   r    googlecloudsdk.api_lib.containerr   googlecloudsdk.callioper   Commandr
   r/   r   r   <module>r5      s1     &  ' > 1 ( .0D4<< 0Dr   