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

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

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

-- |
-- Create a value of 'CloudWatchLogsLogDelivery' 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:
--
-- 'logGroup', 'cloudWatchLogsLogDelivery_logGroup' - The name of the CloudWatch log group that is the destination for log
-- delivery.
--
-- 'enabled', 'cloudWatchLogsLogDelivery_enabled' - Whether log delivery to Amazon CloudWatch Logs is enabled.
newCloudWatchLogsLogDelivery ::
  -- | 'enabled'
  Prelude.Bool ->
  CloudWatchLogsLogDelivery
newCloudWatchLogsLogDelivery :: Bool -> CloudWatchLogsLogDelivery
newCloudWatchLogsLogDelivery Bool
pEnabled_ =
  CloudWatchLogsLogDelivery' :: Maybe Text -> Bool -> CloudWatchLogsLogDelivery
CloudWatchLogsLogDelivery'
    { $sel:logGroup:CloudWatchLogsLogDelivery' :: Maybe Text
logGroup =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:CloudWatchLogsLogDelivery' :: Bool
enabled = Bool
pEnabled_
    }

-- | The name of the CloudWatch log group that is the destination for log
-- delivery.
cloudWatchLogsLogDelivery_logGroup :: Lens.Lens' CloudWatchLogsLogDelivery (Prelude.Maybe Prelude.Text)
cloudWatchLogsLogDelivery_logGroup :: (Maybe Text -> f (Maybe Text))
-> CloudWatchLogsLogDelivery -> f CloudWatchLogsLogDelivery
cloudWatchLogsLogDelivery_logGroup = (CloudWatchLogsLogDelivery -> Maybe Text)
-> (CloudWatchLogsLogDelivery
    -> Maybe Text -> CloudWatchLogsLogDelivery)
-> Lens
     CloudWatchLogsLogDelivery
     CloudWatchLogsLogDelivery
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogsLogDelivery' {Maybe Text
logGroup :: Maybe Text
$sel:logGroup:CloudWatchLogsLogDelivery' :: CloudWatchLogsLogDelivery -> Maybe Text
logGroup} -> Maybe Text
logGroup) (\s :: CloudWatchLogsLogDelivery
s@CloudWatchLogsLogDelivery' {} Maybe Text
a -> CloudWatchLogsLogDelivery
s {$sel:logGroup:CloudWatchLogsLogDelivery' :: Maybe Text
logGroup = Maybe Text
a} :: CloudWatchLogsLogDelivery)

-- | Whether log delivery to Amazon CloudWatch Logs is enabled.
cloudWatchLogsLogDelivery_enabled :: Lens.Lens' CloudWatchLogsLogDelivery Prelude.Bool
cloudWatchLogsLogDelivery_enabled :: (Bool -> f Bool)
-> CloudWatchLogsLogDelivery -> f CloudWatchLogsLogDelivery
cloudWatchLogsLogDelivery_enabled = (CloudWatchLogsLogDelivery -> Bool)
-> (CloudWatchLogsLogDelivery -> Bool -> CloudWatchLogsLogDelivery)
-> Lens
     CloudWatchLogsLogDelivery CloudWatchLogsLogDelivery Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogsLogDelivery' {Bool
enabled :: Bool
$sel:enabled:CloudWatchLogsLogDelivery' :: CloudWatchLogsLogDelivery -> Bool
enabled} -> Bool
enabled) (\s :: CloudWatchLogsLogDelivery
s@CloudWatchLogsLogDelivery' {} Bool
a -> CloudWatchLogsLogDelivery
s {$sel:enabled:CloudWatchLogsLogDelivery' :: Bool
enabled = Bool
a} :: CloudWatchLogsLogDelivery)

instance Prelude.Hashable CloudWatchLogsLogDelivery

instance Prelude.NFData CloudWatchLogsLogDelivery

instance Core.ToJSON CloudWatchLogsLogDelivery where
  toJSON :: CloudWatchLogsLogDelivery -> Value
toJSON CloudWatchLogsLogDelivery' {Bool
Maybe Text
enabled :: Bool
logGroup :: Maybe Text
$sel:enabled:CloudWatchLogsLogDelivery' :: CloudWatchLogsLogDelivery -> Bool
$sel:logGroup:CloudWatchLogsLogDelivery' :: CloudWatchLogsLogDelivery -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"logGroup" 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
logGroup,
            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)
          ]
      )