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

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

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

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

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

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

instance
  Data.FromJSON
    CloudWatchLogsLogDeliveryDescription
  where
  parseJSON :: Value -> Parser CloudWatchLogsLogDeliveryDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CloudWatchLogsLogDeliveryDescription"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> CloudWatchLogsLogDeliveryDescription
CloudWatchLogsLogDeliveryDescription'
            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
"enabled")
            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
"logGroup")
      )

instance
  Prelude.Hashable
    CloudWatchLogsLogDeliveryDescription
  where
  hashWithSalt :: Int -> CloudWatchLogsLogDeliveryDescription -> Int
hashWithSalt
    Int
_salt
    CloudWatchLogsLogDeliveryDescription' {Maybe Bool
Maybe Text
logGroup :: Maybe Text
enabled :: Maybe Bool
$sel:logGroup:CloudWatchLogsLogDeliveryDescription' :: CloudWatchLogsLogDeliveryDescription -> Maybe Text
$sel:enabled:CloudWatchLogsLogDeliveryDescription' :: CloudWatchLogsLogDeliveryDescription -> Maybe Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
enabled
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
logGroup

instance
  Prelude.NFData
    CloudWatchLogsLogDeliveryDescription
  where
  rnf :: CloudWatchLogsLogDeliveryDescription -> ()
rnf CloudWatchLogsLogDeliveryDescription' {Maybe Bool
Maybe Text
logGroup :: Maybe Text
enabled :: Maybe Bool
$sel:logGroup:CloudWatchLogsLogDeliveryDescription' :: CloudWatchLogsLogDeliveryDescription -> Maybe Text
$sel:enabled:CloudWatchLogsLogDeliveryDescription' :: CloudWatchLogsLogDeliveryDescription -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
enabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logGroup