
    p                         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)z+Command for getting a target pool's health.    )absolute_import)division)unicode_literals)base_classes)utils)base)flagsc                   8    \ rS rSrSrSr\S 5       rS rS r	Sr
g)	GetHealth   znGet the health of instances in a target pool.

*{command}* displays the health of instances in a target pool.
Nc                 l    [         R                  " 5       U l        U R                  R                  USS9  g )Nzget health information for)operation_type)r	   TargetPoolArgumentTARGET_POOL_ARGAddArgument)clsparsers     .lib/surface/compute/target_pools/get_health.pyArgsGetHealth.Args%   s2    224C##; $ =    c           
          UR                  UR                  R                  SUR                  R	                  UR
                  UR                  UR                  5       S94/5      nUS   $ )z!Fetches the target pool resource.Get)projectregion
targetPoolr   )MakeRequestsapitools_clienttargetPoolsmessagesComputeTargetPoolsGetRequestr   r   Name)selfclienttarget_pool_refobjectss       r   GetTargetPoolGetHealth.GetTargetPool+   sn    !!

 
 
,
,e
//
6
6%--$++(--/ 7 1
2 	34G 1:r   c              #     #    [         R                  " U R                  5       5      nUR                  nU R                  R                  UUR                  [        R                  " U5      S9nU R                  X45      nUR                  nU(       d  g/ nU H  nUR                  R                  UR                  R                  US9UR                  UR                  UR!                  5       S9n	UR#                  UR$                  R&                  SU	45        M     / n
UR)                  UU
S9nU H  nUv   M	     U
(       a  [*        R,                  " U
SS9  gg7f)	z3Returns a list of TargetPoolInstanceHealth objects.)scope_listerN)instance)instanceReferencer   r   r   r   )requestserrors_to_collectz&Could not get health for some targets:)error_message)r   ComputeApiHolderReleaseTrackr$   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr'   	instancesr    "ComputeTargetPoolsGetHealthRequestInstanceReferencer   r   r"   appendr   r   r   r   RaiseToolException)r#   argsholderr$   r%   target_poolr6   r-   r+   request_messageerrorsr3   resources                r   RunGetHealth.Run5   s[    **4+<+<+>?F]]F**<<"88@ = BO $$V=K%%I HJJ"OO== > !!)) ''$))+ K -o oov--99;&( )  F##  $ "I n  
@B s   EE )__name__
__module____qualname____firstlineno____doc__r   classmethodr   r'   rA   __static_attributes__rC   r   r   r   r      s+    
 /= =
'Br   r   N)rH   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r4   /googlecloudsdk.command_lib.compute.target_poolsDescribeCommandr   rC   r   r   <module>rQ      s6     2 &  ' 7 0 ( E A?B$$ ?Br   