{-# 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.MwAA.Types.ModuleLoggingConfigurationInput
-- 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.MwAA.Types.ModuleLoggingConfigurationInput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MwAA.Types.LoggingLevel
import qualified Amazonka.Prelude as Prelude

-- | Defines the type of logs to send for the Apache Airflow log type (e.g.
-- @DagProcessingLogs@). Valid values: @CloudWatchLogGroupArn@, @Enabled@,
-- @LogLevel@.
--
-- /See:/ 'newModuleLoggingConfigurationInput' smart constructor.
data ModuleLoggingConfigurationInput = ModuleLoggingConfigurationInput'
  { -- | Indicates whether to enable the Apache Airflow log type (e.g.
    -- @DagProcessingLogs@) in CloudWatch Logs.
    ModuleLoggingConfigurationInput -> Bool
enabled :: Prelude.Bool,
    -- | Defines the Apache Airflow logs to send for the log type (e.g.
    -- @DagProcessingLogs@) to CloudWatch Logs. Valid values: @CRITICAL@,
    -- @ERROR@, @WARNING@, @INFO@.
    ModuleLoggingConfigurationInput -> LoggingLevel
logLevel :: LoggingLevel
  }
  deriving (ModuleLoggingConfigurationInput
-> ModuleLoggingConfigurationInput -> Bool
(ModuleLoggingConfigurationInput
 -> ModuleLoggingConfigurationInput -> Bool)
-> (ModuleLoggingConfigurationInput
    -> ModuleLoggingConfigurationInput -> Bool)
-> Eq ModuleLoggingConfigurationInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleLoggingConfigurationInput
-> ModuleLoggingConfigurationInput -> Bool
$c/= :: ModuleLoggingConfigurationInput
-> ModuleLoggingConfigurationInput -> Bool
== :: ModuleLoggingConfigurationInput
-> ModuleLoggingConfigurationInput -> Bool
$c== :: ModuleLoggingConfigurationInput
-> ModuleLoggingConfigurationInput -> Bool
Prelude.Eq, ReadPrec [ModuleLoggingConfigurationInput]
ReadPrec ModuleLoggingConfigurationInput
Int -> ReadS ModuleLoggingConfigurationInput
ReadS [ModuleLoggingConfigurationInput]
(Int -> ReadS ModuleLoggingConfigurationInput)
-> ReadS [ModuleLoggingConfigurationInput]
-> ReadPrec ModuleLoggingConfigurationInput
-> ReadPrec [ModuleLoggingConfigurationInput]
-> Read ModuleLoggingConfigurationInput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModuleLoggingConfigurationInput]
$creadListPrec :: ReadPrec [ModuleLoggingConfigurationInput]
readPrec :: ReadPrec ModuleLoggingConfigurationInput
$creadPrec :: ReadPrec ModuleLoggingConfigurationInput
readList :: ReadS [ModuleLoggingConfigurationInput]
$creadList :: ReadS [ModuleLoggingConfigurationInput]
readsPrec :: Int -> ReadS ModuleLoggingConfigurationInput
$creadsPrec :: Int -> ReadS ModuleLoggingConfigurationInput
Prelude.Read, Int -> ModuleLoggingConfigurationInput -> ShowS
[ModuleLoggingConfigurationInput] -> ShowS
ModuleLoggingConfigurationInput -> String
(Int -> ModuleLoggingConfigurationInput -> ShowS)
-> (ModuleLoggingConfigurationInput -> String)
-> ([ModuleLoggingConfigurationInput] -> ShowS)
-> Show ModuleLoggingConfigurationInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleLoggingConfigurationInput] -> ShowS
$cshowList :: [ModuleLoggingConfigurationInput] -> ShowS
show :: ModuleLoggingConfigurationInput -> String
$cshow :: ModuleLoggingConfigurationInput -> String
showsPrec :: Int -> ModuleLoggingConfigurationInput -> ShowS
$cshowsPrec :: Int -> ModuleLoggingConfigurationInput -> ShowS
Prelude.Show, (forall x.
 ModuleLoggingConfigurationInput
 -> Rep ModuleLoggingConfigurationInput x)
-> (forall x.
    Rep ModuleLoggingConfigurationInput x
    -> ModuleLoggingConfigurationInput)
-> Generic ModuleLoggingConfigurationInput
forall x.
Rep ModuleLoggingConfigurationInput x
-> ModuleLoggingConfigurationInput
forall x.
ModuleLoggingConfigurationInput
-> Rep ModuleLoggingConfigurationInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModuleLoggingConfigurationInput x
-> ModuleLoggingConfigurationInput
$cfrom :: forall x.
ModuleLoggingConfigurationInput
-> Rep ModuleLoggingConfigurationInput x
Prelude.Generic)

-- |
-- Create a value of 'ModuleLoggingConfigurationInput' 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', 'moduleLoggingConfigurationInput_enabled' - Indicates whether to enable the Apache Airflow log type (e.g.
-- @DagProcessingLogs@) in CloudWatch Logs.
--
-- 'logLevel', 'moduleLoggingConfigurationInput_logLevel' - Defines the Apache Airflow logs to send for the log type (e.g.
-- @DagProcessingLogs@) to CloudWatch Logs. Valid values: @CRITICAL@,
-- @ERROR@, @WARNING@, @INFO@.
newModuleLoggingConfigurationInput ::
  -- | 'enabled'
  Prelude.Bool ->
  -- | 'logLevel'
  LoggingLevel ->
  ModuleLoggingConfigurationInput
newModuleLoggingConfigurationInput :: Bool -> LoggingLevel -> ModuleLoggingConfigurationInput
newModuleLoggingConfigurationInput
  Bool
pEnabled_
  LoggingLevel
pLogLevel_ =
    ModuleLoggingConfigurationInput' :: Bool -> LoggingLevel -> ModuleLoggingConfigurationInput
ModuleLoggingConfigurationInput'
      { $sel:enabled:ModuleLoggingConfigurationInput' :: Bool
enabled =
          Bool
pEnabled_,
        $sel:logLevel:ModuleLoggingConfigurationInput' :: LoggingLevel
logLevel = LoggingLevel
pLogLevel_
      }

-- | Indicates whether to enable the Apache Airflow log type (e.g.
-- @DagProcessingLogs@) in CloudWatch Logs.
moduleLoggingConfigurationInput_enabled :: Lens.Lens' ModuleLoggingConfigurationInput Prelude.Bool
moduleLoggingConfigurationInput_enabled :: (Bool -> f Bool)
-> ModuleLoggingConfigurationInput
-> f ModuleLoggingConfigurationInput
moduleLoggingConfigurationInput_enabled = (ModuleLoggingConfigurationInput -> Bool)
-> (ModuleLoggingConfigurationInput
    -> Bool -> ModuleLoggingConfigurationInput)
-> Lens
     ModuleLoggingConfigurationInput
     ModuleLoggingConfigurationInput
     Bool
     Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModuleLoggingConfigurationInput' {Bool
enabled :: Bool
$sel:enabled:ModuleLoggingConfigurationInput' :: ModuleLoggingConfigurationInput -> Bool
enabled} -> Bool
enabled) (\s :: ModuleLoggingConfigurationInput
s@ModuleLoggingConfigurationInput' {} Bool
a -> ModuleLoggingConfigurationInput
s {$sel:enabled:ModuleLoggingConfigurationInput' :: Bool
enabled = Bool
a} :: ModuleLoggingConfigurationInput)

-- | Defines the Apache Airflow logs to send for the log type (e.g.
-- @DagProcessingLogs@) to CloudWatch Logs. Valid values: @CRITICAL@,
-- @ERROR@, @WARNING@, @INFO@.
moduleLoggingConfigurationInput_logLevel :: Lens.Lens' ModuleLoggingConfigurationInput LoggingLevel
moduleLoggingConfigurationInput_logLevel :: (LoggingLevel -> f LoggingLevel)
-> ModuleLoggingConfigurationInput
-> f ModuleLoggingConfigurationInput
moduleLoggingConfigurationInput_logLevel = (ModuleLoggingConfigurationInput -> LoggingLevel)
-> (ModuleLoggingConfigurationInput
    -> LoggingLevel -> ModuleLoggingConfigurationInput)
-> Lens
     ModuleLoggingConfigurationInput
     ModuleLoggingConfigurationInput
     LoggingLevel
     LoggingLevel
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModuleLoggingConfigurationInput' {LoggingLevel
logLevel :: LoggingLevel
$sel:logLevel:ModuleLoggingConfigurationInput' :: ModuleLoggingConfigurationInput -> LoggingLevel
logLevel} -> LoggingLevel
logLevel) (\s :: ModuleLoggingConfigurationInput
s@ModuleLoggingConfigurationInput' {} LoggingLevel
a -> ModuleLoggingConfigurationInput
s {$sel:logLevel:ModuleLoggingConfigurationInput' :: LoggingLevel
logLevel = LoggingLevel
a} :: ModuleLoggingConfigurationInput)

instance
  Prelude.Hashable
    ModuleLoggingConfigurationInput

instance
  Prelude.NFData
    ModuleLoggingConfigurationInput

instance Core.ToJSON ModuleLoggingConfigurationInput where
  toJSON :: ModuleLoggingConfigurationInput -> Value
toJSON ModuleLoggingConfigurationInput' {Bool
LoggingLevel
logLevel :: LoggingLevel
enabled :: Bool
$sel:logLevel:ModuleLoggingConfigurationInput' :: ModuleLoggingConfigurationInput -> LoggingLevel
$sel:enabled:ModuleLoggingConfigurationInput' :: ModuleLoggingConfigurationInput -> Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LogLevel" Text -> LoggingLevel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LoggingLevel
logLevel)
          ]
      )