{-# 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.Kafka.Types.CloudWatchLogs
-- 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.Kafka.Types.CloudWatchLogs where

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

-- | /See:/ 'newCloudWatchLogs' smart constructor.
data CloudWatchLogs = CloudWatchLogs'
  { CloudWatchLogs -> Maybe Text
logGroup :: Prelude.Maybe Prelude.Text,
    CloudWatchLogs -> Bool
enabled :: Prelude.Bool
  }
  deriving (CloudWatchLogs -> CloudWatchLogs -> Bool
(CloudWatchLogs -> CloudWatchLogs -> Bool)
-> (CloudWatchLogs -> CloudWatchLogs -> Bool) -> Eq CloudWatchLogs
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudWatchLogs -> CloudWatchLogs -> Bool
$c/= :: CloudWatchLogs -> CloudWatchLogs -> Bool
== :: CloudWatchLogs -> CloudWatchLogs -> Bool
$c== :: CloudWatchLogs -> CloudWatchLogs -> Bool
Prelude.Eq, ReadPrec [CloudWatchLogs]
ReadPrec CloudWatchLogs
Int -> ReadS CloudWatchLogs
ReadS [CloudWatchLogs]
(Int -> ReadS CloudWatchLogs)
-> ReadS [CloudWatchLogs]
-> ReadPrec CloudWatchLogs
-> ReadPrec [CloudWatchLogs]
-> Read CloudWatchLogs
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudWatchLogs]
$creadListPrec :: ReadPrec [CloudWatchLogs]
readPrec :: ReadPrec CloudWatchLogs
$creadPrec :: ReadPrec CloudWatchLogs
readList :: ReadS [CloudWatchLogs]
$creadList :: ReadS [CloudWatchLogs]
readsPrec :: Int -> ReadS CloudWatchLogs
$creadsPrec :: Int -> ReadS CloudWatchLogs
Prelude.Read, Int -> CloudWatchLogs -> ShowS
[CloudWatchLogs] -> ShowS
CloudWatchLogs -> String
(Int -> CloudWatchLogs -> ShowS)
-> (CloudWatchLogs -> String)
-> ([CloudWatchLogs] -> ShowS)
-> Show CloudWatchLogs
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudWatchLogs] -> ShowS
$cshowList :: [CloudWatchLogs] -> ShowS
show :: CloudWatchLogs -> String
$cshow :: CloudWatchLogs -> String
showsPrec :: Int -> CloudWatchLogs -> ShowS
$cshowsPrec :: Int -> CloudWatchLogs -> ShowS
Prelude.Show, (forall x. CloudWatchLogs -> Rep CloudWatchLogs x)
-> (forall x. Rep CloudWatchLogs x -> CloudWatchLogs)
-> Generic CloudWatchLogs
forall x. Rep CloudWatchLogs x -> CloudWatchLogs
forall x. CloudWatchLogs -> Rep CloudWatchLogs x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudWatchLogs x -> CloudWatchLogs
$cfrom :: forall x. CloudWatchLogs -> Rep CloudWatchLogs x
Prelude.Generic)

-- |
-- Create a value of 'CloudWatchLogs' 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', 'cloudWatchLogs_logGroup' - Undocumented member.
--
-- 'enabled', 'cloudWatchLogs_enabled' - Undocumented member.
newCloudWatchLogs ::
  -- | 'enabled'
  Prelude.Bool ->
  CloudWatchLogs
newCloudWatchLogs :: Bool -> CloudWatchLogs
newCloudWatchLogs Bool
pEnabled_ =
  CloudWatchLogs' :: Maybe Text -> Bool -> CloudWatchLogs
CloudWatchLogs'
    { $sel:logGroup:CloudWatchLogs' :: Maybe Text
logGroup = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:CloudWatchLogs' :: Bool
enabled = Bool
pEnabled_
    }

-- | Undocumented member.
cloudWatchLogs_logGroup :: Lens.Lens' CloudWatchLogs (Prelude.Maybe Prelude.Text)
cloudWatchLogs_logGroup :: (Maybe Text -> f (Maybe Text))
-> CloudWatchLogs -> f CloudWatchLogs
cloudWatchLogs_logGroup = (CloudWatchLogs -> Maybe Text)
-> (CloudWatchLogs -> Maybe Text -> CloudWatchLogs)
-> Lens CloudWatchLogs CloudWatchLogs (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogs' {Maybe Text
logGroup :: Maybe Text
$sel:logGroup:CloudWatchLogs' :: CloudWatchLogs -> Maybe Text
logGroup} -> Maybe Text
logGroup) (\s :: CloudWatchLogs
s@CloudWatchLogs' {} Maybe Text
a -> CloudWatchLogs
s {$sel:logGroup:CloudWatchLogs' :: Maybe Text
logGroup = Maybe Text
a} :: CloudWatchLogs)

-- | Undocumented member.
cloudWatchLogs_enabled :: Lens.Lens' CloudWatchLogs Prelude.Bool
cloudWatchLogs_enabled :: (Bool -> f Bool) -> CloudWatchLogs -> f CloudWatchLogs
cloudWatchLogs_enabled = (CloudWatchLogs -> Bool)
-> (CloudWatchLogs -> Bool -> CloudWatchLogs)
-> Lens CloudWatchLogs CloudWatchLogs Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudWatchLogs' {Bool
enabled :: Bool
$sel:enabled:CloudWatchLogs' :: CloudWatchLogs -> Bool
enabled} -> Bool
enabled) (\s :: CloudWatchLogs
s@CloudWatchLogs' {} Bool
a -> CloudWatchLogs
s {$sel:enabled:CloudWatchLogs' :: Bool
enabled = Bool
a} :: CloudWatchLogs)

instance Core.FromJSON CloudWatchLogs where
  parseJSON :: Value -> Parser CloudWatchLogs
parseJSON =
    String
-> (Object -> Parser CloudWatchLogs)
-> Value
-> Parser CloudWatchLogs
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CloudWatchLogs"
      ( \Object
x ->
          Maybe Text -> Bool -> CloudWatchLogs
CloudWatchLogs'
            (Maybe Text -> Bool -> CloudWatchLogs)
-> Parser (Maybe Text) -> Parser (Bool -> CloudWatchLogs)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"logGroup")
            Parser (Bool -> CloudWatchLogs)
-> Parser Bool -> Parser CloudWatchLogs
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"enabled")
      )

instance Prelude.Hashable CloudWatchLogs

instance Prelude.NFData CloudWatchLogs

instance Core.ToJSON CloudWatchLogs where
  toJSON :: CloudWatchLogs -> Value
toJSON CloudWatchLogs' {Bool
Maybe Text
enabled :: Bool
logGroup :: Maybe Text
$sel:enabled:CloudWatchLogs' :: CloudWatchLogs -> Bool
$sel:logGroup:CloudWatchLogs' :: CloudWatchLogs -> 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)
          ]
      )