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

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

-- |
-- Module      : Amazonka.ELB.Types.ConnectionSettings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ELB.Types.ConnectionSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ELB.Internal
import qualified Amazonka.Prelude as Prelude

-- | Information about the @ConnectionSettings@ attribute.
--
-- /See:/ 'newConnectionSettings' smart constructor.
data ConnectionSettings = ConnectionSettings'
  { -- | The time, in seconds, that the connection is allowed to be idle (no data
    -- has been sent over the connection) before it is closed by the load
    -- balancer.
    ConnectionSettings -> Natural
idleTimeout :: Prelude.Natural
  }
  deriving (ConnectionSettings -> ConnectionSettings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionSettings -> ConnectionSettings -> Bool
$c/= :: ConnectionSettings -> ConnectionSettings -> Bool
== :: ConnectionSettings -> ConnectionSettings -> Bool
$c== :: ConnectionSettings -> ConnectionSettings -> Bool
Prelude.Eq, ReadPrec [ConnectionSettings]
ReadPrec ConnectionSettings
Int -> ReadS ConnectionSettings
ReadS [ConnectionSettings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionSettings]
$creadListPrec :: ReadPrec [ConnectionSettings]
readPrec :: ReadPrec ConnectionSettings
$creadPrec :: ReadPrec ConnectionSettings
readList :: ReadS [ConnectionSettings]
$creadList :: ReadS [ConnectionSettings]
readsPrec :: Int -> ReadS ConnectionSettings
$creadsPrec :: Int -> ReadS ConnectionSettings
Prelude.Read, Int -> ConnectionSettings -> ShowS
[ConnectionSettings] -> ShowS
ConnectionSettings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionSettings] -> ShowS
$cshowList :: [ConnectionSettings] -> ShowS
show :: ConnectionSettings -> String
$cshow :: ConnectionSettings -> String
showsPrec :: Int -> ConnectionSettings -> ShowS
$cshowsPrec :: Int -> ConnectionSettings -> ShowS
Prelude.Show, forall x. Rep ConnectionSettings x -> ConnectionSettings
forall x. ConnectionSettings -> Rep ConnectionSettings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConnectionSettings x -> ConnectionSettings
$cfrom :: forall x. ConnectionSettings -> Rep ConnectionSettings x
Prelude.Generic)

-- |
-- Create a value of 'ConnectionSettings' 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:
--
-- 'idleTimeout', 'connectionSettings_idleTimeout' - The time, in seconds, that the connection is allowed to be idle (no data
-- has been sent over the connection) before it is closed by the load
-- balancer.
newConnectionSettings ::
  -- | 'idleTimeout'
  Prelude.Natural ->
  ConnectionSettings
newConnectionSettings :: Natural -> ConnectionSettings
newConnectionSettings Natural
pIdleTimeout_ =
  ConnectionSettings' {$sel:idleTimeout:ConnectionSettings' :: Natural
idleTimeout = Natural
pIdleTimeout_}

-- | The time, in seconds, that the connection is allowed to be idle (no data
-- has been sent over the connection) before it is closed by the load
-- balancer.
connectionSettings_idleTimeout :: Lens.Lens' ConnectionSettings Prelude.Natural
connectionSettings_idleTimeout :: Lens' ConnectionSettings Natural
connectionSettings_idleTimeout = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionSettings' {Natural
idleTimeout :: Natural
$sel:idleTimeout:ConnectionSettings' :: ConnectionSettings -> Natural
idleTimeout} -> Natural
idleTimeout) (\s :: ConnectionSettings
s@ConnectionSettings' {} Natural
a -> ConnectionSettings
s {$sel:idleTimeout:ConnectionSettings' :: Natural
idleTimeout = Natural
a} :: ConnectionSettings)

instance Data.FromXML ConnectionSettings where
  parseXML :: [Node] -> Either String ConnectionSettings
parseXML [Node]
x =
    Natural -> ConnectionSettings
ConnectionSettings'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"IdleTimeout")

instance Prelude.Hashable ConnectionSettings where
  hashWithSalt :: Int -> ConnectionSettings -> Int
hashWithSalt Int
_salt ConnectionSettings' {Natural
idleTimeout :: Natural
$sel:idleTimeout:ConnectionSettings' :: ConnectionSettings -> Natural
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Natural
idleTimeout

instance Prelude.NFData ConnectionSettings where
  rnf :: ConnectionSettings -> ()
rnf ConnectionSettings' {Natural
idleTimeout :: Natural
$sel:idleTimeout:ConnectionSettings' :: ConnectionSettings -> Natural
..} = forall a. NFData a => a -> ()
Prelude.rnf Natural
idleTimeout

instance Data.ToQuery ConnectionSettings where
  toQuery :: ConnectionSettings -> QueryString
toQuery ConnectionSettings' {Natural
idleTimeout :: Natural
$sel:idleTimeout:ConnectionSettings' :: ConnectionSettings -> Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"IdleTimeout" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Natural
idleTimeout]