{-# 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.LogDelivery
-- 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.LogDelivery where

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

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

-- |
-- Create a value of 'LogDelivery' 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', 'logDelivery_workerLogDelivery' - The workers can send worker logs to different destination types. This
-- configuration specifies the details of these destinations.
newLogDelivery ::
  -- | 'workerLogDelivery'
  WorkerLogDelivery ->
  LogDelivery
newLogDelivery :: WorkerLogDelivery -> LogDelivery
newLogDelivery WorkerLogDelivery
pWorkerLogDelivery_ =
  LogDelivery' :: WorkerLogDelivery -> LogDelivery
LogDelivery'
    { $sel:workerLogDelivery:LogDelivery' :: WorkerLogDelivery
workerLogDelivery =
        WorkerLogDelivery
pWorkerLogDelivery_
    }

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

instance Prelude.Hashable LogDelivery

instance Prelude.NFData LogDelivery

instance Core.ToJSON LogDelivery where
  toJSON :: LogDelivery -> Value
toJSON LogDelivery' {WorkerLogDelivery
workerLogDelivery :: WorkerLogDelivery
$sel:workerLogDelivery:LogDelivery' :: LogDelivery -> WorkerLogDelivery
..} =
    [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
"workerLogDelivery" Text -> WorkerLogDelivery -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= WorkerLogDelivery
workerLogDelivery)
          ]
      )