
                             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 S	\R                   5      rg
)z1Command for removing instances from target pools.    )base_classes)utils)base)
exceptions)flags)logc                   6    \ rS rSrSrSrSr\S 5       rS r	Sr
g)RemoveInstances   zRemove instances from a target pool.

*{command}* is used to remove one or more instances from a
target pool.
For more information on health checks and load balancing, see
[](https://cloud.google.com/compute/docs/load-balancing-and-autoscaling/)
Nc                    [         R                  " S5      U l        U R                  R                  USSS9  [        R
                  " SS9U l        U R                  R                  U5        [        R                  " USSSS	9  g )
Nzremove fromzremove from the target poolINSTANCE)operation_typecust_metavarz$ from which to remove the instances.)help_suffix	instanceszZDEPRECATED, use --instances-zone. If not specified, you will be prompted to select a zone.)resource_typer   explanation)	instance_flagsInstanceArgumentForTargetPoolINSTANCE_ARGAddArgumentr   'TargetPoolArgumentForAddRemoveInstancesTARGET_POOL_ARGcompute_flagsAddZoneFlag)clsparsers     4lib/surface/compute/target_pools/remove_instances.pyArgsRemoveInstances.Args(   s    %CCC  4 ! !  GG:<C##F+!4GI    c           	      B   [         R                  " U R                  5       5      nUR                  nUR                  (       aC  UR
                  (       d2  UR                  Ul        [        R                  " SUR
                  5        U R                  R                  UUR                  [        R                  " U5      S9nU Vs/ s H*  nUR                  R                  UR                  5       S9PM,     nn[!        S U 5       5      n[#        U5      S:  a  [$        R&                  " S5      eUR)                  5       nUR*                  (       a%  XR*                  :w  a  [$        R&                  " S5      eXl        U R,                  R                  UUR                  5      n	UR                  R/                  U	R*                  U	R0                  U	R3                  5       UR                  R5                  US9S9n
UR7                  UR8                  R:                  S	U
4/5      $ s  snf )
z,Issues a TargetPools.RemoveInstance request.zGThe --zone flag is deprecated. Use equivalent --instances-zone=%s flag.)scope_lister)instancec              3   b   #    U  H%  n[         R                  " UR                  5      v   M'     g 7f)N)r   ZoneNameToRegionNamezone).0instance_refs     r   	<genexpr>&RemoveInstances.Run.<locals>.<genexpr>R   s+      <-:\ 33L4E4EFF-:s   -/   z<Instances must all be in the same region as the target pool.)r   )regionproject
targetPool targetPoolsRemoveInstanceRequestRemoveInstance)r   ComputeApiHolderReleaseTrackclientr'   instances_zoner   warningr   ResolveAsResource	resourcesr   GetDefaultScopeListermessagesInstanceReferenceSelfLinksetlencompute_exceptionsArgumentErrorpopr-   r   'ComputeTargetPoolsRemoveInstanceRequestr.   Name TargetPoolsRemoveInstanceRequestMakeRequestsapitools_clienttargetPools)selfargsholderr4   instance_refsr)   r   unique_regionsr-   target_pool_refrequests              r   RunRemoveInstances.Run<   s   **4+<+<+>?F]]Fyy,, IId	kk ./3/B/BD %%77"88@ 8 BM *+)L 	))<3H3H3J)K)  +  <-:< <N >Q,,
HJ J !F {{v,,,
HJ J K**<<T=C=M=MOO ooEE%%''"'')OO<<# = % F 'G !7!7!C!C!17!<  = > >E+s   1H )__name__
__module____qualname____firstlineno____doc__r   r   classmethodr   rO   __static_attributes__rQ   r!   r   r
   r
      s,     ,/I I&2>r!   r
   N)rV   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   r?   r   r   ,googlecloudsdk.command_lib.compute.instancesr   /googlecloudsdk.command_lib.compute.target_poolsgooglecloudsdk.corer   SilentCommandr
   rQ   r!   r   <module>r`      s8    8 8 0 ( O E P A #R>d(( R>r!   