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

import qualified Amazonka.Core as Core
import Amazonka.KafkaConnect.Types.CloudWatchLogsLogDeliveryDescription
import Amazonka.KafkaConnect.Types.FirehoseLogDeliveryDescription
import Amazonka.KafkaConnect.Types.S3LogDeliveryDescription
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Workers can send worker logs to different destination types. This
-- configuration specifies the details of these destinations.
--
-- /See:/ 'newWorkerLogDeliveryDescription' smart constructor.
data WorkerLogDeliveryDescription = WorkerLogDeliveryDescription'
  { -- | Details about delivering logs to Amazon CloudWatch Logs.
    WorkerLogDeliveryDescription
-> Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs :: Prelude.Maybe CloudWatchLogsLogDeliveryDescription,
    -- | Details about delivering logs to Amazon Kinesis Data Firehose.
    WorkerLogDeliveryDescription
-> Maybe FirehoseLogDeliveryDescription
firehose :: Prelude.Maybe FirehoseLogDeliveryDescription,
    -- | Details about delivering logs to Amazon S3.
    WorkerLogDeliveryDescription -> Maybe S3LogDeliveryDescription
s3 :: Prelude.Maybe S3LogDeliveryDescription
  }
  deriving (WorkerLogDeliveryDescription
-> WorkerLogDeliveryDescription -> Bool
(WorkerLogDeliveryDescription
 -> WorkerLogDeliveryDescription -> Bool)
-> (WorkerLogDeliveryDescription
    -> WorkerLogDeliveryDescription -> Bool)
-> Eq WorkerLogDeliveryDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WorkerLogDeliveryDescription
-> WorkerLogDeliveryDescription -> Bool
$c/= :: WorkerLogDeliveryDescription
-> WorkerLogDeliveryDescription -> Bool
== :: WorkerLogDeliveryDescription
-> WorkerLogDeliveryDescription -> Bool
$c== :: WorkerLogDeliveryDescription
-> WorkerLogDeliveryDescription -> Bool
Prelude.Eq, ReadPrec [WorkerLogDeliveryDescription]
ReadPrec WorkerLogDeliveryDescription
Int -> ReadS WorkerLogDeliveryDescription
ReadS [WorkerLogDeliveryDescription]
(Int -> ReadS WorkerLogDeliveryDescription)
-> ReadS [WorkerLogDeliveryDescription]
-> ReadPrec WorkerLogDeliveryDescription
-> ReadPrec [WorkerLogDeliveryDescription]
-> Read WorkerLogDeliveryDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WorkerLogDeliveryDescription]
$creadListPrec :: ReadPrec [WorkerLogDeliveryDescription]
readPrec :: ReadPrec WorkerLogDeliveryDescription
$creadPrec :: ReadPrec WorkerLogDeliveryDescription
readList :: ReadS [WorkerLogDeliveryDescription]
$creadList :: ReadS [WorkerLogDeliveryDescription]
readsPrec :: Int -> ReadS WorkerLogDeliveryDescription
$creadsPrec :: Int -> ReadS WorkerLogDeliveryDescription
Prelude.Read, Int -> WorkerLogDeliveryDescription -> ShowS
[WorkerLogDeliveryDescription] -> ShowS
WorkerLogDeliveryDescription -> String
(Int -> WorkerLogDeliveryDescription -> ShowS)
-> (WorkerLogDeliveryDescription -> String)
-> ([WorkerLogDeliveryDescription] -> ShowS)
-> Show WorkerLogDeliveryDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WorkerLogDeliveryDescription] -> ShowS
$cshowList :: [WorkerLogDeliveryDescription] -> ShowS
show :: WorkerLogDeliveryDescription -> String
$cshow :: WorkerLogDeliveryDescription -> String
showsPrec :: Int -> WorkerLogDeliveryDescription -> ShowS
$cshowsPrec :: Int -> WorkerLogDeliveryDescription -> ShowS
Prelude.Show, (forall x.
 WorkerLogDeliveryDescription -> Rep WorkerLogDeliveryDescription x)
-> (forall x.
    Rep WorkerLogDeliveryDescription x -> WorkerLogDeliveryDescription)
-> Generic WorkerLogDeliveryDescription
forall x.
Rep WorkerLogDeliveryDescription x -> WorkerLogDeliveryDescription
forall x.
WorkerLogDeliveryDescription -> Rep WorkerLogDeliveryDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WorkerLogDeliveryDescription x -> WorkerLogDeliveryDescription
$cfrom :: forall x.
WorkerLogDeliveryDescription -> Rep WorkerLogDeliveryDescription x
Prelude.Generic)

-- |
-- Create a value of 'WorkerLogDeliveryDescription' 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:
--
-- 'cloudWatchLogs', 'workerLogDeliveryDescription_cloudWatchLogs' - Details about delivering logs to Amazon CloudWatch Logs.
--
-- 'firehose', 'workerLogDeliveryDescription_firehose' - Details about delivering logs to Amazon Kinesis Data Firehose.
--
-- 's3', 'workerLogDeliveryDescription_s3' - Details about delivering logs to Amazon S3.
newWorkerLogDeliveryDescription ::
  WorkerLogDeliveryDescription
newWorkerLogDeliveryDescription :: WorkerLogDeliveryDescription
newWorkerLogDeliveryDescription =
  WorkerLogDeliveryDescription' :: Maybe CloudWatchLogsLogDeliveryDescription
-> Maybe FirehoseLogDeliveryDescription
-> Maybe S3LogDeliveryDescription
-> WorkerLogDeliveryDescription
WorkerLogDeliveryDescription'
    { $sel:cloudWatchLogs:WorkerLogDeliveryDescription' :: Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs =
        Maybe CloudWatchLogsLogDeliveryDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:firehose:WorkerLogDeliveryDescription' :: Maybe FirehoseLogDeliveryDescription
firehose = Maybe FirehoseLogDeliveryDescription
forall a. Maybe a
Prelude.Nothing,
      $sel:s3:WorkerLogDeliveryDescription' :: Maybe S3LogDeliveryDescription
s3 = Maybe S3LogDeliveryDescription
forall a. Maybe a
Prelude.Nothing
    }

-- | Details about delivering logs to Amazon CloudWatch Logs.
workerLogDeliveryDescription_cloudWatchLogs :: Lens.Lens' WorkerLogDeliveryDescription (Prelude.Maybe CloudWatchLogsLogDeliveryDescription)
workerLogDeliveryDescription_cloudWatchLogs :: (Maybe CloudWatchLogsLogDeliveryDescription
 -> f (Maybe CloudWatchLogsLogDeliveryDescription))
-> WorkerLogDeliveryDescription -> f WorkerLogDeliveryDescription
workerLogDeliveryDescription_cloudWatchLogs = (WorkerLogDeliveryDescription
 -> Maybe CloudWatchLogsLogDeliveryDescription)
-> (WorkerLogDeliveryDescription
    -> Maybe CloudWatchLogsLogDeliveryDescription
    -> WorkerLogDeliveryDescription)
-> Lens
     WorkerLogDeliveryDescription
     WorkerLogDeliveryDescription
     (Maybe CloudWatchLogsLogDeliveryDescription)
     (Maybe CloudWatchLogsLogDeliveryDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerLogDeliveryDescription' {Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs :: Maybe CloudWatchLogsLogDeliveryDescription
$sel:cloudWatchLogs:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription
-> Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs} -> Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs) (\s :: WorkerLogDeliveryDescription
s@WorkerLogDeliveryDescription' {} Maybe CloudWatchLogsLogDeliveryDescription
a -> WorkerLogDeliveryDescription
s {$sel:cloudWatchLogs:WorkerLogDeliveryDescription' :: Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs = Maybe CloudWatchLogsLogDeliveryDescription
a} :: WorkerLogDeliveryDescription)

-- | Details about delivering logs to Amazon Kinesis Data Firehose.
workerLogDeliveryDescription_firehose :: Lens.Lens' WorkerLogDeliveryDescription (Prelude.Maybe FirehoseLogDeliveryDescription)
workerLogDeliveryDescription_firehose :: (Maybe FirehoseLogDeliveryDescription
 -> f (Maybe FirehoseLogDeliveryDescription))
-> WorkerLogDeliveryDescription -> f WorkerLogDeliveryDescription
workerLogDeliveryDescription_firehose = (WorkerLogDeliveryDescription
 -> Maybe FirehoseLogDeliveryDescription)
-> (WorkerLogDeliveryDescription
    -> Maybe FirehoseLogDeliveryDescription
    -> WorkerLogDeliveryDescription)
-> Lens
     WorkerLogDeliveryDescription
     WorkerLogDeliveryDescription
     (Maybe FirehoseLogDeliveryDescription)
     (Maybe FirehoseLogDeliveryDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerLogDeliveryDescription' {Maybe FirehoseLogDeliveryDescription
firehose :: Maybe FirehoseLogDeliveryDescription
$sel:firehose:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription
-> Maybe FirehoseLogDeliveryDescription
firehose} -> Maybe FirehoseLogDeliveryDescription
firehose) (\s :: WorkerLogDeliveryDescription
s@WorkerLogDeliveryDescription' {} Maybe FirehoseLogDeliveryDescription
a -> WorkerLogDeliveryDescription
s {$sel:firehose:WorkerLogDeliveryDescription' :: Maybe FirehoseLogDeliveryDescription
firehose = Maybe FirehoseLogDeliveryDescription
a} :: WorkerLogDeliveryDescription)

-- | Details about delivering logs to Amazon S3.
workerLogDeliveryDescription_s3 :: Lens.Lens' WorkerLogDeliveryDescription (Prelude.Maybe S3LogDeliveryDescription)
workerLogDeliveryDescription_s3 :: (Maybe S3LogDeliveryDescription
 -> f (Maybe S3LogDeliveryDescription))
-> WorkerLogDeliveryDescription -> f WorkerLogDeliveryDescription
workerLogDeliveryDescription_s3 = (WorkerLogDeliveryDescription -> Maybe S3LogDeliveryDescription)
-> (WorkerLogDeliveryDescription
    -> Maybe S3LogDeliveryDescription -> WorkerLogDeliveryDescription)
-> Lens
     WorkerLogDeliveryDescription
     WorkerLogDeliveryDescription
     (Maybe S3LogDeliveryDescription)
     (Maybe S3LogDeliveryDescription)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WorkerLogDeliveryDescription' {Maybe S3LogDeliveryDescription
s3 :: Maybe S3LogDeliveryDescription
$sel:s3:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription -> Maybe S3LogDeliveryDescription
s3} -> Maybe S3LogDeliveryDescription
s3) (\s :: WorkerLogDeliveryDescription
s@WorkerLogDeliveryDescription' {} Maybe S3LogDeliveryDescription
a -> WorkerLogDeliveryDescription
s {$sel:s3:WorkerLogDeliveryDescription' :: Maybe S3LogDeliveryDescription
s3 = Maybe S3LogDeliveryDescription
a} :: WorkerLogDeliveryDescription)

instance Core.FromJSON WorkerLogDeliveryDescription where
  parseJSON :: Value -> Parser WorkerLogDeliveryDescription
parseJSON =
    String
-> (Object -> Parser WorkerLogDeliveryDescription)
-> Value
-> Parser WorkerLogDeliveryDescription
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"WorkerLogDeliveryDescription"
      ( \Object
x ->
          Maybe CloudWatchLogsLogDeliveryDescription
-> Maybe FirehoseLogDeliveryDescription
-> Maybe S3LogDeliveryDescription
-> WorkerLogDeliveryDescription
WorkerLogDeliveryDescription'
            (Maybe CloudWatchLogsLogDeliveryDescription
 -> Maybe FirehoseLogDeliveryDescription
 -> Maybe S3LogDeliveryDescription
 -> WorkerLogDeliveryDescription)
-> Parser (Maybe CloudWatchLogsLogDeliveryDescription)
-> Parser
     (Maybe FirehoseLogDeliveryDescription
      -> Maybe S3LogDeliveryDescription -> WorkerLogDeliveryDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe CloudWatchLogsLogDeliveryDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"cloudWatchLogs")
            Parser
  (Maybe FirehoseLogDeliveryDescription
   -> Maybe S3LogDeliveryDescription -> WorkerLogDeliveryDescription)
-> Parser (Maybe FirehoseLogDeliveryDescription)
-> Parser
     (Maybe S3LogDeliveryDescription -> WorkerLogDeliveryDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe FirehoseLogDeliveryDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"firehose")
            Parser
  (Maybe S3LogDeliveryDescription -> WorkerLogDeliveryDescription)
-> Parser (Maybe S3LogDeliveryDescription)
-> Parser WorkerLogDeliveryDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3LogDeliveryDescription)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3")
      )

instance
  Prelude.Hashable
    WorkerLogDeliveryDescription

instance Prelude.NFData WorkerLogDeliveryDescription