
    
                     |   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 dd	lmZ ddlmZ d
 ZdZ e
j&                  de       e
j(                  e
j*                  j,                  e
j*                  j.                  e
j*                  j0                         G d de
j2                                      Zy)z@Command for waiting until managed instance group becomes stable.    )absolute_import)division)unicode_literals)base_classes)
wait_utils)base)flags)scopec                 r    | j                  dt        d       t        j                  j	                  |        y)z
Adds args.z	--timeoutz9Timeout in seconds for waiting for group becoming stable.)typehelpN)add_argumentintinstance_groups_flags%MULTISCOPE_INSTANCE_GROUP_MANAGER_ARGAddArgumentparsers    @lib/surface/compute/instance_groups/managed/wait_until_stable.py_AddArgsr      s8    k3  4 ==II    z`gcloud compute instance-groups managed wait-until-stable` is deprecated. Please use `gcloud compute instance-groups managed wait-until --stable` instead.F)
is_removedwarningc                   0    e Zd ZdZdZed        Zd Zd Zy)WaitUntilStablez6Waits until state of managed instance group is stable.
   c                     t        |        y )Nr   )r   r   s    r   ArgszWaitUntilStable.Args4   s
    Fr   c                     t         j                  j                  ||t        j                  j
                  t        j                  |            S )N)default_scopescope_lister)r   r   ResolveAsResourcecompute_scope	ScopeEnumZONEr	   GetDefaultScopeLister)selfclient	resourcesargss       r   CreateGroupReferencez$WaitUntilStable.CreateGroupReference8   sE    !GG+55::"88@	  BBr   c                    t        j                  | j                               }|j                  }| j	                  ||j
                  |      }t        j                  ||t        j                  j                  |j                         y)z8Issues requests necessary to wait until stable on a MIG.N)r   ComputeApiHolderReleaseTrackr(   r+   r)   r   WaitForIgmStateIgmStateSTABLEtimeout)r'   r*   holderr(   	group_refs        r   RunzWaitUntilStable.Run@   sf    **4+<+<+>?F]]F))&&2B2BDII	:..55t||Er   N)	__name__
__module____qualname____doc___TIME_BETWEEN_POLLS_SECstaticmethodr   r+   r5    r   r   r   r   ,   s+     ? BEr   r   N)r9   
__future__r   r   r   googlecloudsdk.api_lib.computer   6googlecloudsdk.api_lib.compute.instance_groups.managedr   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r
   r#   2googlecloudsdk.command_lib.compute.instance_groupsr   r   _DEPRECATION_WARNING	DeprecateReleaseTracksr.   GABETAALPHACommandr   r<   r   r   <module>rJ      s    G &  ' 7 M ( 4 E ]  5*>?D%%(($*;*;*@*@%%++-Edll E- @Er   