{-# 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.Kafka.Types.LoggingInfo
-- 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.Kafka.Types.LoggingInfo where

import qualified Amazonka.Core as Core
import Amazonka.Kafka.Types.BrokerLogs
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | /See:/ 'newLoggingInfo' smart constructor.
data LoggingInfo = LoggingInfo'
  { LoggingInfo -> BrokerLogs
brokerLogs :: BrokerLogs
  }
  deriving (LoggingInfo -> LoggingInfo -> Bool
(LoggingInfo -> LoggingInfo -> Bool)
-> (LoggingInfo -> LoggingInfo -> Bool) -> Eq LoggingInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LoggingInfo -> LoggingInfo -> Bool
$c/= :: LoggingInfo -> LoggingInfo -> Bool
== :: LoggingInfo -> LoggingInfo -> Bool
$c== :: LoggingInfo -> LoggingInfo -> Bool
Prelude.Eq, ReadPrec [LoggingInfo]
ReadPrec LoggingInfo
Int -> ReadS LoggingInfo
ReadS [LoggingInfo]
(Int -> ReadS LoggingInfo)
-> ReadS [LoggingInfo]
-> ReadPrec LoggingInfo
-> ReadPrec [LoggingInfo]
-> Read LoggingInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LoggingInfo]
$creadListPrec :: ReadPrec [LoggingInfo]
readPrec :: ReadPrec LoggingInfo
$creadPrec :: ReadPrec LoggingInfo
readList :: ReadS [LoggingInfo]
$creadList :: ReadS [LoggingInfo]
readsPrec :: Int -> ReadS LoggingInfo
$creadsPrec :: Int -> ReadS LoggingInfo
Prelude.Read, Int -> LoggingInfo -> ShowS
[LoggingInfo] -> ShowS
LoggingInfo -> String
(Int -> LoggingInfo -> ShowS)
-> (LoggingInfo -> String)
-> ([LoggingInfo] -> ShowS)
-> Show LoggingInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LoggingInfo] -> ShowS
$cshowList :: [LoggingInfo] -> ShowS
show :: LoggingInfo -> String
$cshow :: LoggingInfo -> String
showsPrec :: Int -> LoggingInfo -> ShowS
$cshowsPrec :: Int -> LoggingInfo -> ShowS
Prelude.Show, (forall x. LoggingInfo -> Rep LoggingInfo x)
-> (forall x. Rep LoggingInfo x -> LoggingInfo)
-> Generic LoggingInfo
forall x. Rep LoggingInfo x -> LoggingInfo
forall x. LoggingInfo -> Rep LoggingInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LoggingInfo x -> LoggingInfo
$cfrom :: forall x. LoggingInfo -> Rep LoggingInfo x
Prelude.Generic)

-- |
-- Create a value of 'LoggingInfo' 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:
--
-- 'brokerLogs', 'loggingInfo_brokerLogs' - Undocumented member.
newLoggingInfo ::
  -- | 'brokerLogs'
  BrokerLogs ->
  LoggingInfo
newLoggingInfo :: BrokerLogs -> LoggingInfo
newLoggingInfo BrokerLogs
pBrokerLogs_ =
  LoggingInfo' :: BrokerLogs -> LoggingInfo
LoggingInfo' {$sel:brokerLogs:LoggingInfo' :: BrokerLogs
brokerLogs = BrokerLogs
pBrokerLogs_}

-- | Undocumented member.
loggingInfo_brokerLogs :: Lens.Lens' LoggingInfo BrokerLogs
loggingInfo_brokerLogs :: (BrokerLogs -> f BrokerLogs) -> LoggingInfo -> f LoggingInfo
loggingInfo_brokerLogs = (LoggingInfo -> BrokerLogs)
-> (LoggingInfo -> BrokerLogs -> LoggingInfo)
-> Lens LoggingInfo LoggingInfo BrokerLogs BrokerLogs
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LoggingInfo' {BrokerLogs
brokerLogs :: BrokerLogs
$sel:brokerLogs:LoggingInfo' :: LoggingInfo -> BrokerLogs
brokerLogs} -> BrokerLogs
brokerLogs) (\s :: LoggingInfo
s@LoggingInfo' {} BrokerLogs
a -> LoggingInfo
s {$sel:brokerLogs:LoggingInfo' :: BrokerLogs
brokerLogs = BrokerLogs
a} :: LoggingInfo)

instance Core.FromJSON LoggingInfo where
  parseJSON :: Value -> Parser LoggingInfo
parseJSON =
    String
-> (Object -> Parser LoggingInfo) -> Value -> Parser LoggingInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"LoggingInfo"
      ( \Object
x ->
          BrokerLogs -> LoggingInfo
LoggingInfo' (BrokerLogs -> LoggingInfo)
-> Parser BrokerLogs -> Parser LoggingInfo
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser BrokerLogs
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"brokerLogs")
      )

instance Prelude.Hashable LoggingInfo

instance Prelude.NFData LoggingInfo

instance Core.ToJSON LoggingInfo where
  toJSON :: LoggingInfo -> Value
toJSON LoggingInfo' {BrokerLogs
brokerLogs :: BrokerLogs
$sel:brokerLogs:LoggingInfo' :: LoggingInfo -> BrokerLogs
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"brokerLogs" Text -> BrokerLogs -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BrokerLogs
brokerLogs)]
      )