{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.ELBV2.CreateTargetGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a target group.
--
-- For more information, see the following:
--
-- -   <https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html Target groups for your Application Load Balancers>
--
-- -   <https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html Target groups for your Network Load Balancers>
--
-- -   <https://docs.aws.amazon.com/elasticloadbalancing/latest/gateway/target-groups.html Target groups for your Gateway Load Balancers>
--
-- This operation is idempotent, which means that it completes at most one
-- time. If you attempt to create multiple target groups with the same
-- settings, each call succeeds.
module Amazonka.ELBV2.CreateTargetGroup
  ( -- * Creating a Request
    CreateTargetGroup (..),
    newCreateTargetGroup,

    -- * Request Lenses
    createTargetGroup_healthCheckEnabled,
    createTargetGroup_healthCheckIntervalSeconds,
    createTargetGroup_healthCheckPath,
    createTargetGroup_healthCheckPort,
    createTargetGroup_healthCheckProtocol,
    createTargetGroup_healthCheckTimeoutSeconds,
    createTargetGroup_healthyThresholdCount,
    createTargetGroup_ipAddressType,
    createTargetGroup_matcher,
    createTargetGroup_port,
    createTargetGroup_protocol,
    createTargetGroup_protocolVersion,
    createTargetGroup_tags,
    createTargetGroup_targetType,
    createTargetGroup_unhealthyThresholdCount,
    createTargetGroup_vpcId,
    createTargetGroup_name,

    -- * Destructuring the Response
    CreateTargetGroupResponse (..),
    newCreateTargetGroupResponse,

    -- * Response Lenses
    createTargetGroupResponse_targetGroups,
    createTargetGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ELBV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateTargetGroup' smart constructor.
data CreateTargetGroup = CreateTargetGroup'
  { -- | Indicates whether health checks are enabled. If the target type is
    -- @lambda@, health checks are disabled by default but can be enabled. If
    -- the target type is @instance@, @ip@, or @alb@, health checks are always
    -- enabled and cannot be disabled.
    CreateTargetGroup -> Maybe Bool
healthCheckEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The approximate amount of time, in seconds, between health checks of an
    -- individual target. The range is 5-300. If the target group protocol is
    -- TCP, TLS, UDP, TCP_UDP, HTTP or HTTPS, the default is 30 seconds. If the
    -- target group protocol is GENEVE, the default is 10 seconds. If the
    -- target type is @lambda@, the default is 35 seconds.
    CreateTargetGroup -> Maybe Natural
healthCheckIntervalSeconds :: Prelude.Maybe Prelude.Natural,
    -- | [HTTP\/HTTPS health checks] The destination for health checks on the
    -- targets.
    --
    -- [HTTP1 or HTTP2 protocol version] The ping path. The default is \/.
    --
    -- [GRPC protocol version] The path of a custom health check method with
    -- the format \/package.service\/method. The default is \/Amazon Web
    -- Services.ALB\/healthcheck.
    CreateTargetGroup -> Maybe Text
healthCheckPath :: Prelude.Maybe Prelude.Text,
    -- | The port the load balancer uses when performing health checks on
    -- targets. If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the
    -- default is @traffic-port@, which is the port on which each target
    -- receives traffic from the load balancer. If the protocol is GENEVE, the
    -- default is port 80.
    CreateTargetGroup -> Maybe Text
healthCheckPort :: Prelude.Maybe Prelude.Text,
    -- | The protocol the load balancer uses when performing health checks on
    -- targets. For Application Load Balancers, the default is HTTP. For
    -- Network Load Balancers and Gateway Load Balancers, the default is TCP.
    -- The TCP protocol is not supported for health checks if the protocol of
    -- the target group is HTTP or HTTPS. The GENEVE, TLS, UDP, and TCP_UDP
    -- protocols are not supported for health checks.
    CreateTargetGroup -> Maybe ProtocolEnum
healthCheckProtocol :: Prelude.Maybe ProtocolEnum,
    -- | The amount of time, in seconds, during which no response from a target
    -- means a failed health check. The range is 2–120 seconds. For target
    -- groups with a protocol of HTTP, the default is 6 seconds. For target
    -- groups with a protocol of TCP, TLS or HTTPS, the default is 10 seconds.
    -- For target groups with a protocol of GENEVE, the default is 5 seconds.
    -- If the target type is @lambda@, the default is 30 seconds.
    CreateTargetGroup -> Maybe Natural
healthCheckTimeoutSeconds :: Prelude.Maybe Prelude.Natural,
    -- | The number of consecutive health check successes required before
    -- considering a target healthy. The range is 2-10. If the target group
    -- protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 5. For
    -- target groups with a protocol of GENEVE, the default is 3. If the target
    -- type is @lambda@, the default is 5.
    CreateTargetGroup -> Maybe Natural
healthyThresholdCount :: Prelude.Maybe Prelude.Natural,
    -- | The type of IP address used for this target group. The possible values
    -- are @ipv4@ and @ipv6@. This is an optional parameter. If not specified,
    -- the IP address type defaults to @ipv4@.
    CreateTargetGroup -> Maybe TargetGroupIpAddressTypeEnum
ipAddressType :: Prelude.Maybe TargetGroupIpAddressTypeEnum,
    -- | [HTTP\/HTTPS health checks] The HTTP or gRPC codes to use when checking
    -- for a successful response from a target. For target groups with a
    -- protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target
    -- groups with a protocol of HTTP or HTTPS, the range is 200-499. For
    -- target groups with a protocol of GENEVE, the range is 200-399.
    CreateTargetGroup -> Maybe Matcher
matcher :: Prelude.Maybe Matcher,
    -- | The port on which the targets receive traffic. This port is used unless
    -- you specify a port override when registering the target. If the target
    -- is a Lambda function, this parameter does not apply. If the protocol is
    -- GENEVE, the supported port is 6081.
    CreateTargetGroup -> Maybe Natural
port :: Prelude.Maybe Prelude.Natural,
    -- | The protocol to use for routing traffic to the targets. For Application
    -- Load Balancers, the supported protocols are HTTP and HTTPS. For Network
    -- Load Balancers, the supported protocols are TCP, TLS, UDP, or TCP_UDP.
    -- For Gateway Load Balancers, the supported protocol is GENEVE. A TCP_UDP
    -- listener must be associated with a TCP_UDP target group. If the target
    -- is a Lambda function, this parameter does not apply.
    CreateTargetGroup -> Maybe ProtocolEnum
protocol :: Prelude.Maybe ProtocolEnum,
    -- | [HTTP\/HTTPS protocol] The protocol version. Specify @GRPC@ to send
    -- requests to targets using gRPC. Specify @HTTP2@ to send requests to
    -- targets using HTTP\/2. The default is @HTTP1@, which sends requests to
    -- targets using HTTP\/1.1.
    CreateTargetGroup -> Maybe Text
protocolVersion :: Prelude.Maybe Prelude.Text,
    -- | The tags to assign to the target group.
    CreateTargetGroup -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The type of target that you must specify when registering targets with
    -- this target group. You can\'t specify targets for a target group using
    -- more than one target type.
    --
    -- -   @instance@ - Register targets by instance ID. This is the default
    --     value.
    --
    -- -   @ip@ - Register targets by IP address. You can specify IP addresses
    --     from the subnets of the virtual private cloud (VPC) for the target
    --     group, the RFC 1918 range (10.0.0.0\/8, 172.16.0.0\/12, and
    --     192.168.0.0\/16), and the RFC 6598 range (100.64.0.0\/10). You
    --     can\'t specify publicly routable IP addresses.
    --
    -- -   @lambda@ - Register a single Lambda function as a target.
    --
    -- -   @alb@ - Register a single Application Load Balancer as a target.
    CreateTargetGroup -> Maybe TargetTypeEnum
targetType :: Prelude.Maybe TargetTypeEnum,
    -- | The number of consecutive health check failures required before
    -- considering a target unhealthy. The range is 2-10. If the target group
    -- protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 2. For
    -- target groups with a protocol of GENEVE, the default is 3. If the target
    -- type is @lambda@, the default is 5.
    CreateTargetGroup -> Maybe Natural
unhealthyThresholdCount :: Prelude.Maybe Prelude.Natural,
    -- | The identifier of the virtual private cloud (VPC). If the target is a
    -- Lambda function, this parameter does not apply. Otherwise, this
    -- parameter is required.
    CreateTargetGroup -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text,
    -- | The name of the target group.
    --
    -- This name must be unique per region per account, can have a maximum of
    -- 32 characters, must contain only alphanumeric characters or hyphens, and
    -- must not begin or end with a hyphen.
    CreateTargetGroup -> Text
name :: Prelude.Text
  }
  deriving (CreateTargetGroup -> CreateTargetGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTargetGroup -> CreateTargetGroup -> Bool
$c/= :: CreateTargetGroup -> CreateTargetGroup -> Bool
== :: CreateTargetGroup -> CreateTargetGroup -> Bool
$c== :: CreateTargetGroup -> CreateTargetGroup -> Bool
Prelude.Eq, ReadPrec [CreateTargetGroup]
ReadPrec CreateTargetGroup
Int -> ReadS CreateTargetGroup
ReadS [CreateTargetGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTargetGroup]
$creadListPrec :: ReadPrec [CreateTargetGroup]
readPrec :: ReadPrec CreateTargetGroup
$creadPrec :: ReadPrec CreateTargetGroup
readList :: ReadS [CreateTargetGroup]
$creadList :: ReadS [CreateTargetGroup]
readsPrec :: Int -> ReadS CreateTargetGroup
$creadsPrec :: Int -> ReadS CreateTargetGroup
Prelude.Read, Int -> CreateTargetGroup -> ShowS
[CreateTargetGroup] -> ShowS
CreateTargetGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTargetGroup] -> ShowS
$cshowList :: [CreateTargetGroup] -> ShowS
show :: CreateTargetGroup -> String
$cshow :: CreateTargetGroup -> String
showsPrec :: Int -> CreateTargetGroup -> ShowS
$cshowsPrec :: Int -> CreateTargetGroup -> ShowS
Prelude.Show, forall x. Rep CreateTargetGroup x -> CreateTargetGroup
forall x. CreateTargetGroup -> Rep CreateTargetGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTargetGroup x -> CreateTargetGroup
$cfrom :: forall x. CreateTargetGroup -> Rep CreateTargetGroup x
Prelude.Generic)

-- |
-- Create a value of 'CreateTargetGroup' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'healthCheckEnabled', 'createTargetGroup_healthCheckEnabled' - Indicates whether health checks are enabled. If the target type is
-- @lambda@, health checks are disabled by default but can be enabled. If
-- the target type is @instance@, @ip@, or @alb@, health checks are always
-- enabled and cannot be disabled.
--
-- 'healthCheckIntervalSeconds', 'createTargetGroup_healthCheckIntervalSeconds' - The approximate amount of time, in seconds, between health checks of an
-- individual target. The range is 5-300. If the target group protocol is
-- TCP, TLS, UDP, TCP_UDP, HTTP or HTTPS, the default is 30 seconds. If the
-- target group protocol is GENEVE, the default is 10 seconds. If the
-- target type is @lambda@, the default is 35 seconds.
--
-- 'healthCheckPath', 'createTargetGroup_healthCheckPath' - [HTTP\/HTTPS health checks] The destination for health checks on the
-- targets.
--
-- [HTTP1 or HTTP2 protocol version] The ping path. The default is \/.
--
-- [GRPC protocol version] The path of a custom health check method with
-- the format \/package.service\/method. The default is \/Amazon Web
-- Services.ALB\/healthcheck.
--
-- 'healthCheckPort', 'createTargetGroup_healthCheckPort' - The port the load balancer uses when performing health checks on
-- targets. If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the
-- default is @traffic-port@, which is the port on which each target
-- receives traffic from the load balancer. If the protocol is GENEVE, the
-- default is port 80.
--
-- 'healthCheckProtocol', 'createTargetGroup_healthCheckProtocol' - The protocol the load balancer uses when performing health checks on
-- targets. For Application Load Balancers, the default is HTTP. For
-- Network Load Balancers and Gateway Load Balancers, the default is TCP.
-- The TCP protocol is not supported for health checks if the protocol of
-- the target group is HTTP or HTTPS. The GENEVE, TLS, UDP, and TCP_UDP
-- protocols are not supported for health checks.
--
-- 'healthCheckTimeoutSeconds', 'createTargetGroup_healthCheckTimeoutSeconds' - The amount of time, in seconds, during which no response from a target
-- means a failed health check. The range is 2–120 seconds. For target
-- groups with a protocol of HTTP, the default is 6 seconds. For target
-- groups with a protocol of TCP, TLS or HTTPS, the default is 10 seconds.
-- For target groups with a protocol of GENEVE, the default is 5 seconds.
-- If the target type is @lambda@, the default is 30 seconds.
--
-- 'healthyThresholdCount', 'createTargetGroup_healthyThresholdCount' - The number of consecutive health check successes required before
-- considering a target healthy. The range is 2-10. If the target group
-- protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 5. For
-- target groups with a protocol of GENEVE, the default is 3. If the target
-- type is @lambda@, the default is 5.
--
-- 'ipAddressType', 'createTargetGroup_ipAddressType' - The type of IP address used for this target group. The possible values
-- are @ipv4@ and @ipv6@. This is an optional parameter. If not specified,
-- the IP address type defaults to @ipv4@.
--
-- 'matcher', 'createTargetGroup_matcher' - [HTTP\/HTTPS health checks] The HTTP or gRPC codes to use when checking
-- for a successful response from a target. For target groups with a
-- protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target
-- groups with a protocol of HTTP or HTTPS, the range is 200-499. For
-- target groups with a protocol of GENEVE, the range is 200-399.
--
-- 'port', 'createTargetGroup_port' - The port on which the targets receive traffic. This port is used unless
-- you specify a port override when registering the target. If the target
-- is a Lambda function, this parameter does not apply. If the protocol is
-- GENEVE, the supported port is 6081.
--
-- 'protocol', 'createTargetGroup_protocol' - The protocol to use for routing traffic to the targets. For Application
-- Load Balancers, the supported protocols are HTTP and HTTPS. For Network
-- Load Balancers, the supported protocols are TCP, TLS, UDP, or TCP_UDP.
-- For Gateway Load Balancers, the supported protocol is GENEVE. A TCP_UDP
-- listener must be associated with a TCP_UDP target group. If the target
-- is a Lambda function, this parameter does not apply.
--
-- 'protocolVersion', 'createTargetGroup_protocolVersion' - [HTTP\/HTTPS protocol] The protocol version. Specify @GRPC@ to send
-- requests to targets using gRPC. Specify @HTTP2@ to send requests to
-- targets using HTTP\/2. The default is @HTTP1@, which sends requests to
-- targets using HTTP\/1.1.
--
-- 'tags', 'createTargetGroup_tags' - The tags to assign to the target group.
--
-- 'targetType', 'createTargetGroup_targetType' - The type of target that you must specify when registering targets with
-- this target group. You can\'t specify targets for a target group using
-- more than one target type.
--
-- -   @instance@ - Register targets by instance ID. This is the default
--     value.
--
-- -   @ip@ - Register targets by IP address. You can specify IP addresses
--     from the subnets of the virtual private cloud (VPC) for the target
--     group, the RFC 1918 range (10.0.0.0\/8, 172.16.0.0\/12, and
--     192.168.0.0\/16), and the RFC 6598 range (100.64.0.0\/10). You
--     can\'t specify publicly routable IP addresses.
--
-- -   @lambda@ - Register a single Lambda function as a target.
--
-- -   @alb@ - Register a single Application Load Balancer as a target.
--
-- 'unhealthyThresholdCount', 'createTargetGroup_unhealthyThresholdCount' - The number of consecutive health check failures required before
-- considering a target unhealthy. The range is 2-10. If the target group
-- protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 2. For
-- target groups with a protocol of GENEVE, the default is 3. If the target
-- type is @lambda@, the default is 5.
--
-- 'vpcId', 'createTargetGroup_vpcId' - The identifier of the virtual private cloud (VPC). If the target is a
-- Lambda function, this parameter does not apply. Otherwise, this
-- parameter is required.
--
-- 'name', 'createTargetGroup_name' - The name of the target group.
--
-- This name must be unique per region per account, can have a maximum of
-- 32 characters, must contain only alphanumeric characters or hyphens, and
-- must not begin or end with a hyphen.
newCreateTargetGroup ::
  -- | 'name'
  Prelude.Text ->
  CreateTargetGroup
newCreateTargetGroup :: Text -> CreateTargetGroup
newCreateTargetGroup Text
pName_ =
  CreateTargetGroup'
    { $sel:healthCheckEnabled:CreateTargetGroup' :: Maybe Bool
healthCheckEnabled =
        forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckIntervalSeconds:CreateTargetGroup' :: Maybe Natural
healthCheckIntervalSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPath:CreateTargetGroup' :: Maybe Text
healthCheckPath = forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPort:CreateTargetGroup' :: Maybe Text
healthCheckPort = forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckProtocol:CreateTargetGroup' :: Maybe ProtocolEnum
healthCheckProtocol = forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: Maybe Natural
healthCheckTimeoutSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:healthyThresholdCount:CreateTargetGroup' :: Maybe Natural
healthyThresholdCount = forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddressType:CreateTargetGroup' :: Maybe TargetGroupIpAddressTypeEnum
ipAddressType = forall a. Maybe a
Prelude.Nothing,
      $sel:matcher:CreateTargetGroup' :: Maybe Matcher
matcher = forall a. Maybe a
Prelude.Nothing,
      $sel:port:CreateTargetGroup' :: Maybe Natural
port = forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:CreateTargetGroup' :: Maybe ProtocolEnum
protocol = forall a. Maybe a
Prelude.Nothing,
      $sel:protocolVersion:CreateTargetGroup' :: Maybe Text
protocolVersion = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateTargetGroup' :: Maybe (NonEmpty Tag)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:CreateTargetGroup' :: Maybe TargetTypeEnum
targetType = forall a. Maybe a
Prelude.Nothing,
      $sel:unhealthyThresholdCount:CreateTargetGroup' :: Maybe Natural
unhealthyThresholdCount = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:CreateTargetGroup' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateTargetGroup' :: Text
name = Text
pName_
    }

-- | Indicates whether health checks are enabled. If the target type is
-- @lambda@, health checks are disabled by default but can be enabled. If
-- the target type is @instance@, @ip@, or @alb@, health checks are always
-- enabled and cannot be disabled.
createTargetGroup_healthCheckEnabled :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Bool)
createTargetGroup_healthCheckEnabled :: Lens' CreateTargetGroup (Maybe Bool)
createTargetGroup_healthCheckEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Bool
healthCheckEnabled :: Maybe Bool
$sel:healthCheckEnabled:CreateTargetGroup' :: CreateTargetGroup -> Maybe Bool
healthCheckEnabled} -> Maybe Bool
healthCheckEnabled) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Bool
a -> CreateTargetGroup
s {$sel:healthCheckEnabled:CreateTargetGroup' :: Maybe Bool
healthCheckEnabled = Maybe Bool
a} :: CreateTargetGroup)

-- | The approximate amount of time, in seconds, between health checks of an
-- individual target. The range is 5-300. If the target group protocol is
-- TCP, TLS, UDP, TCP_UDP, HTTP or HTTPS, the default is 30 seconds. If the
-- target group protocol is GENEVE, the default is 10 seconds. If the
-- target type is @lambda@, the default is 35 seconds.
createTargetGroup_healthCheckIntervalSeconds :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Natural)
createTargetGroup_healthCheckIntervalSeconds :: Lens' CreateTargetGroup (Maybe Natural)
createTargetGroup_healthCheckIntervalSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Natural
healthCheckIntervalSeconds :: Maybe Natural
$sel:healthCheckIntervalSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
healthCheckIntervalSeconds} -> Maybe Natural
healthCheckIntervalSeconds) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Natural
a -> CreateTargetGroup
s {$sel:healthCheckIntervalSeconds:CreateTargetGroup' :: Maybe Natural
healthCheckIntervalSeconds = Maybe Natural
a} :: CreateTargetGroup)

-- | [HTTP\/HTTPS health checks] The destination for health checks on the
-- targets.
--
-- [HTTP1 or HTTP2 protocol version] The ping path. The default is \/.
--
-- [GRPC protocol version] The path of a custom health check method with
-- the format \/package.service\/method. The default is \/Amazon Web
-- Services.ALB\/healthcheck.
createTargetGroup_healthCheckPath :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Text)
createTargetGroup_healthCheckPath :: Lens' CreateTargetGroup (Maybe Text)
createTargetGroup_healthCheckPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Text
healthCheckPath :: Maybe Text
$sel:healthCheckPath:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
healthCheckPath} -> Maybe Text
healthCheckPath) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Text
a -> CreateTargetGroup
s {$sel:healthCheckPath:CreateTargetGroup' :: Maybe Text
healthCheckPath = Maybe Text
a} :: CreateTargetGroup)

-- | The port the load balancer uses when performing health checks on
-- targets. If the protocol is HTTP, HTTPS, TCP, TLS, UDP, or TCP_UDP, the
-- default is @traffic-port@, which is the port on which each target
-- receives traffic from the load balancer. If the protocol is GENEVE, the
-- default is port 80.
createTargetGroup_healthCheckPort :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Text)
createTargetGroup_healthCheckPort :: Lens' CreateTargetGroup (Maybe Text)
createTargetGroup_healthCheckPort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Text
healthCheckPort :: Maybe Text
$sel:healthCheckPort:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
healthCheckPort} -> Maybe Text
healthCheckPort) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Text
a -> CreateTargetGroup
s {$sel:healthCheckPort:CreateTargetGroup' :: Maybe Text
healthCheckPort = Maybe Text
a} :: CreateTargetGroup)

-- | The protocol the load balancer uses when performing health checks on
-- targets. For Application Load Balancers, the default is HTTP. For
-- Network Load Balancers and Gateway Load Balancers, the default is TCP.
-- The TCP protocol is not supported for health checks if the protocol of
-- the target group is HTTP or HTTPS. The GENEVE, TLS, UDP, and TCP_UDP
-- protocols are not supported for health checks.
createTargetGroup_healthCheckProtocol :: Lens.Lens' CreateTargetGroup (Prelude.Maybe ProtocolEnum)
createTargetGroup_healthCheckProtocol :: Lens' CreateTargetGroup (Maybe ProtocolEnum)
createTargetGroup_healthCheckProtocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe ProtocolEnum
healthCheckProtocol :: Maybe ProtocolEnum
$sel:healthCheckProtocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
healthCheckProtocol} -> Maybe ProtocolEnum
healthCheckProtocol) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe ProtocolEnum
a -> CreateTargetGroup
s {$sel:healthCheckProtocol:CreateTargetGroup' :: Maybe ProtocolEnum
healthCheckProtocol = Maybe ProtocolEnum
a} :: CreateTargetGroup)

-- | The amount of time, in seconds, during which no response from a target
-- means a failed health check. The range is 2–120 seconds. For target
-- groups with a protocol of HTTP, the default is 6 seconds. For target
-- groups with a protocol of TCP, TLS or HTTPS, the default is 10 seconds.
-- For target groups with a protocol of GENEVE, the default is 5 seconds.
-- If the target type is @lambda@, the default is 30 seconds.
createTargetGroup_healthCheckTimeoutSeconds :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Natural)
createTargetGroup_healthCheckTimeoutSeconds :: Lens' CreateTargetGroup (Maybe Natural)
createTargetGroup_healthCheckTimeoutSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Natural
healthCheckTimeoutSeconds :: Maybe Natural
$sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
healthCheckTimeoutSeconds} -> Maybe Natural
healthCheckTimeoutSeconds) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Natural
a -> CreateTargetGroup
s {$sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: Maybe Natural
healthCheckTimeoutSeconds = Maybe Natural
a} :: CreateTargetGroup)

-- | The number of consecutive health check successes required before
-- considering a target healthy. The range is 2-10. If the target group
-- protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 5. For
-- target groups with a protocol of GENEVE, the default is 3. If the target
-- type is @lambda@, the default is 5.
createTargetGroup_healthyThresholdCount :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Natural)
createTargetGroup_healthyThresholdCount :: Lens' CreateTargetGroup (Maybe Natural)
createTargetGroup_healthyThresholdCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Natural
healthyThresholdCount :: Maybe Natural
$sel:healthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
healthyThresholdCount} -> Maybe Natural
healthyThresholdCount) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Natural
a -> CreateTargetGroup
s {$sel:healthyThresholdCount:CreateTargetGroup' :: Maybe Natural
healthyThresholdCount = Maybe Natural
a} :: CreateTargetGroup)

-- | The type of IP address used for this target group. The possible values
-- are @ipv4@ and @ipv6@. This is an optional parameter. If not specified,
-- the IP address type defaults to @ipv4@.
createTargetGroup_ipAddressType :: Lens.Lens' CreateTargetGroup (Prelude.Maybe TargetGroupIpAddressTypeEnum)
createTargetGroup_ipAddressType :: Lens' CreateTargetGroup (Maybe TargetGroupIpAddressTypeEnum)
createTargetGroup_ipAddressType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe TargetGroupIpAddressTypeEnum
ipAddressType :: Maybe TargetGroupIpAddressTypeEnum
$sel:ipAddressType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetGroupIpAddressTypeEnum
ipAddressType} -> Maybe TargetGroupIpAddressTypeEnum
ipAddressType) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe TargetGroupIpAddressTypeEnum
a -> CreateTargetGroup
s {$sel:ipAddressType:CreateTargetGroup' :: Maybe TargetGroupIpAddressTypeEnum
ipAddressType = Maybe TargetGroupIpAddressTypeEnum
a} :: CreateTargetGroup)

-- | [HTTP\/HTTPS health checks] The HTTP or gRPC codes to use when checking
-- for a successful response from a target. For target groups with a
-- protocol of TCP, TCP_UDP, UDP or TLS the range is 200-599. For target
-- groups with a protocol of HTTP or HTTPS, the range is 200-499. For
-- target groups with a protocol of GENEVE, the range is 200-399.
createTargetGroup_matcher :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Matcher)
createTargetGroup_matcher :: Lens' CreateTargetGroup (Maybe Matcher)
createTargetGroup_matcher = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Matcher
matcher :: Maybe Matcher
$sel:matcher:CreateTargetGroup' :: CreateTargetGroup -> Maybe Matcher
matcher} -> Maybe Matcher
matcher) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Matcher
a -> CreateTargetGroup
s {$sel:matcher:CreateTargetGroup' :: Maybe Matcher
matcher = Maybe Matcher
a} :: CreateTargetGroup)

-- | The port on which the targets receive traffic. This port is used unless
-- you specify a port override when registering the target. If the target
-- is a Lambda function, this parameter does not apply. If the protocol is
-- GENEVE, the supported port is 6081.
createTargetGroup_port :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Natural)
createTargetGroup_port :: Lens' CreateTargetGroup (Maybe Natural)
createTargetGroup_port = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Natural
port :: Maybe Natural
$sel:port:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
port} -> Maybe Natural
port) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Natural
a -> CreateTargetGroup
s {$sel:port:CreateTargetGroup' :: Maybe Natural
port = Maybe Natural
a} :: CreateTargetGroup)

-- | The protocol to use for routing traffic to the targets. For Application
-- Load Balancers, the supported protocols are HTTP and HTTPS. For Network
-- Load Balancers, the supported protocols are TCP, TLS, UDP, or TCP_UDP.
-- For Gateway Load Balancers, the supported protocol is GENEVE. A TCP_UDP
-- listener must be associated with a TCP_UDP target group. If the target
-- is a Lambda function, this parameter does not apply.
createTargetGroup_protocol :: Lens.Lens' CreateTargetGroup (Prelude.Maybe ProtocolEnum)
createTargetGroup_protocol :: Lens' CreateTargetGroup (Maybe ProtocolEnum)
createTargetGroup_protocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe ProtocolEnum
protocol :: Maybe ProtocolEnum
$sel:protocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
protocol} -> Maybe ProtocolEnum
protocol) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe ProtocolEnum
a -> CreateTargetGroup
s {$sel:protocol:CreateTargetGroup' :: Maybe ProtocolEnum
protocol = Maybe ProtocolEnum
a} :: CreateTargetGroup)

-- | [HTTP\/HTTPS protocol] The protocol version. Specify @GRPC@ to send
-- requests to targets using gRPC. Specify @HTTP2@ to send requests to
-- targets using HTTP\/2. The default is @HTTP1@, which sends requests to
-- targets using HTTP\/1.1.
createTargetGroup_protocolVersion :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Text)
createTargetGroup_protocolVersion :: Lens' CreateTargetGroup (Maybe Text)
createTargetGroup_protocolVersion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Text
protocolVersion :: Maybe Text
$sel:protocolVersion:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
protocolVersion} -> Maybe Text
protocolVersion) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Text
a -> CreateTargetGroup
s {$sel:protocolVersion:CreateTargetGroup' :: Maybe Text
protocolVersion = Maybe Text
a} :: CreateTargetGroup)

-- | The tags to assign to the target group.
createTargetGroup_tags :: Lens.Lens' CreateTargetGroup (Prelude.Maybe (Prelude.NonEmpty Tag))
createTargetGroup_tags :: Lens' CreateTargetGroup (Maybe (NonEmpty Tag))
createTargetGroup_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateTargetGroup' :: CreateTargetGroup -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe (NonEmpty Tag)
a -> CreateTargetGroup
s {$sel:tags:CreateTargetGroup' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateTargetGroup) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of target that you must specify when registering targets with
-- this target group. You can\'t specify targets for a target group using
-- more than one target type.
--
-- -   @instance@ - Register targets by instance ID. This is the default
--     value.
--
-- -   @ip@ - Register targets by IP address. You can specify IP addresses
--     from the subnets of the virtual private cloud (VPC) for the target
--     group, the RFC 1918 range (10.0.0.0\/8, 172.16.0.0\/12, and
--     192.168.0.0\/16), and the RFC 6598 range (100.64.0.0\/10). You
--     can\'t specify publicly routable IP addresses.
--
-- -   @lambda@ - Register a single Lambda function as a target.
--
-- -   @alb@ - Register a single Application Load Balancer as a target.
createTargetGroup_targetType :: Lens.Lens' CreateTargetGroup (Prelude.Maybe TargetTypeEnum)
createTargetGroup_targetType :: Lens' CreateTargetGroup (Maybe TargetTypeEnum)
createTargetGroup_targetType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe TargetTypeEnum
targetType :: Maybe TargetTypeEnum
$sel:targetType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetTypeEnum
targetType} -> Maybe TargetTypeEnum
targetType) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe TargetTypeEnum
a -> CreateTargetGroup
s {$sel:targetType:CreateTargetGroup' :: Maybe TargetTypeEnum
targetType = Maybe TargetTypeEnum
a} :: CreateTargetGroup)

-- | The number of consecutive health check failures required before
-- considering a target unhealthy. The range is 2-10. If the target group
-- protocol is TCP, TCP_UDP, UDP, TLS, HTTP or HTTPS, the default is 2. For
-- target groups with a protocol of GENEVE, the default is 3. If the target
-- type is @lambda@, the default is 5.
createTargetGroup_unhealthyThresholdCount :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Natural)
createTargetGroup_unhealthyThresholdCount :: Lens' CreateTargetGroup (Maybe Natural)
createTargetGroup_unhealthyThresholdCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Natural
unhealthyThresholdCount :: Maybe Natural
$sel:unhealthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
unhealthyThresholdCount} -> Maybe Natural
unhealthyThresholdCount) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Natural
a -> CreateTargetGroup
s {$sel:unhealthyThresholdCount:CreateTargetGroup' :: Maybe Natural
unhealthyThresholdCount = Maybe Natural
a} :: CreateTargetGroup)

-- | The identifier of the virtual private cloud (VPC). If the target is a
-- Lambda function, this parameter does not apply. Otherwise, this
-- parameter is required.
createTargetGroup_vpcId :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Text)
createTargetGroup_vpcId :: Lens' CreateTargetGroup (Maybe Text)
createTargetGroup_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Maybe Text
a -> CreateTargetGroup
s {$sel:vpcId:CreateTargetGroup' :: Maybe Text
vpcId = Maybe Text
a} :: CreateTargetGroup)

-- | The name of the target group.
--
-- This name must be unique per region per account, can have a maximum of
-- 32 characters, must contain only alphanumeric characters or hyphens, and
-- must not begin or end with a hyphen.
createTargetGroup_name :: Lens.Lens' CreateTargetGroup Prelude.Text
createTargetGroup_name :: Lens' CreateTargetGroup Text
createTargetGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroup' {Text
name :: Text
$sel:name:CreateTargetGroup' :: CreateTargetGroup -> Text
name} -> Text
name) (\s :: CreateTargetGroup
s@CreateTargetGroup' {} Text
a -> CreateTargetGroup
s {$sel:name:CreateTargetGroup' :: Text
name = Text
a} :: CreateTargetGroup)

instance Core.AWSRequest CreateTargetGroup where
  type
    AWSResponse CreateTargetGroup =
      CreateTargetGroupResponse
  request :: (Service -> Service)
-> CreateTargetGroup -> Request CreateTargetGroup
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateTargetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateTargetGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateTargetGroupResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [TargetGroup] -> Int -> CreateTargetGroupResponse
CreateTargetGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x
                            forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"TargetGroups"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateTargetGroup where
  hashWithSalt :: Int -> CreateTargetGroup -> Int
hashWithSalt Int
_salt CreateTargetGroup' {Maybe Bool
Maybe Natural
Maybe (NonEmpty Tag)
Maybe Text
Maybe Matcher
Maybe ProtocolEnum
Maybe TargetGroupIpAddressTypeEnum
Maybe TargetTypeEnum
Text
name :: Text
vpcId :: Maybe Text
unhealthyThresholdCount :: Maybe Natural
targetType :: Maybe TargetTypeEnum
tags :: Maybe (NonEmpty Tag)
protocolVersion :: Maybe Text
protocol :: Maybe ProtocolEnum
port :: Maybe Natural
matcher :: Maybe Matcher
ipAddressType :: Maybe TargetGroupIpAddressTypeEnum
healthyThresholdCount :: Maybe Natural
healthCheckTimeoutSeconds :: Maybe Natural
healthCheckProtocol :: Maybe ProtocolEnum
healthCheckPort :: Maybe Text
healthCheckPath :: Maybe Text
healthCheckIntervalSeconds :: Maybe Natural
healthCheckEnabled :: Maybe Bool
$sel:name:CreateTargetGroup' :: CreateTargetGroup -> Text
$sel:vpcId:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:unhealthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:targetType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetTypeEnum
$sel:tags:CreateTargetGroup' :: CreateTargetGroup -> Maybe (NonEmpty Tag)
$sel:protocolVersion:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:protocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:port:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:matcher:CreateTargetGroup' :: CreateTargetGroup -> Maybe Matcher
$sel:ipAddressType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetGroupIpAddressTypeEnum
$sel:healthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckProtocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:healthCheckPort:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:healthCheckPath:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:healthCheckIntervalSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckEnabled:CreateTargetGroup' :: CreateTargetGroup -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
healthCheckEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
healthCheckIntervalSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
healthCheckPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
healthCheckPort
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProtocolEnum
healthCheckProtocol
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
healthCheckTimeoutSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
healthyThresholdCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetGroupIpAddressTypeEnum
ipAddressType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Matcher
matcher
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
port
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ProtocolEnum
protocol
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
protocolVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Tag)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TargetTypeEnum
targetType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
unhealthyThresholdCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData CreateTargetGroup where
  rnf :: CreateTargetGroup -> ()
rnf CreateTargetGroup' {Maybe Bool
Maybe Natural
Maybe (NonEmpty Tag)
Maybe Text
Maybe Matcher
Maybe ProtocolEnum
Maybe TargetGroupIpAddressTypeEnum
Maybe TargetTypeEnum
Text
name :: Text
vpcId :: Maybe Text
unhealthyThresholdCount :: Maybe Natural
targetType :: Maybe TargetTypeEnum
tags :: Maybe (NonEmpty Tag)
protocolVersion :: Maybe Text
protocol :: Maybe ProtocolEnum
port :: Maybe Natural
matcher :: Maybe Matcher
ipAddressType :: Maybe TargetGroupIpAddressTypeEnum
healthyThresholdCount :: Maybe Natural
healthCheckTimeoutSeconds :: Maybe Natural
healthCheckProtocol :: Maybe ProtocolEnum
healthCheckPort :: Maybe Text
healthCheckPath :: Maybe Text
healthCheckIntervalSeconds :: Maybe Natural
healthCheckEnabled :: Maybe Bool
$sel:name:CreateTargetGroup' :: CreateTargetGroup -> Text
$sel:vpcId:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:unhealthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:targetType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetTypeEnum
$sel:tags:CreateTargetGroup' :: CreateTargetGroup -> Maybe (NonEmpty Tag)
$sel:protocolVersion:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:protocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:port:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:matcher:CreateTargetGroup' :: CreateTargetGroup -> Maybe Matcher
$sel:ipAddressType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetGroupIpAddressTypeEnum
$sel:healthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckProtocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:healthCheckPort:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:healthCheckPath:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:healthCheckIntervalSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckEnabled:CreateTargetGroup' :: CreateTargetGroup -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
healthCheckEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
healthCheckIntervalSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
healthCheckPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
healthCheckPort
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProtocolEnum
healthCheckProtocol
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
healthCheckTimeoutSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
healthyThresholdCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetGroupIpAddressTypeEnum
ipAddressType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Matcher
matcher
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
port
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ProtocolEnum
protocol
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
protocolVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Tag)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TargetTypeEnum
targetType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
unhealthyThresholdCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders CreateTargetGroup where
  toHeaders :: CreateTargetGroup -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath CreateTargetGroup where
  toPath :: CreateTargetGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery CreateTargetGroup where
  toQuery :: CreateTargetGroup -> QueryString
toQuery CreateTargetGroup' {Maybe Bool
Maybe Natural
Maybe (NonEmpty Tag)
Maybe Text
Maybe Matcher
Maybe ProtocolEnum
Maybe TargetGroupIpAddressTypeEnum
Maybe TargetTypeEnum
Text
name :: Text
vpcId :: Maybe Text
unhealthyThresholdCount :: Maybe Natural
targetType :: Maybe TargetTypeEnum
tags :: Maybe (NonEmpty Tag)
protocolVersion :: Maybe Text
protocol :: Maybe ProtocolEnum
port :: Maybe Natural
matcher :: Maybe Matcher
ipAddressType :: Maybe TargetGroupIpAddressTypeEnum
healthyThresholdCount :: Maybe Natural
healthCheckTimeoutSeconds :: Maybe Natural
healthCheckProtocol :: Maybe ProtocolEnum
healthCheckPort :: Maybe Text
healthCheckPath :: Maybe Text
healthCheckIntervalSeconds :: Maybe Natural
healthCheckEnabled :: Maybe Bool
$sel:name:CreateTargetGroup' :: CreateTargetGroup -> Text
$sel:vpcId:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:unhealthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:targetType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetTypeEnum
$sel:tags:CreateTargetGroup' :: CreateTargetGroup -> Maybe (NonEmpty Tag)
$sel:protocolVersion:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:protocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:port:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:matcher:CreateTargetGroup' :: CreateTargetGroup -> Maybe Matcher
$sel:ipAddressType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetGroupIpAddressTypeEnum
$sel:healthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckProtocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:healthCheckPort:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:healthCheckPath:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:healthCheckIntervalSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckEnabled:CreateTargetGroup' :: CreateTargetGroup -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateTargetGroup" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
        ByteString
"HealthCheckEnabled" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
healthCheckEnabled,
        ByteString
"HealthCheckIntervalSeconds"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
healthCheckIntervalSeconds,
        ByteString
"HealthCheckPath" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
healthCheckPath,
        ByteString
"HealthCheckPort" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
healthCheckPort,
        ByteString
"HealthCheckProtocol" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ProtocolEnum
healthCheckProtocol,
        ByteString
"HealthCheckTimeoutSeconds"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
healthCheckTimeoutSeconds,
        ByteString
"HealthyThresholdCount"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
healthyThresholdCount,
        ByteString
"IpAddressType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe TargetGroupIpAddressTypeEnum
ipAddressType,
        ByteString
"Matcher" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Matcher
matcher,
        ByteString
"Port" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
port,
        ByteString
"Protocol" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ProtocolEnum
protocol,
        ByteString
"ProtocolVersion" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
protocolVersion,
        ByteString
"Tags"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            (forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags),
        ByteString
"TargetType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe TargetTypeEnum
targetType,
        ByteString
"UnhealthyThresholdCount"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
unhealthyThresholdCount,
        ByteString
"VpcId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
vpcId,
        ByteString
"Name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
name
      ]

-- | /See:/ 'newCreateTargetGroupResponse' smart constructor.
data CreateTargetGroupResponse = CreateTargetGroupResponse'
  { -- | Information about the target group.
    CreateTargetGroupResponse -> Maybe [TargetGroup]
targetGroups :: Prelude.Maybe [TargetGroup],
    -- | The response's http status code.
    CreateTargetGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateTargetGroupResponse -> CreateTargetGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTargetGroupResponse -> CreateTargetGroupResponse -> Bool
$c/= :: CreateTargetGroupResponse -> CreateTargetGroupResponse -> Bool
== :: CreateTargetGroupResponse -> CreateTargetGroupResponse -> Bool
$c== :: CreateTargetGroupResponse -> CreateTargetGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateTargetGroupResponse]
ReadPrec CreateTargetGroupResponse
Int -> ReadS CreateTargetGroupResponse
ReadS [CreateTargetGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTargetGroupResponse]
$creadListPrec :: ReadPrec [CreateTargetGroupResponse]
readPrec :: ReadPrec CreateTargetGroupResponse
$creadPrec :: ReadPrec CreateTargetGroupResponse
readList :: ReadS [CreateTargetGroupResponse]
$creadList :: ReadS [CreateTargetGroupResponse]
readsPrec :: Int -> ReadS CreateTargetGroupResponse
$creadsPrec :: Int -> ReadS CreateTargetGroupResponse
Prelude.Read, Int -> CreateTargetGroupResponse -> ShowS
[CreateTargetGroupResponse] -> ShowS
CreateTargetGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTargetGroupResponse] -> ShowS
$cshowList :: [CreateTargetGroupResponse] -> ShowS
show :: CreateTargetGroupResponse -> String
$cshow :: CreateTargetGroupResponse -> String
showsPrec :: Int -> CreateTargetGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateTargetGroupResponse -> ShowS
Prelude.Show, forall x.
Rep CreateTargetGroupResponse x -> CreateTargetGroupResponse
forall x.
CreateTargetGroupResponse -> Rep CreateTargetGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTargetGroupResponse x -> CreateTargetGroupResponse
$cfrom :: forall x.
CreateTargetGroupResponse -> Rep CreateTargetGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateTargetGroupResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'targetGroups', 'createTargetGroupResponse_targetGroups' - Information about the target group.
--
-- 'httpStatus', 'createTargetGroupResponse_httpStatus' - The response's http status code.
newCreateTargetGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateTargetGroupResponse
newCreateTargetGroupResponse :: Int -> CreateTargetGroupResponse
newCreateTargetGroupResponse Int
pHttpStatus_ =
  CreateTargetGroupResponse'
    { $sel:targetGroups:CreateTargetGroupResponse' :: Maybe [TargetGroup]
targetGroups =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateTargetGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the target group.
createTargetGroupResponse_targetGroups :: Lens.Lens' CreateTargetGroupResponse (Prelude.Maybe [TargetGroup])
createTargetGroupResponse_targetGroups :: Lens' CreateTargetGroupResponse (Maybe [TargetGroup])
createTargetGroupResponse_targetGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroupResponse' {Maybe [TargetGroup]
targetGroups :: Maybe [TargetGroup]
$sel:targetGroups:CreateTargetGroupResponse' :: CreateTargetGroupResponse -> Maybe [TargetGroup]
targetGroups} -> Maybe [TargetGroup]
targetGroups) (\s :: CreateTargetGroupResponse
s@CreateTargetGroupResponse' {} Maybe [TargetGroup]
a -> CreateTargetGroupResponse
s {$sel:targetGroups:CreateTargetGroupResponse' :: Maybe [TargetGroup]
targetGroups = Maybe [TargetGroup]
a} :: CreateTargetGroupResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
createTargetGroupResponse_httpStatus :: Lens.Lens' CreateTargetGroupResponse Prelude.Int
createTargetGroupResponse_httpStatus :: Lens' CreateTargetGroupResponse Int
createTargetGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTargetGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTargetGroupResponse' :: CreateTargetGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTargetGroupResponse
s@CreateTargetGroupResponse' {} Int
a -> CreateTargetGroupResponse
s {$sel:httpStatus:CreateTargetGroupResponse' :: Int
httpStatus = Int
a} :: CreateTargetGroupResponse)

instance Prelude.NFData CreateTargetGroupResponse where
  rnf :: CreateTargetGroupResponse -> ()
rnf CreateTargetGroupResponse' {Int
Maybe [TargetGroup]
httpStatus :: Int
targetGroups :: Maybe [TargetGroup]
$sel:httpStatus:CreateTargetGroupResponse' :: CreateTargetGroupResponse -> Int
$sel:targetGroups:CreateTargetGroupResponse' :: CreateTargetGroupResponse -> Maybe [TargetGroup]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [TargetGroup]
targetGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus