
    6                         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!The configs waiters wait command.    )absolute_import)division)unicode_literals)util)arg_parsers)base)flagsc                   .    e Zd ZdZddiZed        Zd Zy)WaitzsWait for a waiter to end in success or failure.

  This command waits for a waiter to end in success or failure.
  EXAMPLESz
          To wait for a waiter named "my-waiter" within a configuration named
          "my-config", run:

            $ {command} my-waiter --config-name=my-config
          c           	          t        j                  |        | j                  dt        j                  ddj                  t        j                              d       | j                  dd	       y
)zArgs is called by calliope to gather arguments for this command.

    Args:
      parser: An argparse parser that you can use to add arguments that go
          on the command line after this command. Positional arguments are
          allowed.
    z
--max-wait1sz{0}s)lower_boundupper_boundz        The maximum amount of time to wait for a waiter to finish.
        See $ gcloud topic datetimes for information on duration formats.
        )typehelpnamezThe waiter name.)r   N)r	   AddRequiredConfigFlagadd_argumentr   Durationformatr   MAX_WAITER_TIMEOUT)parsers    2lib/surface/runtime_config/configs/waiters/wait.pyArgsz	Wait.Args+   si     
'
!!d.4mm&*&=&=/?@   %78    c                     t        j                  |j                  |      }t        j                  ||j                        }t        j
                  |      rd| _        t        j                  |      S )a  Run 'runtime-configs waiters wait'.

    Args:
      args: argparse.Namespace, The arguments that this command was invoked
          with.

    Returns:
      The requested waiter, after waiting for it to succeed or fail.

    Raises:
      HttpException: An http error response was received while executing api
          request.
      OperationTimeoutError: If the waiter doesn't complete in time.
    )max_wait   )r   ParseWaiterNamer   WaitForWaiterr   IsFailedWaiter	exit_codeFormatWaiter)selfargswaiter_resourceresults       r   RunzWait.RunB   sV     **499d;O$--HF6"dnV$$r   N)__name__
__module____qualname____doc__detailed_helpstaticmethodr   r)    r   r   r   r      s1      - 9 9,%r   r   N)r-   
__future__r   r   r   %googlecloudsdk.api_lib.runtime_configr   googlecloudsdk.callioper   r   )googlecloudsdk.command_lib.runtime_configr	   Commandr   r0   r   r   <module>r6      s/     ( &  ' 6 / ( ;9%4<< 9%r   