{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_protocolVersion,
    createTargetGroup_matcher,
    createTargetGroup_healthCheckPath,
    createTargetGroup_healthCheckEnabled,
    createTargetGroup_unhealthyThresholdCount,
    createTargetGroup_vpcId,
    createTargetGroup_protocol,
    createTargetGroup_healthCheckIntervalSeconds,
    createTargetGroup_targetType,
    createTargetGroup_healthyThresholdCount,
    createTargetGroup_healthCheckProtocol,
    createTargetGroup_ipAddressType,
    createTargetGroup_healthCheckTimeoutSeconds,
    createTargetGroup_healthCheckPort,
    createTargetGroup_tags,
    createTargetGroup_port,
    createTargetGroup_name,

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

    -- * Response Lenses
    createTargetGroupResponse_targetGroups,
    createTargetGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.ELBV2.Types
import qualified Amazonka.Lens as Lens
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'
  { -- | [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,
    -- | [HTTP\/HTTPS health checks] The HTTP or gRPC codes to use when checking
    -- for a successful response from a target.
    CreateTargetGroup -> Maybe Matcher
matcher :: Prelude.Maybe Matcher,
    -- | [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,
    -- | 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 number of consecutive health check failures required before
    -- considering a target unhealthy. If the target group protocol is HTTP or
    -- HTTPS, the default is 2. If the target group protocol is TCP or TLS,
    -- this value must be the same as the healthy threshold count. If the
    -- target group protocol is GENEVE, the default is 3. If the target type is
    -- @lambda@, the default is 2.
    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 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,
    -- | The approximate amount of time, in seconds, between health checks of an
    -- individual target. If the target group protocol is TCP, TLS, UDP, or
    -- TCP_UDP, the supported values are 10 and 30 seconds. If the target group
    -- protocol is 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,
    -- | 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 checks successes required before
    -- considering an unhealthy target healthy. For target groups with a
    -- protocol of HTTP or HTTPS, the default is 5. For target groups with a
    -- protocol of TCP, TLS, or GENEVE, the default is 3. If the target type is
    -- @lambda@, the default is 5.
    CreateTargetGroup -> Maybe Natural
healthyThresholdCount :: Prelude.Maybe Prelude.Natural,
    -- | 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 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,
    -- | The amount of time, in seconds, during which no response from a target
    -- means a failed health check. For target groups with a protocol of HTTP,
    -- HTTPS, or GENEVE, the default is 5 seconds. For target groups with a
    -- protocol of TCP or TLS, this value must be 6 seconds for HTTP health
    -- checks and 10 seconds for TCP and HTTPS health checks. If the target
    -- type is @lambda@, the default is 30 seconds.
    CreateTargetGroup -> Maybe Natural
healthCheckTimeoutSeconds :: Prelude.Maybe Prelude.Natural,
    -- | 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 tags to assign to the target group.
    CreateTargetGroup -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | 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 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
(CreateTargetGroup -> CreateTargetGroup -> Bool)
-> (CreateTargetGroup -> CreateTargetGroup -> Bool)
-> Eq CreateTargetGroup
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]
(Int -> ReadS CreateTargetGroup)
-> ReadS [CreateTargetGroup]
-> ReadPrec CreateTargetGroup
-> ReadPrec [CreateTargetGroup]
-> Read 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
(Int -> CreateTargetGroup -> ShowS)
-> (CreateTargetGroup -> String)
-> ([CreateTargetGroup] -> ShowS)
-> Show CreateTargetGroup
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. CreateTargetGroup -> Rep CreateTargetGroup x)
-> (forall x. Rep CreateTargetGroup x -> CreateTargetGroup)
-> Generic CreateTargetGroup
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:
--
-- '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.
--
-- 'matcher', 'createTargetGroup_matcher' - [HTTP\/HTTPS health checks] The HTTP or gRPC codes to use when checking
-- for a successful response from a target.
--
-- '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.
--
-- '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.
--
-- 'unhealthyThresholdCount', 'createTargetGroup_unhealthyThresholdCount' - The number of consecutive health check failures required before
-- considering a target unhealthy. If the target group protocol is HTTP or
-- HTTPS, the default is 2. If the target group protocol is TCP or TLS,
-- this value must be the same as the healthy threshold count. If the
-- target group protocol is GENEVE, the default is 3. If the target type is
-- @lambda@, the default is 2.
--
-- '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.
--
-- '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.
--
-- 'healthCheckIntervalSeconds', 'createTargetGroup_healthCheckIntervalSeconds' - The approximate amount of time, in seconds, between health checks of an
-- individual target. If the target group protocol is TCP, TLS, UDP, or
-- TCP_UDP, the supported values are 10 and 30 seconds. If the target group
-- protocol is 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.
--
-- '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.
--
-- 'healthyThresholdCount', 'createTargetGroup_healthyThresholdCount' - The number of consecutive health checks successes required before
-- considering an unhealthy target healthy. For target groups with a
-- protocol of HTTP or HTTPS, the default is 5. For target groups with a
-- protocol of TCP, TLS, or GENEVE, the default is 3. If the target type is
-- @lambda@, the default is 5.
--
-- '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.
--
-- '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@.
--
-- 'healthCheckTimeoutSeconds', 'createTargetGroup_healthCheckTimeoutSeconds' - The amount of time, in seconds, during which no response from a target
-- means a failed health check. For target groups with a protocol of HTTP,
-- HTTPS, or GENEVE, the default is 5 seconds. For target groups with a
-- protocol of TCP or TLS, this value must be 6 seconds for HTTP health
-- checks and 10 seconds for TCP and HTTPS health checks. If the target
-- type is @lambda@, the default is 30 seconds.
--
-- '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.
--
-- 'tags', 'createTargetGroup_tags' - The tags to assign to the target group.
--
-- '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.
--
-- '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' :: Maybe Text
-> Maybe Matcher
-> Maybe Text
-> Maybe Bool
-> Maybe Natural
-> Maybe Text
-> Maybe ProtocolEnum
-> Maybe Natural
-> Maybe TargetTypeEnum
-> Maybe Natural
-> Maybe ProtocolEnum
-> Maybe TargetGroupIpAddressTypeEnum
-> Maybe Natural
-> Maybe Text
-> Maybe (NonEmpty Tag)
-> Maybe Natural
-> Text
-> CreateTargetGroup
CreateTargetGroup'
    { $sel:protocolVersion:CreateTargetGroup' :: Maybe Text
protocolVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:matcher:CreateTargetGroup' :: Maybe Matcher
matcher = Maybe Matcher
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPath:CreateTargetGroup' :: Maybe Text
healthCheckPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckEnabled:CreateTargetGroup' :: Maybe Bool
healthCheckEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:unhealthyThresholdCount:CreateTargetGroup' :: Maybe Natural
unhealthyThresholdCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:CreateTargetGroup' :: Maybe Text
vpcId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:protocol:CreateTargetGroup' :: Maybe ProtocolEnum
protocol = Maybe ProtocolEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckIntervalSeconds:CreateTargetGroup' :: Maybe Natural
healthCheckIntervalSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:targetType:CreateTargetGroup' :: Maybe TargetTypeEnum
targetType = Maybe TargetTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:healthyThresholdCount:CreateTargetGroup' :: Maybe Natural
healthyThresholdCount = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckProtocol:CreateTargetGroup' :: Maybe ProtocolEnum
healthCheckProtocol = Maybe ProtocolEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:ipAddressType:CreateTargetGroup' :: Maybe TargetGroupIpAddressTypeEnum
ipAddressType = Maybe TargetGroupIpAddressTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: Maybe Natural
healthCheckTimeoutSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPort:CreateTargetGroup' :: Maybe Text
healthCheckPort = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateTargetGroup' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:port:CreateTargetGroup' :: Maybe Natural
port = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateTargetGroup' :: Text
name = Text
pName_
    }

-- | [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 :: (Maybe Text -> f (Maybe Text))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_protocolVersion = (CreateTargetGroup -> Maybe Text)
-> (CreateTargetGroup -> Maybe Text -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Text) (Maybe Text)
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)

-- | [HTTP\/HTTPS health checks] The HTTP or gRPC codes to use when checking
-- for a successful response from a target.
createTargetGroup_matcher :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Matcher)
createTargetGroup_matcher :: (Maybe Matcher -> f (Maybe Matcher))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_matcher = (CreateTargetGroup -> Maybe Matcher)
-> (CreateTargetGroup -> Maybe Matcher -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Matcher) (Maybe 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)

-- | [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 :: (Maybe Text -> f (Maybe Text))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_healthCheckPath = (CreateTargetGroup -> Maybe Text)
-> (CreateTargetGroup -> Maybe Text -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Bool -> f (Maybe Bool))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_healthCheckEnabled = (CreateTargetGroup -> Maybe Bool)
-> (CreateTargetGroup -> Maybe Bool -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Bool) (Maybe Bool)
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 number of consecutive health check failures required before
-- considering a target unhealthy. If the target group protocol is HTTP or
-- HTTPS, the default is 2. If the target group protocol is TCP or TLS,
-- this value must be the same as the healthy threshold count. If the
-- target group protocol is GENEVE, the default is 3. If the target type is
-- @lambda@, the default is 2.
createTargetGroup_unhealthyThresholdCount :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Natural)
createTargetGroup_unhealthyThresholdCount :: (Maybe Natural -> f (Maybe Natural))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_unhealthyThresholdCount = (CreateTargetGroup -> Maybe Natural)
-> (CreateTargetGroup -> Maybe Natural -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Natural) (Maybe Natural)
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 :: (Maybe Text -> f (Maybe Text))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_vpcId = (CreateTargetGroup -> Maybe Text)
-> (CreateTargetGroup -> Maybe Text -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Text) (Maybe Text)
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 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 :: (Maybe ProtocolEnum -> f (Maybe ProtocolEnum))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_protocol = (CreateTargetGroup -> Maybe ProtocolEnum)
-> (CreateTargetGroup -> Maybe ProtocolEnum -> CreateTargetGroup)
-> Lens
     CreateTargetGroup
     CreateTargetGroup
     (Maybe ProtocolEnum)
     (Maybe ProtocolEnum)
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)

-- | The approximate amount of time, in seconds, between health checks of an
-- individual target. If the target group protocol is TCP, TLS, UDP, or
-- TCP_UDP, the supported values are 10 and 30 seconds. If the target group
-- protocol is 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 :: (Maybe Natural -> f (Maybe Natural))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_healthCheckIntervalSeconds = (CreateTargetGroup -> Maybe Natural)
-> (CreateTargetGroup -> Maybe Natural -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Natural) (Maybe Natural)
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)

-- | 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 :: (Maybe TargetTypeEnum -> f (Maybe TargetTypeEnum))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_targetType = (CreateTargetGroup -> Maybe TargetTypeEnum)
-> (CreateTargetGroup -> Maybe TargetTypeEnum -> CreateTargetGroup)
-> Lens
     CreateTargetGroup
     CreateTargetGroup
     (Maybe TargetTypeEnum)
     (Maybe TargetTypeEnum)
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 checks successes required before
-- considering an unhealthy target healthy. For target groups with a
-- protocol of HTTP or HTTPS, the default is 5. For target groups with a
-- protocol of TCP, TLS, or 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 :: (Maybe Natural -> f (Maybe Natural))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_healthyThresholdCount = (CreateTargetGroup -> Maybe Natural)
-> (CreateTargetGroup -> Maybe Natural -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Natural) (Maybe Natural)
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 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 :: (Maybe ProtocolEnum -> f (Maybe ProtocolEnum))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_healthCheckProtocol = (CreateTargetGroup -> Maybe ProtocolEnum)
-> (CreateTargetGroup -> Maybe ProtocolEnum -> CreateTargetGroup)
-> Lens
     CreateTargetGroup
     CreateTargetGroup
     (Maybe ProtocolEnum)
     (Maybe ProtocolEnum)
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 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 :: (Maybe TargetGroupIpAddressTypeEnum
 -> f (Maybe TargetGroupIpAddressTypeEnum))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_ipAddressType = (CreateTargetGroup -> Maybe TargetGroupIpAddressTypeEnum)
-> (CreateTargetGroup
    -> Maybe TargetGroupIpAddressTypeEnum -> CreateTargetGroup)
-> Lens
     CreateTargetGroup
     CreateTargetGroup
     (Maybe TargetGroupIpAddressTypeEnum)
     (Maybe TargetGroupIpAddressTypeEnum)
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)

-- | The amount of time, in seconds, during which no response from a target
-- means a failed health check. For target groups with a protocol of HTTP,
-- HTTPS, or GENEVE, the default is 5 seconds. For target groups with a
-- protocol of TCP or TLS, this value must be 6 seconds for HTTP health
-- checks and 10 seconds for TCP and HTTPS health checks. If the target
-- type is @lambda@, the default is 30 seconds.
createTargetGroup_healthCheckTimeoutSeconds :: Lens.Lens' CreateTargetGroup (Prelude.Maybe Prelude.Natural)
createTargetGroup_healthCheckTimeoutSeconds :: (Maybe Natural -> f (Maybe Natural))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_healthCheckTimeoutSeconds = (CreateTargetGroup -> Maybe Natural)
-> (CreateTargetGroup -> Maybe Natural -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Natural) (Maybe Natural)
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 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 :: (Maybe Text -> f (Maybe Text))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_healthCheckPort = (CreateTargetGroup -> Maybe Text)
-> (CreateTargetGroup -> Maybe Text -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Text) (Maybe Text)
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 tags to assign to the target group.
createTargetGroup_tags :: Lens.Lens' CreateTargetGroup (Prelude.Maybe (Prelude.NonEmpty Tag))
createTargetGroup_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_tags = (CreateTargetGroup -> Maybe (NonEmpty Tag))
-> (CreateTargetGroup -> Maybe (NonEmpty Tag) -> CreateTargetGroup)
-> Lens
     CreateTargetGroup
     CreateTargetGroup
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateTargetGroup -> f CreateTargetGroup)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateTargetGroup
-> f CreateTargetGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
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 AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: (Maybe Natural -> f (Maybe Natural))
-> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_port = (CreateTargetGroup -> Maybe Natural)
-> (CreateTargetGroup -> Maybe Natural -> CreateTargetGroup)
-> Lens
     CreateTargetGroup CreateTargetGroup (Maybe Natural) (Maybe Natural)
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 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 :: (Text -> f Text) -> CreateTargetGroup -> f CreateTargetGroup
createTargetGroup_name = (CreateTargetGroup -> Text)
-> (CreateTargetGroup -> Text -> CreateTargetGroup)
-> Lens CreateTargetGroup CreateTargetGroup Text Text
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 :: CreateTargetGroup -> Request CreateTargetGroup
request = Service -> CreateTargetGroup -> Request CreateTargetGroup
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateTargetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateTargetGroup)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateTargetGroup))
-> Logger
-> Service
-> Proxy CreateTargetGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateTargetGroup)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> 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'
            (Maybe [TargetGroup] -> Int -> CreateTargetGroupResponse)
-> Either String (Maybe [TargetGroup])
-> Either String (Int -> CreateTargetGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"TargetGroups" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                            Either String [Node]
-> ([Node] -> Either String (Maybe [TargetGroup]))
-> Either String (Maybe [TargetGroup])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [TargetGroup])
-> [Node] -> Either String (Maybe [TargetGroup])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [TargetGroup]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                        )
            Either String (Int -> CreateTargetGroupResponse)
-> Either String Int -> Either String CreateTargetGroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateTargetGroup

instance Prelude.NFData CreateTargetGroup

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

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

instance Core.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
port :: Maybe Natural
tags :: Maybe (NonEmpty Tag)
healthCheckPort :: Maybe Text
healthCheckTimeoutSeconds :: Maybe Natural
ipAddressType :: Maybe TargetGroupIpAddressTypeEnum
healthCheckProtocol :: Maybe ProtocolEnum
healthyThresholdCount :: Maybe Natural
targetType :: Maybe TargetTypeEnum
healthCheckIntervalSeconds :: Maybe Natural
protocol :: Maybe ProtocolEnum
vpcId :: Maybe Text
unhealthyThresholdCount :: Maybe Natural
healthCheckEnabled :: Maybe Bool
healthCheckPath :: Maybe Text
matcher :: Maybe Matcher
protocolVersion :: Maybe Text
$sel:name:CreateTargetGroup' :: CreateTargetGroup -> Text
$sel:port:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:tags:CreateTargetGroup' :: CreateTargetGroup -> Maybe (NonEmpty Tag)
$sel:healthCheckPort:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:healthCheckTimeoutSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:ipAddressType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetGroupIpAddressTypeEnum
$sel:healthCheckProtocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:healthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:targetType:CreateTargetGroup' :: CreateTargetGroup -> Maybe TargetTypeEnum
$sel:healthCheckIntervalSeconds:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:protocol:CreateTargetGroup' :: CreateTargetGroup -> Maybe ProtocolEnum
$sel:vpcId:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:unhealthyThresholdCount:CreateTargetGroup' :: CreateTargetGroup -> Maybe Natural
$sel:healthCheckEnabled:CreateTargetGroup' :: CreateTargetGroup -> Maybe Bool
$sel:healthCheckPath:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
$sel:matcher:CreateTargetGroup' :: CreateTargetGroup -> Maybe Matcher
$sel:protocolVersion:CreateTargetGroup' :: CreateTargetGroup -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateTargetGroup" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
        ByteString
"ProtocolVersion" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
protocolVersion,
        ByteString
"Matcher" ByteString -> Maybe Matcher -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Matcher
matcher,
        ByteString
"HealthCheckPath" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
healthCheckPath,
        ByteString
"HealthCheckEnabled" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
healthCheckEnabled,
        ByteString
"UnhealthyThresholdCount"
          ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
unhealthyThresholdCount,
        ByteString
"VpcId" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
vpcId,
        ByteString
"Protocol" ByteString -> Maybe ProtocolEnum -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ProtocolEnum
protocol,
        ByteString
"HealthCheckIntervalSeconds"
          ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
healthCheckIntervalSeconds,
        ByteString
"TargetType" ByteString -> Maybe TargetTypeEnum -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe TargetTypeEnum
targetType,
        ByteString
"HealthyThresholdCount"
          ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
healthyThresholdCount,
        ByteString
"HealthCheckProtocol" ByteString -> Maybe ProtocolEnum -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe ProtocolEnum
healthCheckProtocol,
        ByteString
"IpAddressType" ByteString -> Maybe TargetGroupIpAddressTypeEnum -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe TargetGroupIpAddressTypeEnum
ipAddressType,
        ByteString
"HealthCheckTimeoutSeconds"
          ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
healthCheckTimeoutSeconds,
        ByteString
"HealthCheckPort" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
healthCheckPort,
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> NonEmpty Tag -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" (NonEmpty Tag -> QueryString)
-> Maybe (NonEmpty Tag) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags),
        ByteString
"Port" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
port,
        ByteString
"Name" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: 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
(CreateTargetGroupResponse -> CreateTargetGroupResponse -> Bool)
-> (CreateTargetGroupResponse -> CreateTargetGroupResponse -> Bool)
-> Eq CreateTargetGroupResponse
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]
(Int -> ReadS CreateTargetGroupResponse)
-> ReadS [CreateTargetGroupResponse]
-> ReadPrec CreateTargetGroupResponse
-> ReadPrec [CreateTargetGroupResponse]
-> Read 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
(Int -> CreateTargetGroupResponse -> ShowS)
-> (CreateTargetGroupResponse -> String)
-> ([CreateTargetGroupResponse] -> ShowS)
-> Show CreateTargetGroupResponse
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.
 CreateTargetGroupResponse -> Rep CreateTargetGroupResponse x)
-> (forall x.
    Rep CreateTargetGroupResponse x -> CreateTargetGroupResponse)
-> Generic CreateTargetGroupResponse
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' :: Maybe [TargetGroup] -> Int -> CreateTargetGroupResponse
CreateTargetGroupResponse'
    { $sel:targetGroups:CreateTargetGroupResponse' :: Maybe [TargetGroup]
targetGroups =
        Maybe [TargetGroup]
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 :: (Maybe [TargetGroup] -> f (Maybe [TargetGroup]))
-> CreateTargetGroupResponse -> f CreateTargetGroupResponse
createTargetGroupResponse_targetGroups = (CreateTargetGroupResponse -> Maybe [TargetGroup])
-> (CreateTargetGroupResponse
    -> Maybe [TargetGroup] -> CreateTargetGroupResponse)
-> Lens
     CreateTargetGroupResponse
     CreateTargetGroupResponse
     (Maybe [TargetGroup])
     (Maybe [TargetGroup])
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) ((Maybe [TargetGroup] -> f (Maybe [TargetGroup]))
 -> CreateTargetGroupResponse -> f CreateTargetGroupResponse)
-> ((Maybe [TargetGroup] -> f (Maybe [TargetGroup]))
    -> Maybe [TargetGroup] -> f (Maybe [TargetGroup]))
-> (Maybe [TargetGroup] -> f (Maybe [TargetGroup]))
-> CreateTargetGroupResponse
-> f CreateTargetGroupResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TargetGroup] [TargetGroup] [TargetGroup] [TargetGroup]
-> Iso
     (Maybe [TargetGroup])
     (Maybe [TargetGroup])
     (Maybe [TargetGroup])
     (Maybe [TargetGroup])
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 AnIso [TargetGroup] [TargetGroup] [TargetGroup] [TargetGroup]
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 :: (Int -> f Int)
-> CreateTargetGroupResponse -> f CreateTargetGroupResponse
createTargetGroupResponse_httpStatus = (CreateTargetGroupResponse -> Int)
-> (CreateTargetGroupResponse -> Int -> CreateTargetGroupResponse)
-> Lens CreateTargetGroupResponse CreateTargetGroupResponse Int Int
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