text: # coding=utf-8
  # *** WARNING: this file was generated by the Pulumi SDK Generator. ***
  # *** Do not edit by hand unless you're certain you know what you are doing! ***
  
  import warnings
  import pulumi
  import pulumi.runtime
  from typing import Any, Mapping, Optional, Sequence, Union, overload
  from ... import _utilities
  from ._enums import *
  
  __all__ = ['TargetPoolArgs', 'TargetPool']
  
  @pulumi.input_type
  class TargetPoolArgs:
      def __init__(__self__, *,
                   region: pulumi.Input[str],
                   backup_pool: Optional[pulumi.Input[str]] = None,
                   description: Optional[pulumi.Input[str]] = None,
                   failover_ratio: Optional[pulumi.Input[float]] = None,
                   health_checks: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   instances: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   project: Optional[pulumi.Input[str]] = None,
                   request_id: Optional[pulumi.Input[str]] = None,
                   session_affinity: Optional[pulumi.Input['TargetPoolSessionAffinity']] = None):
          """
          The set of arguments for constructing a TargetPool resource.
          :param pulumi.Input[str] backup_pool: The server-defined URL for the resource. This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value between [0, 1]. backupPool and failoverRatio together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below failoverRatio, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio and backupPool are not set, or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          :param pulumi.Input[str] description: An optional description of this resource. Provide this property when you create the resource.
          :param pulumi.Input[float] failover_ratio: This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). The value of the field must be in [0, 1]. If set, backupPool must also be set. They together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          :param pulumi.Input[Sequence[pulumi.Input[str]]] health_checks: The URL of the HttpHealthCheck resource. A member instance in this pool is considered healthy if and only if the health checks pass. Only legacy HttpHealthChecks are supported. Only one health check may be specified.
          :param pulumi.Input[Sequence[pulumi.Input[str]]] instances: A list of resource URLs to the virtual machine instances serving this pool. They must live in zones contained in the same region as this pool.
          :param pulumi.Input[str] name: Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
          :param pulumi.Input['TargetPoolSessionAffinity'] session_affinity: Session affinity option, must be one of the following values: NONE: Connections from the same client IP may go to any instance in the pool. CLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy. CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy.
          """
          pulumi.set(__self__, "region", region)
          if backup_pool is not None:
              pulumi.set(__self__, "backup_pool", backup_pool)
          if description is not None:
              pulumi.set(__self__, "description", description)
          if failover_ratio is not None:
              pulumi.set(__self__, "failover_ratio", failover_ratio)
          if health_checks is not None:
              pulumi.set(__self__, "health_checks", health_checks)
          if instances is not None:
              pulumi.set(__self__, "instances", instances)
          if name is not None:
              pulumi.set(__self__, "name", name)
          if project is not None:
              pulumi.set(__self__, "project", project)
          if request_id is not None:
              pulumi.set(__self__, "request_id", request_id)
          if session_affinity is not None:
              pulumi.set(__self__, "session_affinity", session_affinity)
  
      @property
      @pulumi.getter
      def region(self) -> pulumi.Input[str]:
          return pulumi.get(self, "region")
  
      @region.setter
      def region(self, value: pulumi.Input[str]):
          pulumi.set(self, "region", value)
  
      @property
      @pulumi.getter(name="backupPool")
      def backup_pool(self) -> Optional[pulumi.Input[str]]:
          """
          The server-defined URL for the resource. This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value between [0, 1]. backupPool and failoverRatio together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below failoverRatio, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio and backupPool are not set, or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          """
          return pulumi.get(self, "backup_pool")
  
      @backup_pool.setter
      def backup_pool(self, value: Optional[pulumi.Input[str]]):
          pulumi.set(self, "backup_pool", value)
  
      @property
      @pulumi.getter
      def description(self) -> Optional[pulumi.Input[str]]:
          """
          An optional description of this resource. Provide this property when you create the resource.
          """
          return pulumi.get(self, "description")
  
      @description.setter
      def description(self, value: Optional[pulumi.Input[str]]):
          pulumi.set(self, "description", value)
  
      @property
      @pulumi.getter(name="failoverRatio")
      def failover_ratio(self) -> Optional[pulumi.Input[float]]:
          """
          This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). The value of the field must be in [0, 1]. If set, backupPool must also be set. They together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          """
          return pulumi.get(self, "failover_ratio")
  
      @failover_ratio.setter
      def failover_ratio(self, value: Optional[pulumi.Input[float]]):
          pulumi.set(self, "failover_ratio", value)
  
      @property
      @pulumi.getter(name="healthChecks")
      def health_checks(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
          """
          The URL of the HttpHealthCheck resource. A member instance in this pool is considered healthy if and only if the health checks pass. Only legacy HttpHealthChecks are supported. Only one health check may be specified.
          """
          return pulumi.get(self, "health_checks")
  
      @health_checks.setter
      def health_checks(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
          pulumi.set(self, "health_checks", value)
  
      @property
      @pulumi.getter
      def instances(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
          """
          A list of resource URLs to the virtual machine instances serving this pool. They must live in zones contained in the same region as this pool.
          """
          return pulumi.get(self, "instances")
  
      @instances.setter
      def instances(self, value: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]):
          pulumi.set(self, "instances", value)
  
      @property
      @pulumi.getter
      def name(self) -> Optional[pulumi.Input[str]]:
          """
          Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
          """
          return pulumi.get(self, "name")
  
      @name.setter
      def name(self, value: Optional[pulumi.Input[str]]):
          pulumi.set(self, "name", value)
  
      @property
      @pulumi.getter
      def project(self) -> Optional[pulumi.Input[str]]:
          return pulumi.get(self, "project")
  
      @project.setter
      def project(self, value: Optional[pulumi.Input[str]]):
          pulumi.set(self, "project", value)
  
      @property
      @pulumi.getter(name="requestId")
      def request_id(self) -> Optional[pulumi.Input[str]]:
          return pulumi.get(self, "request_id")
  
      @request_id.setter
      def request_id(self, value: Optional[pulumi.Input[str]]):
          pulumi.set(self, "request_id", value)
  
      @property
      @pulumi.getter(name="sessionAffinity")
      def session_affinity(self) -> Optional[pulumi.Input['TargetPoolSessionAffinity']]:
          """
          Session affinity option, must be one of the following values: NONE: Connections from the same client IP may go to any instance in the pool. CLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy. CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy.
          """
          return pulumi.get(self, "session_affinity")
  
      @session_affinity.setter
      def session_affinity(self, value: Optional[pulumi.Input['TargetPoolSessionAffinity']]):
          pulumi.set(self, "session_affinity", value)
  
  
  class TargetPool(pulumi.CustomResource):
      @overload
      def __init__(__self__,
                   resource_name: str,
                   opts: Optional[pulumi.ResourceOptions] = None,
                   backup_pool: Optional[pulumi.Input[str]] = None,
                   description: Optional[pulumi.Input[str]] = None,
                   failover_ratio: Optional[pulumi.Input[float]] = None,
                   health_checks: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   instances: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   project: Optional[pulumi.Input[str]] = None,
                   region: Optional[pulumi.Input[str]] = None,
                   request_id: Optional[pulumi.Input[str]] = None,
                   session_affinity: Optional[pulumi.Input['TargetPoolSessionAffinity']] = None,
                   __props__=None):
          """
          Creates a target pool in the specified project and region using the data included in the request.
  
          :param str resource_name: The name of the resource.
          :param pulumi.ResourceOptions opts: Options for the resource.
          :param pulumi.Input[str] backup_pool: The server-defined URL for the resource. This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value between [0, 1]. backupPool and failoverRatio together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below failoverRatio, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio and backupPool are not set, or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          :param pulumi.Input[str] description: An optional description of this resource. Provide this property when you create the resource.
          :param pulumi.Input[float] failover_ratio: This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). The value of the field must be in [0, 1]. If set, backupPool must also be set. They together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          :param pulumi.Input[Sequence[pulumi.Input[str]]] health_checks: The URL of the HttpHealthCheck resource. A member instance in this pool is considered healthy if and only if the health checks pass. Only legacy HttpHealthChecks are supported. Only one health check may be specified.
          :param pulumi.Input[Sequence[pulumi.Input[str]]] instances: A list of resource URLs to the virtual machine instances serving this pool. They must live in zones contained in the same region as this pool.
          :param pulumi.Input[str] name: Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
          :param pulumi.Input['TargetPoolSessionAffinity'] session_affinity: Session affinity option, must be one of the following values: NONE: Connections from the same client IP may go to any instance in the pool. CLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy. CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy.
          """
          ...
      @overload
      def __init__(__self__,
                   resource_name: str,
                   args: TargetPoolArgs,
                   opts: Optional[pulumi.ResourceOptions] = None):
          """
          Creates a target pool in the specified project and region using the data included in the request.
  
          :param str resource_name: The name of the resource.
          :param TargetPoolArgs args: The arguments to use to populate this resource's properties.
          :param pulumi.ResourceOptions opts: Options for the resource.
          """
          ...
      def __init__(__self__, resource_name: str, *args, **kwargs):
          resource_args, opts = _utilities.get_resource_args_opts(TargetPoolArgs, pulumi.ResourceOptions, *args, **kwargs)
          if resource_args is not None:
              __self__._internal_init(resource_name, opts, **resource_args.__dict__)
          else:
              __self__._internal_init(resource_name, *args, **kwargs)
  
      def _internal_init(__self__,
                   resource_name: str,
                   opts: Optional[pulumi.ResourceOptions] = None,
                   backup_pool: Optional[pulumi.Input[str]] = None,
                   description: Optional[pulumi.Input[str]] = None,
                   failover_ratio: Optional[pulumi.Input[float]] = None,
                   health_checks: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   instances: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   name: Optional[pulumi.Input[str]] = None,
                   project: Optional[pulumi.Input[str]] = None,
                   region: Optional[pulumi.Input[str]] = None,
                   request_id: Optional[pulumi.Input[str]] = None,
                   session_affinity: Optional[pulumi.Input['TargetPoolSessionAffinity']] = None,
                   __props__=None):
          if opts is None:
              opts = pulumi.ResourceOptions()
          if not isinstance(opts, pulumi.ResourceOptions):
              raise TypeError('Expected resource options to be a ResourceOptions instance')
          if opts.version is None:
              opts.version = _utilities.get_version()
          if opts.id is None:
              if __props__ is not None:
                  raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
              __props__ = TargetPoolArgs.__new__(TargetPoolArgs)
  
              __props__.__dict__["backup_pool"] = backup_pool
              __props__.__dict__["description"] = description
              __props__.__dict__["failover_ratio"] = failover_ratio
              __props__.__dict__["health_checks"] = health_checks
              __props__.__dict__["instances"] = instances
              __props__.__dict__["name"] = name
              __props__.__dict__["project"] = project
              if region is None and not opts.urn:
                  raise TypeError("Missing required property 'region'")
              __props__.__dict__["region"] = region
              __props__.__dict__["request_id"] = request_id
              __props__.__dict__["session_affinity"] = session_affinity
              __props__.__dict__["creation_timestamp"] = None
              __props__.__dict__["kind"] = None
              __props__.__dict__["self_link"] = None
          super(TargetPool, __self__).__init__(
              'google-native:compute/beta:TargetPool',
              resource_name,
              __props__,
              opts)
  
      @staticmethod
      def get(resource_name: str,
              id: pulumi.Input[str],
              opts: Optional[pulumi.ResourceOptions] = None) -> 'TargetPool':
          """
          Get an existing TargetPool resource's state with the given name, id, and optional extra
          properties used to qualify the lookup.
  
          :param str resource_name: The unique name of the resulting resource.
          :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
          :param pulumi.ResourceOptions opts: Options for the resource.
          """
          opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
  
          __props__ = TargetPoolArgs.__new__(TargetPoolArgs)
  
          __props__.__dict__["backup_pool"] = None
          __props__.__dict__["creation_timestamp"] = None
          __props__.__dict__["description"] = None
          __props__.__dict__["failover_ratio"] = None
          __props__.__dict__["health_checks"] = None
          __props__.__dict__["instances"] = None
          __props__.__dict__["kind"] = None
          __props__.__dict__["name"] = None
          __props__.__dict__["region"] = None
          __props__.__dict__["self_link"] = None
          __props__.__dict__["session_affinity"] = None
          return TargetPool(resource_name, opts=opts, __props__=__props__)
  
      @property
      @pulumi.getter(name="backupPool")
      def backup_pool(self) -> pulumi.Output[str]:
          """
          The server-defined URL for the resource. This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool, and its failoverRatio field is properly set to a value between [0, 1]. backupPool and failoverRatio together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below failoverRatio, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio and backupPool are not set, or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          """
          return pulumi.get(self, "backup_pool")
  
      @property
      @pulumi.getter(name="creationTimestamp")
      def creation_timestamp(self) -> pulumi.Output[str]:
          """
          Creation timestamp in RFC3339 text format.
          """
          return pulumi.get(self, "creation_timestamp")
  
      @property
      @pulumi.getter
      def description(self) -> pulumi.Output[str]:
          """
          An optional description of this resource. Provide this property when you create the resource.
          """
          return pulumi.get(self, "description")
  
      @property
      @pulumi.getter(name="failoverRatio")
      def failover_ratio(self) -> pulumi.Output[float]:
          """
          This field is applicable only when the containing target pool is serving a forwarding rule as the primary pool (i.e., not as a backup pool to some other target pool). The value of the field must be in [0, 1]. If set, backupPool must also be set. They together define the fallback behavior of the primary target pool: if the ratio of the healthy instances in the primary pool is at or below this number, traffic arriving at the load-balanced IP will be directed to the backup pool. In case where failoverRatio is not set or all the instances in the backup pool are unhealthy, the traffic will be directed back to the primary 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.
          """
          return pulumi.get(self, "failover_ratio")
  
      @property
      @pulumi.getter(name="healthChecks")
      def health_checks(self) -> pulumi.Output[Sequence[str]]:
          """
          The URL of the HttpHealthCheck resource. A member instance in this pool is considered healthy if and only if the health checks pass. Only legacy HttpHealthChecks are supported. Only one health check may be specified.
          """
          return pulumi.get(self, "health_checks")
  
      @property
      @pulumi.getter
      def instances(self) -> pulumi.Output[Sequence[str]]:
          """
          A list of resource URLs to the virtual machine instances serving this pool. They must live in zones contained in the same region as this pool.
          """
          return pulumi.get(self, "instances")
  
      @property
      @pulumi.getter
      def kind(self) -> pulumi.Output[str]:
          """
          Type of the resource. Always compute#targetPool for target pools.
          """
          return pulumi.get(self, "kind")
  
      @property
      @pulumi.getter
      def name(self) -> pulumi.Output[str]:
          """
          Name of the resource. Provided by the client when the resource is created. The name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
          """
          return pulumi.get(self, "name")
  
      @property
      @pulumi.getter
      def region(self) -> pulumi.Output[str]:
          """
          URL of the region where the target pool resides.
          """
          return pulumi.get(self, "region")
  
      @property
      @pulumi.getter(name="selfLink")
      def self_link(self) -> pulumi.Output[str]:
          """
          Server-defined URL for the resource.
          """
          return pulumi.get(self, "self_link")
  
      @property
      @pulumi.getter(name="sessionAffinity")
      def session_affinity(self) -> pulumi.Output[str]:
          """
          Session affinity option, must be one of the following values: NONE: Connections from the same client IP may go to any instance in the pool. CLIENT_IP: Connections from the same client IP will go to the same instance in the pool while that instance remains healthy. CLIENT_IP_PROTO: Connections from the same client IP with the same IP protocol will go to the same instance in the pool while that instance remains healthy.
          """
          return pulumi.get(self, "session_affinity")
  
  