
                             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
  G d d	ej                        Zy
)z1Command for adding health checks to target pools.    )absolute_import)division)unicode_literals)base_classes)base)flagsc                   .    e Zd ZdZdZdZed        Zd Zy)AddHealthChecksa  Add a legacy HTTP health check to a target pool.

  *{command}* is used to add a legacy HTTP health check
  to a target pool. Legacy health checks are used to determine
  the health status of instances in the target pool. Only one
  health check can be attached to a target pool, so this command
  will fail if there as already a health check attached to the target
  pool. For more information on health checks and load balancing, see
  [](https://cloud.google.com/compute/docs/load-balancing-and-autoscaling/)
  Nc                     t        j                  d      | _        | j                  j                  |       t	        j
                  d      | _        | j                  j                  |d       y )Nzadd toz" to which to add the health check.)help_suffixzadd health checks to)operation_type)http_health_check_flags$HttpHealthCheckArgumentForTargetPoolHEALTH_CHECK_ARGAddArgumentr   TargetPoolArgumentTARGET_POOL_ARG)clsparsers     5lib/surface/compute/target_pools/add_health_checks.pyArgszAddHealthChecks.Args-   sc     	 DDXN $$V,228:C##5 $ 7    c                 |   t        j                  | j                               }|j                  }| j                  j                  ||j                        }| j                  j                  ||j                  t        j                  |            }|j                  j                  |j                  |j                  |j                         |j                  j                  |j                  j!                  |j#                               g            }|j%                  |j&                  j(                  d|fg      S )N)scope_lister)healthCheck)healthChecks)regionproject
targetPool targetPoolsAddHealthCheckRequestAddHealthCheck)r   ComputeApiHolderReleaseTrackclientr   ResolveAsResource	resourcesr   compute_flagsGetDefaultScopeListermessages'ComputeTargetPoolsAddHealthCheckRequestr   r   Name TargetPoolsAddHealthCheckRequestHealthCheckReferenceSelfLinkMakeRequestsapitools_clienttargetPools)selfargsholderr$   health_check_reftarget_pool_refrequests          r   RunzAddHealthChecks.Run7   s+   **4+<+<+>?F]]F,,>>f  **<<"88@ = BO
 ooEE%%''"'')OO<<$ooBB 0 9 9 ; C = > = ? F AG !7!7!C!C!17!<  = > >r   )	__name__
__module____qualname____doc__r   r   classmethodr   r8    r   r   r
   r
      s+    	 /7 7>r   r
   N)r<   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   r'   5googlecloudsdk.command_lib.compute.http_health_checksr   /googlecloudsdk.command_lib.compute.target_poolsSilentCommandr
   r>   r   r   <module>rF      s6     8 &  ' 7 ( E& A/>d(( />r   