{-# 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-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)
module Amazonka.ELB.Types.ConnectionSettings where

import qualified Amazonka.Core as Core
import Amazonka.ELB.Internal
import qualified Amazonka.Lens as Lens
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
(ConnectionSettings -> ConnectionSettings -> Bool)
-> (ConnectionSettings -> ConnectionSettings -> Bool)
-> Eq ConnectionSettings
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]
(Int -> ReadS ConnectionSettings)
-> ReadS [ConnectionSettings]
-> ReadPrec ConnectionSettings
-> ReadPrec [ConnectionSettings]
-> Read 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
(Int -> ConnectionSettings -> ShowS)
-> (ConnectionSettings -> String)
-> ([ConnectionSettings] -> ShowS)
-> Show ConnectionSettings
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. ConnectionSettings -> Rep ConnectionSettings x)
-> (forall x. Rep ConnectionSettings x -> ConnectionSettings)
-> Generic ConnectionSettings
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' :: Natural -> ConnectionSettings
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 :: (Natural -> f Natural)
-> ConnectionSettings -> f ConnectionSettings
connectionSettings_idleTimeout = (ConnectionSettings -> Natural)
-> (ConnectionSettings -> Natural -> ConnectionSettings)
-> Lens ConnectionSettings ConnectionSettings Natural Natural
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 Core.FromXML ConnectionSettings where
  parseXML :: [Node] -> Either String ConnectionSettings
parseXML [Node]
x =
    Natural -> ConnectionSettings
ConnectionSettings'
      (Natural -> ConnectionSettings)
-> Either String Natural -> Either String ConnectionSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String Natural
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"IdleTimeout")

instance Prelude.Hashable ConnectionSettings

instance Prelude.NFData ConnectionSettings

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