{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.KafkaConnect.Types.WorkerLogDeliveryDescription where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.KafkaConnect.Types.CloudWatchLogsLogDeliveryDescription
import Amazonka.KafkaConnect.Types.FirehoseLogDeliveryDescription
import Amazonka.KafkaConnect.Types.S3LogDeliveryDescription
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
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]
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
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.
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'
    { $sel:cloudWatchLogs:WorkerLogDeliveryDescription' :: Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs =
        forall a. Maybe a
Prelude.Nothing,
      $sel:firehose:WorkerLogDeliveryDescription' :: Maybe FirehoseLogDeliveryDescription
firehose = forall a. Maybe a
Prelude.Nothing,
      $sel:s3:WorkerLogDeliveryDescription' :: Maybe S3LogDeliveryDescription
s3 = forall a. Maybe a
Prelude.Nothing
    }

-- | Details about delivering logs to Amazon CloudWatch Logs.
workerLogDeliveryDescription_cloudWatchLogs :: Lens.Lens' WorkerLogDeliveryDescription (Prelude.Maybe CloudWatchLogsLogDeliveryDescription)
workerLogDeliveryDescription_cloudWatchLogs :: Lens'
  WorkerLogDeliveryDescription
  (Maybe CloudWatchLogsLogDeliveryDescription)
workerLogDeliveryDescription_cloudWatchLogs = 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 :: Lens'
  WorkerLogDeliveryDescription (Maybe FirehoseLogDeliveryDescription)
workerLogDeliveryDescription_firehose = 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 :: Lens' WorkerLogDeliveryDescription (Maybe S3LogDeliveryDescription)
workerLogDeliveryDescription_s3 = 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 Data.FromJSON WorkerLogDeliveryDescription where
  parseJSON :: Value -> Parser WorkerLogDeliveryDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WorkerLogDeliveryDescription"
      ( \Object
x ->
          Maybe CloudWatchLogsLogDeliveryDescription
-> Maybe FirehoseLogDeliveryDescription
-> Maybe S3LogDeliveryDescription
-> WorkerLogDeliveryDescription
WorkerLogDeliveryDescription'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"cloudWatchLogs")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"firehose")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"s3")
      )

instance
  Prelude.Hashable
    WorkerLogDeliveryDescription
  where
  hashWithSalt :: Int -> WorkerLogDeliveryDescription -> Int
hashWithSalt Int
_salt WorkerLogDeliveryDescription' {Maybe CloudWatchLogsLogDeliveryDescription
Maybe FirehoseLogDeliveryDescription
Maybe S3LogDeliveryDescription
s3 :: Maybe S3LogDeliveryDescription
firehose :: Maybe FirehoseLogDeliveryDescription
cloudWatchLogs :: Maybe CloudWatchLogsLogDeliveryDescription
$sel:s3:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription -> Maybe S3LogDeliveryDescription
$sel:firehose:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription
-> Maybe FirehoseLogDeliveryDescription
$sel:cloudWatchLogs:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription
-> Maybe CloudWatchLogsLogDeliveryDescription
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FirehoseLogDeliveryDescription
firehose
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3LogDeliveryDescription
s3

instance Prelude.NFData WorkerLogDeliveryDescription where
  rnf :: WorkerLogDeliveryDescription -> ()
rnf WorkerLogDeliveryDescription' {Maybe CloudWatchLogsLogDeliveryDescription
Maybe FirehoseLogDeliveryDescription
Maybe S3LogDeliveryDescription
s3 :: Maybe S3LogDeliveryDescription
firehose :: Maybe FirehoseLogDeliveryDescription
cloudWatchLogs :: Maybe CloudWatchLogsLogDeliveryDescription
$sel:s3:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription -> Maybe S3LogDeliveryDescription
$sel:firehose:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription
-> Maybe FirehoseLogDeliveryDescription
$sel:cloudWatchLogs:WorkerLogDeliveryDescription' :: WorkerLogDeliveryDescription
-> Maybe CloudWatchLogsLogDeliveryDescription
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CloudWatchLogsLogDeliveryDescription
cloudWatchLogs
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FirehoseLogDeliveryDescription
firehose
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe S3LogDeliveryDescription
s3