
    j                        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
 rS rS r\	R$                  " \	R&                  R(                  5      \	R*                   " S S\	R,                  5      5       5       r\	R$                  " \	R&                  R0                  5       " S S\5      5       r\	R$                  " \	R&                  R4                  5       " S S\5      5       rg)z'Command for creating TCP health checks.    )absolute_import)division)unicode_literals)base_classes)health_checks_utils)base)scope)flagsc                      SSS.$ )Nz=Create a TCP health check to monitor load balanced instances.au            *{command}* is used to create a non-legacy health check using the TCP
          protocol. You can use this health check for Google Cloud
          load balancers or for managed instance group autohealing. For more
          information, see the health checks overview at:
          [](https://cloud.google.com/load-balancing/docs/health-check-concepts)
          )briefDESCRIPTION r       /lib/surface/compute/health_checks/create/tcp.py_DetailedHelpr      s     J	
 r   c                 n   U R                   R                  [        R                  5        [        R                  " S5      R                  U SS9  [        R                  " U 5        [        R                  " U S5        U(       a  [        R                  " U 5        U(       a  [        R                  " U 5        gg)z0Set up arguments to create an HTTP2 HealthCheck.TCPcreate)operation_typeN)display_info	AddFormatr
   DEFAULT_LIST_FORMATHealthCheckArgumentAddArgumentr   AddTcpRelatedCreationArgsAddProtocolAgnosticCreationArgs&AddHealthCheckSourceRegionsRelatedArgs AddHealthCheckLoggingRelatedArgs)parserinclude_log_configinclude_source_regionss      r   _Argsr"   +   s     9 9:E"..vh.O//755feD>>vF88@ r   c                 `   UR                   nUR                  n[        R                  " S5      R	                  XR
                  [        R                  R                  S9nUR                  R                  U R                  5      nUR                  U R                  U R                  U R                  U R                  US9n[         R"                  " X5        [         R$                  " U5      (       a  UR'                  UR)                  UR+                  5       U R,                  UR(                  R.                  R0                  UU R2                  U R4                  U R6                  U R8                  S9UR:                  UR<                  S9n	UR>                  R@                  n
OURC                  UR)                  UR+                  5       U R,                  UR(                  R.                  R0                  UU R2                  U R4                  U R6                  U R8                  S9UR:                  S9n	UR>                  RD                  n
U(       a%  [         RF                  " X@5      U	RH                  l%        U(       a(  U RL                  b  U RL                  U	RH                  l'        URQ                  U
SU	4/5      $ )z9Issues the request necessary for adding the health check.r   )default_scope)requestresponseportportNameproxyHeader)namedescriptiontypetcpHealthCheckcheckIntervalSec
timeoutSechealthyThresholdunhealthyThreshold)healthCheckprojectregion)r2   r3   Insert))clientmessagesr
   r   ResolveAsResource	resourcescompute_scope	ScopeEnumGLOBALTCPHealthCheckProxyHeaderValueValuesEnumproxy_headerr%   r&   r'   	port_namer   ,ValidateAndAddPortSpecificationToHealthCheckIsRegionalHealthCheckRef&ComputeRegionHealthChecksInsertRequestHealthCheckNamer+   TypeValueValuesEnumr   check_intervaltimeouthealthy_thresholdunhealthy_thresholdr3   r4   apitools_clientregionHealthChecks ComputeHealthChecksInsertRequesthealthChecksCreateLogConfigr2   	logConfigsource_regionssourceRegionsMakeRequests)argsholderr    r!   r6   r7   health_check_refr?   tcp_health_checkr%   
collections              r   _RunrY   7   sZ   ==&__(..u5GG
M,C,C,J,J H L((CC
,,,ll}}99~~ -   BB
 112BCC==((!&&(((%%99==+!00||!33#77 ) 9 !((&& > (G ''::J77((!&&(((%%99==+!00||!33#77 ) 9 !(( 8 
*G ''44J$7$G$G%G! !4!4!@(,(;(;G%			z8W=>	??r   c                   D    \ rS rSrSrSrSr\" 5       r\	S 5       r
S rSrg)Createp   zCreate a TCP health.Tc                 D    [        XR                  U R                  5        g N)r"   _include_log_config_include_source_regions)clsr   s     r   ArgsCreate.Argsy   s    	&))3+F+FGr   c                     [         R                  " U R                  5       5      n[        XU R                  U R
                  5      $ r^   )r   ComputeApiHolderReleaseTrackrY   r_   r`   )selfrT   rU   s      r   Run
Create.Run}   s;    **4+<+<+>?Fd..0L0L r   r   N)__name__
__module____qualname____firstlineno____doc__r_   r`   r   detailed_helpclassmethodrb   rh   __static_attributes__r   r   r   r[   r[   p   s3      /-H Hr   r[   c                       \ rS rSrSrg)
CreateBeta   r   Nrj   rk   rl   rm   rq   r   r   r   rs   rs           r   rs   c                       \ rS rSrSrg)CreateAlpha   r   Nru   r   r   r   rx   rx      rv   r   rx   N)rn   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer	   r:   0googlecloudsdk.command_lib.compute.health_checksr
   r   r"   rY   ReleaseTracksrf   GADefaultUniverseOnlyCreateCommandr[   BETArs   ALPHArx   r   r   r   <module>r      s    . &  ' 7 > ( E B	A6@r D%%(()T   *$ D%%**+  ,
 D%%++,*  -r   