{-# 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.KafkaConnect.Types.LogDeliveryDescription
-- 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.KafkaConnect.Types.LogDeliveryDescription where

import qualified Amazonka.Core as Core
import Amazonka.KafkaConnect.Types.WorkerLogDeliveryDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The description of the log delivery settings.
--
-- /See:/ 'newLogDeliveryDescription' smart constructor.
data LogDeliveryDescription = LogDeliveryDescription'
  { -- | The workers can send worker logs to different destination types. This
    -- configuration specifies the details of these destinations.
    LogDeliveryDescription -> Maybe WorkerLogDeliveryDescription
workerLogDelivery :: Prelude.Maybe WorkerLogDeliveryDescription
  }
  deriving (LogDeliveryDescription -> LogDeliveryDescription -> Bool
(LogDeliveryDescription -> LogDeliveryDescription -> Bool)
-> (LogDeliveryDescription -> LogDeliveryDescription -> Bool)
-> Eq LogDeliveryDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LogDeliveryDescription -> LogDeliveryDescription -> Bool
$c/= :: LogDeliveryDescription -> LogDeliveryDescription -> Bool
== :: LogDeliveryDescription -> LogDeliveryDescription -> Bool
$c== :: LogDeliveryDescription -> LogDeliveryDescription -> Bool
Prelude.Eq, ReadPrec [LogDeliveryDescription]
ReadPrec LogDeliveryDescription
Int -> ReadS LogDeliveryDescription
ReadS [LogDeliveryDescription]
(Int -> ReadS LogDeliveryDescription)
-> ReadS [LogDeliveryDescription]
-> ReadPrec LogDeliveryDescription
-> ReadPrec [LogDeliveryDescription]
-> Read LogDeliveryDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LogDeliveryDescription]
$creadListPrec :: ReadPrec [LogDeliveryDescription]
readPrec :: ReadPrec LogDeliveryDescription
$creadPrec :: ReadPrec LogDeliveryDescription
readList :: ReadS [LogDeliveryDescription]
$creadList :: ReadS [LogDeliveryDescription]
readsPrec :: Int -> ReadS LogDeliveryDescription
$creadsPrec :: Int -> ReadS LogDeliveryDescription
Prelude.Read, Int -> LogDeliveryDescription -> ShowS
[LogDeliveryDescription] -> ShowS
LogDeliveryDescription -> String
(Int -> LogDeliveryDescription -> ShowS)
-> (LogDeliveryDescription -> String)
-> ([LogDeliveryDescription] -> ShowS)
-> Show LogDeliveryDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LogDeliveryDescription] -> ShowS
$cshowList :: [LogDeliveryDescription] -> ShowS
show :: LogDeliveryDescription -> String
$cshow :: LogDeliveryDescription -> String
showsPrec :: Int -> LogDeliveryDescription -> ShowS
$cshowsPrec :: Int -> LogDeliveryDescription -> ShowS
Prelude.Show, (forall x. LogDeliveryDescription -> Rep LogDeliveryDescription x)
-> (forall x.
    Rep LogDeliveryDescription x -> LogDeliveryDescription)
-> Generic LogDeliveryDescription
forall x. Rep LogDeliveryDescription x -> LogDeliveryDescription
forall x. LogDeliveryDescription -> Rep LogDeliveryDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LogDeliveryDescription x -> LogDeliveryDescription
$cfrom :: forall x. LogDeliveryDescription -> Rep LogDeliveryDescription x
Prelude.Generic)

-- |
-- Create a value of 'LogDeliveryDescription' 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:
--
-- 'workerLogDelivery', 'logDeliveryDescription_workerLogDelivery' - The workers can send worker logs to different destination types. This
-- configuration specifies the details of these destinations.
newLogDeliveryDescription ::
  LogDeliveryDescription
newLogDeliveryDescription :: LogDeliveryDescription
newLogDeliveryDescription =
  LogDeliveryDescription' :: Maybe WorkerLogDeliveryDescription -> LogDeliveryDescription
LogDeliveryDescription'
    { $sel:workerLogDelivery:LogDeliveryDescription' :: Maybe WorkerLogDeliveryDescription
workerLogDelivery =
        Maybe WorkerLogDeliveryDescription
forall a. Maybe a
Prelude.Nothing
    }

-- | The workers can send worker logs to different destination types. This
-- configuration specifies the details of these destinations.
logDeliveryDescription_workerLogDelivery :: Lens.Lens' LogDeliveryDescription (Prelude.Maybe WorkerLogDeliveryDescription)
logDeliveryDescription_workerLogDelivery :: (Maybe WorkerLogDeliveryDescription
 -> f (Maybe WorkerLogDeliveryDescription))
-> LogDeliveryDescription -> f LogDeliveryDescription
logDeliveryDescription_workerLogDelivery = (LogDeliveryDescription -> Maybe WorkerLogDeliveryDescription)
-> (LogDeliveryDescription
    -> Maybe WorkerLogDeliveryDescription -> LogDeliveryDescription)
-> Lens
     LogDeliveryDescription
     LogDeliveryDescription
     (Maybe WorkerLogDeliveryDescription)
     (Maybe WorkerLogDeliveryDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LogDeliveryDescription' {Maybe WorkerLogDeliveryDescription
workerLogDelivery :: Maybe WorkerLogDeliveryDescription
$sel:workerLogDelivery:LogDeliveryDescription' :: LogDeliveryDescription -> Maybe WorkerLogDeliveryDescription
workerLogDelivery} -> Maybe WorkerLogDeliveryDescription
workerLogDelivery) (\s :: LogDeliveryDescription
s@LogDeliveryDescription' {} Maybe WorkerLogDeliveryDescription
a -> LogDeliveryDescription
s {$sel:workerLogDelivery:LogDeliveryDescription' :: Maybe WorkerLogDeliveryDescription
workerLogDelivery = Maybe WorkerLogDeliveryDescription
a} :: LogDeliveryDescription)

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

instance Prelude.Hashable LogDeliveryDescription

instance Prelude.NFData LogDeliveryDescription