
                             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KJr  SSKJr  SS	KJr   " S
 S\R*                  5      rg)z"Command for creating target pools.    )absolute_import)division)unicode_literals)base_classes)base)
exceptions)flags)logc                   :    \ rS rSrSrSrSrSr\S 5       r	S r
Srg)Create!   aU  Define a load-balanced pool of virtual machine instances.

*{command}* is used to create a target pool. A target pool resource
defines a group of instances that can receive incoming traffic
from forwarding rules. When a forwarding rule directs traffic to a
target pool, Compute Engine picks an instance from the
target pool based on a hash of the source and
destination IP addresses and ports. For more
information on load balancing, see
[](https://cloud.google.com/compute/docs/load-balancing-and-autoscaling/)

To add instances to a target pool, use 'gcloud compute
target-pools add-instances'.
Nc                 `   UR                   R                  [        R                  5        [        R                  " SS9U l        [        R                  " SS9U l        U R                  R                  U5        [        R                  " 5       U l        U R                  R                  USS9  UR                   R                  [        R                  5        UR                  SSS9  UR                  SS	S9  UR                  S
[        SS9  UR                  SSSS9  [         R"                  " USS9  g )NF)requiredcreate)operation_typez--backup-poola          Together with ``--failover-ratio'', this flag defines the fallback
        behavior of the target pool (primary pool) to be created by this
        command. If the ratio of the healthy instances in the primary pool
        is at or below the specified ``--failover-ratio value'', then traffic
        arriving at the load-balanced IP address will be directed to the
        backup pool. If this flag is provided, then ``--failover-ratio'' is
        required.
        )helpz--descriptionz,An optional description of this target pool.--failover-ratioaB          Together with ``--backup-pool'', defines the fallback behavior of the
        target pool (primary pool) to be created by this command. If the
        ratio of the healthy instances in the primary pool is at or below this
        number, traffic arriving at the load-balanced IP address will be
        directed to the backup pool. For example, if 0.4 is chosen as the
        failover ratio, then traffic will fail over to the backup pool if
        more than 40% of the instances become unhealthy.
        If not set, the traffic will be directed the
        instances in this pool in the ``force'' mode, where traffic will be
        spread to the healthy instances with the best effort, or to all
        instances when no instance is healthy.
        If this flag is provided, then ``--backup-pool'' is required.
        )typer   z--health-checkHEALTH_CHECKa          DEPRECATED, use --http-health-check.
        Specifies an HTTP health check resource to use to determine the health
        of instances in this pool. If no health check is specified, traffic will
        be sent to all instances in this target pool as if the instances
        were healthy, but the health status of this pool will appear as
        unhealthy as a warning that this target pool does not have a health
        check.
        )metavarr   T)target_pools)display_info	AddFormatr	   DEFAULT_LIST_FORMATBackupPoolArgumentBACKUP_POOL_ARGhttp_health_check_flags*HttpHealthCheckArgumentForTargetPoolCreateHTTP_HEALTH_CHECK_ARGAddArgumentTargetPoolArgumentTARGET_POOL_ARGAddCacheUpdaterTargetPoolsCompleteradd_argumentfloatbackend_services_flagsAddSessionAffinity)clsparsers     *lib/surface/compute/target_pools/create.pyArgsCreate.Args5   s*   
!!%";";<22EBCJJ	  ))&1224C##F8#D
''(B(BC
  
 ;  =   $    --f4H    c                 r   [         R                  " U R                  5       5      nUR                  nUR                  (       a  UR                  S5      (       a'  UR                  (       a-  UR                  S5      (       d  [        R                  " SS5      eUR                  b7  UR                  S:  d  UR                  S:  a  [        R                  " SS5      eUR                  (       a2  UR                  Ul        [        R                  " S	UR                  5        UR                  (       a5  U R                  R                  XR                   5      R#                  5       /nO/ nU R$                  R                  UUR                   [&        R(                  " U5      S
9nUR                  (       aE  UR*                  Ul        U R.                  R                  XR                   5      R#                  5       nOSnUR0                  R3                  UR0                  R5                  UUR6                  UR                  UUR9                  5       UR0                  R4                  R;                  UR<                  5      S9UR*                  UR>                  S9nURA                  URB                  RD                  SU4/5      $ )z3Issues requests necessary for adding a target pool.failover_ratiobackup_poolr   zREither both or neither of [--failover-ratio] and [--backup-pool] must be provided.Nr      z?[--failover-ratio] must be a number between 0 and 1, inclusive.zRThe --health-check flag is deprecated. Use equivalent --http-health-check=%s flag.)scope_lister)
backupPooldescriptionfailoverRatiohealthChecksnamesessionAffinity)
targetPoolregionprojectInsert)#r   ComputeApiHolderReleaseTrackclientr1   IsSpecifiedr0   calliope_exceptionsBadArgumentExceptionInvalidArgumentExceptionhealth_checkhttp_health_checkr
   warningr   ResolveAsResource	resourcesSelfLinkr"   compute_flagsGetDefaultScopeListerr;   backup_pool_regionr   messagesComputeTargetPoolsInsertRequest
TargetPoolr5   NameSessionAffinityValueValuesEnumsession_affinityr<   MakeRequestsapitools_clienttargetPools)selfargsholderr@   rF   target_pool_refbackup_pool_urirequests           r+   Run
Create.Runr   sc   **4+<+<+>?F]]F			$"2"23C"D"D			T%5%5m%D%D44
 
 &			q	 D$7$7!$;!::MO 	O #00d	kk 1262C2CE 55GG
  ""*(*. **<<"88@ = BO
  / 6 6d,,>>
  ""*(*  ooo==??--&((--* %%'**II))+ . - %%'' > )G !7!7!C!CX!(!*  + , ,r.    )__name__
__module____qualname____firstlineno____doc__r   r   r"   classmethodr,   r]   __static_attributes__r_   r.   r+   r   r   !   s3     //:I :Ix8,r.   r   N)rd   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   rB   "googlecloudsdk.command_lib.computer	   rK   3googlecloudsdk.command_lib.compute.backend_servicesr'   5googlecloudsdk.command_lib.compute.http_health_checksr   /googlecloudsdk.command_lib.compute.target_poolsgooglecloudsdk.corer
   CreateCommandr   r_   r.   r+   <module>rp      sC    ) &  ' 7 ( E E%& A #I,T I,r.   