
                            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$                  R&                  5       " S S\	R(                  5      5       5       rg)z'Command for creating UDP health checks.    )absolute_import)division)unicode_literals)base_classes)health_checks_utils)base)
exceptions)flagsc                      SSS.$ )Nz=Create a UDP health check to monitor load balanced instances.a            *{command}* is used to create a UDP health check. UDP health checks
        monitor instances in a load balancer controlled by a target pool. All
        arguments to the command are optional except for the name of the health
        check, request and response. For more information on load balancing, see
        [](https://cloud.google.com/compute/docs/load-balancing-and-autoscaling/)
          )briefDESCRIPTION r       /lib/surface/compute/health_checks/create/udp.py_DetailedHelpr      s     J	
 r   c                     U R                   R                  [        R                  5        [        R                  " S5      R                  U SS9  [        R                  " U 5        [        R                  " U S5        g )NUDPcreate)operation_type)	display_info	AddFormatr
   DEFAULT_LIST_FORMATHealthCheckArgumentAddArgumentr   AddUdpRelatedArgsAddProtocolAgnosticCreationArgs)parsers    r   _Argsr   +   sX     9 9:E"..vh.O''/55feDr   c                    UR                   n[        R                  " S5      R                  XR                  5      nU R
                  (       d  [        R                  " S5      eU R                  (       d  [        R                  " S5      e[        R                  " U5      (       Ga  UR                  R                  UR                  R                  UR                  5       U R                  UR                  R                  R                   R"                  UR                  R%                  U R
                  U R                  U R&                  U R(                  S9U R*                  U R,                  U R.                  U R0                  S9UR2                  UR4                  S9nUR6                  R8                  nGOUR                  R;                  UR                  R                  UR                  5       U R                  UR                  R                  R                   R"                  UR                  R%                  U R
                  U R                  U R&                  U R(                  S9U R*                  U R,                  U R.                  U R0                  S9UR2                  S9nUR6                  R<                  nUR?                  USU4/5      $ )	z9Issues the request necessary for adding the health check.r   z)"request" field for UDP can not be empty.z*"response" field for UDP can not be empty.)requestresponseportportName)namedescriptiontypeudpHealthCheckcheckIntervalSec
timeoutSechealthyThresholdunhealthyThreshold)healthCheckprojectregion)r,   r-   Insert) clientr
   r   ResolveAsResource	resourcesr    r	   ArgumentErrorr!   r   IsRegionalHealthCheckRefmessages&ComputeRegionHealthChecksInsertRequestHealthCheckNamer%   TypeValueValuesEnumr   UDPHealthCheckr"   	port_namecheck_intervaltimeouthealthy_thresholdunhealthy_thresholdr-   r.   apitools_clientregionHealthChecks ComputeHealthChecksInsertRequesthealthChecksMakeRequests)argsholderr0   health_check_refr    
collections         r   _RunrI   2   sA   ==&..u5GG
 


"
"#N
OO	

"
"#O
PP112BCCooDDOO//!&&(((,,@@DD!??99YY	 : )
 "00||!33#77 0 
 !((&&! E (G" ''::Joo>>OO//!&&(((,,@@DD!??99YY	 : )
 "00||!33#77 0 
 !(( ? *G  ''44J			z8W=>	??r   c                   <    \ rS rSrSr\" 5       r\S 5       rS r	Sr
g)CreateAlphah   zCreate an Alpha UDP health check to monitor load balanced instances.

Business logic should be put in helper functions. Classes annotated with
@base.ReleaseTracks should only be concerned with calling helper functions
with the correct feature parameters.
c                     [        U5        g N)r   )clsr   s     r   ArgsCreateAlpha.Argst   s	    	&Mr   c                 `    [         R                  " U R                  5       5      n[        X5      $ rN   )r   ComputeApiHolderReleaseTrackrI   )selfrE   rF   s      r   RunCreateAlpha.Runx   s&    **4+<+<+>?Fr   r   N)__name__
__module____qualname____firstlineno____doc__r   detailed_helpclassmethodrP   rV   __static_attributes__r   r   r   rK   rK   h   s'      /- r   rK   N)r\   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   0googlecloudsdk.command_lib.compute.health_checksr	   r
   r   r   rI   HiddenReleaseTracksrT   ALPHACreateCommandrK   r   r   r   <module>rh      sx    . &  ' 7 > ( G BE3@l D%%++,$$$  - r   