{-# 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.Rum.Types.CwLog
-- 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.Rum.Types.CwLog 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 structure that contains the information about whether the app monitor
-- stores copies of the data that RUM collects in CloudWatch Logs. If it
-- does, this structure also contains the name of the log group.
--
-- /See:/ 'newCwLog' smart constructor.
data CwLog = CwLog'
  { -- | Indicated whether the app monitor stores copies of the data that RUM
    -- collects in CloudWatch Logs.
    CwLog -> Maybe Bool
cwLogEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The name of the log group where the copies are stored.
    CwLog -> Maybe Text
cwLogGroup :: Prelude.Maybe Prelude.Text
  }
  deriving (CwLog -> CwLog -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CwLog -> CwLog -> Bool
$c/= :: CwLog -> CwLog -> Bool
== :: CwLog -> CwLog -> Bool
$c== :: CwLog -> CwLog -> Bool
Prelude.Eq, ReadPrec [CwLog]
ReadPrec CwLog
Int -> ReadS CwLog
ReadS [CwLog]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CwLog]
$creadListPrec :: ReadPrec [CwLog]
readPrec :: ReadPrec CwLog
$creadPrec :: ReadPrec CwLog
readList :: ReadS [CwLog]
$creadList :: ReadS [CwLog]
readsPrec :: Int -> ReadS CwLog
$creadsPrec :: Int -> ReadS CwLog
Prelude.Read, Int -> CwLog -> ShowS
[CwLog] -> ShowS
CwLog -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CwLog] -> ShowS
$cshowList :: [CwLog] -> ShowS
show :: CwLog -> String
$cshow :: CwLog -> String
showsPrec :: Int -> CwLog -> ShowS
$cshowsPrec :: Int -> CwLog -> ShowS
Prelude.Show, forall x. Rep CwLog x -> CwLog
forall x. CwLog -> Rep CwLog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CwLog x -> CwLog
$cfrom :: forall x. CwLog -> Rep CwLog x
Prelude.Generic)

-- |
-- Create a value of 'CwLog' 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:
--
-- 'cwLogEnabled', 'cwLog_cwLogEnabled' - Indicated whether the app monitor stores copies of the data that RUM
-- collects in CloudWatch Logs.
--
-- 'cwLogGroup', 'cwLog_cwLogGroup' - The name of the log group where the copies are stored.
newCwLog ::
  CwLog
newCwLog :: CwLog
newCwLog =
  CwLog'
    { $sel:cwLogEnabled:CwLog' :: Maybe Bool
cwLogEnabled = forall a. Maybe a
Prelude.Nothing,
      $sel:cwLogGroup:CwLog' :: Maybe Text
cwLogGroup = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicated whether the app monitor stores copies of the data that RUM
-- collects in CloudWatch Logs.
cwLog_cwLogEnabled :: Lens.Lens' CwLog (Prelude.Maybe Prelude.Bool)
cwLog_cwLogEnabled :: Lens' CwLog (Maybe Bool)
cwLog_cwLogEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CwLog' {Maybe Bool
cwLogEnabled :: Maybe Bool
$sel:cwLogEnabled:CwLog' :: CwLog -> Maybe Bool
cwLogEnabled} -> Maybe Bool
cwLogEnabled) (\s :: CwLog
s@CwLog' {} Maybe Bool
a -> CwLog
s {$sel:cwLogEnabled:CwLog' :: Maybe Bool
cwLogEnabled = Maybe Bool
a} :: CwLog)

-- | The name of the log group where the copies are stored.
cwLog_cwLogGroup :: Lens.Lens' CwLog (Prelude.Maybe Prelude.Text)
cwLog_cwLogGroup :: Lens' CwLog (Maybe Text)
cwLog_cwLogGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CwLog' {Maybe Text
cwLogGroup :: Maybe Text
$sel:cwLogGroup:CwLog' :: CwLog -> Maybe Text
cwLogGroup} -> Maybe Text
cwLogGroup) (\s :: CwLog
s@CwLog' {} Maybe Text
a -> CwLog
s {$sel:cwLogGroup:CwLog' :: Maybe Text
cwLogGroup = Maybe Text
a} :: CwLog)

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

instance Prelude.Hashable CwLog where
  hashWithSalt :: Int -> CwLog -> Int
hashWithSalt Int
_salt CwLog' {Maybe Bool
Maybe Text
cwLogGroup :: Maybe Text
cwLogEnabled :: Maybe Bool
$sel:cwLogGroup:CwLog' :: CwLog -> Maybe Text
$sel:cwLogEnabled:CwLog' :: CwLog -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
cwLogEnabled
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cwLogGroup

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