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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The settings for delivering logs to Amazon Kinesis Data Firehose.
--
-- /See:/ 'newFirehoseLogDelivery' smart constructor.
data FirehoseLogDelivery = FirehoseLogDelivery'
  { -- | The name of the Kinesis Data Firehose delivery stream that is the
    -- destination for log delivery.
    FirehoseLogDelivery -> Maybe Text
deliveryStream :: Prelude.Maybe Prelude.Text,
    -- | Specifies whether connector logs get delivered to Amazon Kinesis Data
    -- Firehose.
    FirehoseLogDelivery -> Bool
enabled :: Prelude.Bool
  }
  deriving (FirehoseLogDelivery -> FirehoseLogDelivery -> Bool
(FirehoseLogDelivery -> FirehoseLogDelivery -> Bool)
-> (FirehoseLogDelivery -> FirehoseLogDelivery -> Bool)
-> Eq FirehoseLogDelivery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FirehoseLogDelivery -> FirehoseLogDelivery -> Bool
$c/= :: FirehoseLogDelivery -> FirehoseLogDelivery -> Bool
== :: FirehoseLogDelivery -> FirehoseLogDelivery -> Bool
$c== :: FirehoseLogDelivery -> FirehoseLogDelivery -> Bool
Prelude.Eq, ReadPrec [FirehoseLogDelivery]
ReadPrec FirehoseLogDelivery
Int -> ReadS FirehoseLogDelivery
ReadS [FirehoseLogDelivery]
(Int -> ReadS FirehoseLogDelivery)
-> ReadS [FirehoseLogDelivery]
-> ReadPrec FirehoseLogDelivery
-> ReadPrec [FirehoseLogDelivery]
-> Read FirehoseLogDelivery
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FirehoseLogDelivery]
$creadListPrec :: ReadPrec [FirehoseLogDelivery]
readPrec :: ReadPrec FirehoseLogDelivery
$creadPrec :: ReadPrec FirehoseLogDelivery
readList :: ReadS [FirehoseLogDelivery]
$creadList :: ReadS [FirehoseLogDelivery]
readsPrec :: Int -> ReadS FirehoseLogDelivery
$creadsPrec :: Int -> ReadS FirehoseLogDelivery
Prelude.Read, Int -> FirehoseLogDelivery -> ShowS
[FirehoseLogDelivery] -> ShowS
FirehoseLogDelivery -> String
(Int -> FirehoseLogDelivery -> ShowS)
-> (FirehoseLogDelivery -> String)
-> ([FirehoseLogDelivery] -> ShowS)
-> Show FirehoseLogDelivery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FirehoseLogDelivery] -> ShowS
$cshowList :: [FirehoseLogDelivery] -> ShowS
show :: FirehoseLogDelivery -> String
$cshow :: FirehoseLogDelivery -> String
showsPrec :: Int -> FirehoseLogDelivery -> ShowS
$cshowsPrec :: Int -> FirehoseLogDelivery -> ShowS
Prelude.Show, (forall x. FirehoseLogDelivery -> Rep FirehoseLogDelivery x)
-> (forall x. Rep FirehoseLogDelivery x -> FirehoseLogDelivery)
-> Generic FirehoseLogDelivery
forall x. Rep FirehoseLogDelivery x -> FirehoseLogDelivery
forall x. FirehoseLogDelivery -> Rep FirehoseLogDelivery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FirehoseLogDelivery x -> FirehoseLogDelivery
$cfrom :: forall x. FirehoseLogDelivery -> Rep FirehoseLogDelivery x
Prelude.Generic)

-- |
-- Create a value of 'FirehoseLogDelivery' 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:
--
-- 'deliveryStream', 'firehoseLogDelivery_deliveryStream' - The name of the Kinesis Data Firehose delivery stream that is the
-- destination for log delivery.
--
-- 'enabled', 'firehoseLogDelivery_enabled' - Specifies whether connector logs get delivered to Amazon Kinesis Data
-- Firehose.
newFirehoseLogDelivery ::
  -- | 'enabled'
  Prelude.Bool ->
  FirehoseLogDelivery
newFirehoseLogDelivery :: Bool -> FirehoseLogDelivery
newFirehoseLogDelivery Bool
pEnabled_ =
  FirehoseLogDelivery' :: Maybe Text -> Bool -> FirehoseLogDelivery
FirehoseLogDelivery'
    { $sel:deliveryStream:FirehoseLogDelivery' :: Maybe Text
deliveryStream =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:FirehoseLogDelivery' :: Bool
enabled = Bool
pEnabled_
    }

-- | The name of the Kinesis Data Firehose delivery stream that is the
-- destination for log delivery.
firehoseLogDelivery_deliveryStream :: Lens.Lens' FirehoseLogDelivery (Prelude.Maybe Prelude.Text)
firehoseLogDelivery_deliveryStream :: (Maybe Text -> f (Maybe Text))
-> FirehoseLogDelivery -> f FirehoseLogDelivery
firehoseLogDelivery_deliveryStream = (FirehoseLogDelivery -> Maybe Text)
-> (FirehoseLogDelivery -> Maybe Text -> FirehoseLogDelivery)
-> Lens
     FirehoseLogDelivery FirehoseLogDelivery (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirehoseLogDelivery' {Maybe Text
deliveryStream :: Maybe Text
$sel:deliveryStream:FirehoseLogDelivery' :: FirehoseLogDelivery -> Maybe Text
deliveryStream} -> Maybe Text
deliveryStream) (\s :: FirehoseLogDelivery
s@FirehoseLogDelivery' {} Maybe Text
a -> FirehoseLogDelivery
s {$sel:deliveryStream:FirehoseLogDelivery' :: Maybe Text
deliveryStream = Maybe Text
a} :: FirehoseLogDelivery)

-- | Specifies whether connector logs get delivered to Amazon Kinesis Data
-- Firehose.
firehoseLogDelivery_enabled :: Lens.Lens' FirehoseLogDelivery Prelude.Bool
firehoseLogDelivery_enabled :: (Bool -> f Bool) -> FirehoseLogDelivery -> f FirehoseLogDelivery
firehoseLogDelivery_enabled = (FirehoseLogDelivery -> Bool)
-> (FirehoseLogDelivery -> Bool -> FirehoseLogDelivery)
-> Lens FirehoseLogDelivery FirehoseLogDelivery Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FirehoseLogDelivery' {Bool
enabled :: Bool
$sel:enabled:FirehoseLogDelivery' :: FirehoseLogDelivery -> Bool
enabled} -> Bool
enabled) (\s :: FirehoseLogDelivery
s@FirehoseLogDelivery' {} Bool
a -> FirehoseLogDelivery
s {$sel:enabled:FirehoseLogDelivery' :: Bool
enabled = Bool
a} :: FirehoseLogDelivery)

instance Prelude.Hashable FirehoseLogDelivery

instance Prelude.NFData FirehoseLogDelivery

instance Core.ToJSON FirehoseLogDelivery where
  toJSON :: FirehoseLogDelivery -> Value
toJSON FirehoseLogDelivery' {Bool
Maybe Text
enabled :: Bool
deliveryStream :: Maybe Text
$sel:enabled:FirehoseLogDelivery' :: FirehoseLogDelivery -> Bool
$sel:deliveryStream:FirehoseLogDelivery' :: FirehoseLogDelivery -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"deliveryStream" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
deliveryStream,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
enabled)
          ]
      )