{-# 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.SecurityHub.Types.AwsElbLoadBalancerConnectionSettings
-- 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.SecurityHub.Types.AwsElbLoadBalancerConnectionSettings where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

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

-- |
-- Create a value of 'AwsElbLoadBalancerConnectionSettings' 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', 'awsElbLoadBalancerConnectionSettings_idleTimeout' - The time, in seconds, that the connection can be idle (no data is sent
-- over the connection) before it is closed by the load balancer.
newAwsElbLoadBalancerConnectionSettings ::
  AwsElbLoadBalancerConnectionSettings
newAwsElbLoadBalancerConnectionSettings :: AwsElbLoadBalancerConnectionSettings
newAwsElbLoadBalancerConnectionSettings =
  AwsElbLoadBalancerConnectionSettings' :: Maybe Int -> AwsElbLoadBalancerConnectionSettings
AwsElbLoadBalancerConnectionSettings'
    { $sel:idleTimeout:AwsElbLoadBalancerConnectionSettings' :: Maybe Int
idleTimeout =
        Maybe Int
forall a. Maybe a
Prelude.Nothing
    }

-- | The time, in seconds, that the connection can be idle (no data is sent
-- over the connection) before it is closed by the load balancer.
awsElbLoadBalancerConnectionSettings_idleTimeout :: Lens.Lens' AwsElbLoadBalancerConnectionSettings (Prelude.Maybe Prelude.Int)
awsElbLoadBalancerConnectionSettings_idleTimeout :: (Maybe Int -> f (Maybe Int))
-> AwsElbLoadBalancerConnectionSettings
-> f AwsElbLoadBalancerConnectionSettings
awsElbLoadBalancerConnectionSettings_idleTimeout = (AwsElbLoadBalancerConnectionSettings -> Maybe Int)
-> (AwsElbLoadBalancerConnectionSettings
    -> Maybe Int -> AwsElbLoadBalancerConnectionSettings)
-> Lens
     AwsElbLoadBalancerConnectionSettings
     AwsElbLoadBalancerConnectionSettings
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsElbLoadBalancerConnectionSettings' {Maybe Int
idleTimeout :: Maybe Int
$sel:idleTimeout:AwsElbLoadBalancerConnectionSettings' :: AwsElbLoadBalancerConnectionSettings -> Maybe Int
idleTimeout} -> Maybe Int
idleTimeout) (\s :: AwsElbLoadBalancerConnectionSettings
s@AwsElbLoadBalancerConnectionSettings' {} Maybe Int
a -> AwsElbLoadBalancerConnectionSettings
s {$sel:idleTimeout:AwsElbLoadBalancerConnectionSettings' :: Maybe Int
idleTimeout = Maybe Int
a} :: AwsElbLoadBalancerConnectionSettings)

instance
  Core.FromJSON
    AwsElbLoadBalancerConnectionSettings
  where
  parseJSON :: Value -> Parser AwsElbLoadBalancerConnectionSettings
parseJSON =
    String
-> (Object -> Parser AwsElbLoadBalancerConnectionSettings)
-> Value
-> Parser AwsElbLoadBalancerConnectionSettings
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsElbLoadBalancerConnectionSettings"
      ( \Object
x ->
          Maybe Int -> AwsElbLoadBalancerConnectionSettings
AwsElbLoadBalancerConnectionSettings'
            (Maybe Int -> AwsElbLoadBalancerConnectionSettings)
-> Parser (Maybe Int)
-> Parser AwsElbLoadBalancerConnectionSettings
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"IdleTimeout")
      )

instance
  Prelude.Hashable
    AwsElbLoadBalancerConnectionSettings

instance
  Prelude.NFData
    AwsElbLoadBalancerConnectionSettings

instance
  Core.ToJSON
    AwsElbLoadBalancerConnectionSettings
  where
  toJSON :: AwsElbLoadBalancerConnectionSettings -> Value
toJSON AwsElbLoadBalancerConnectionSettings' {Maybe Int
idleTimeout :: Maybe Int
$sel:idleTimeout:AwsElbLoadBalancerConnectionSettings' :: AwsElbLoadBalancerConnectionSettings -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"IdleTimeout" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
idleTimeout]
      )