{-# 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.ModuleLoggingConfiguration
-- 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.ModuleLoggingConfiguration 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:/ 'newModuleLoggingConfiguration' smart constructor.
data ModuleLoggingConfiguration = ModuleLoggingConfiguration'
  { -- | Defines the Apache Airflow logs to send for the log type (e.g.
    -- @DagProcessingLogs@) to CloudWatch Logs. Valid values: @CRITICAL@,
    -- @ERROR@, @WARNING@, @INFO@.
    ModuleLoggingConfiguration -> Maybe LoggingLevel
logLevel :: Prelude.Maybe LoggingLevel,
    -- | Indicates whether to enable the Apache Airflow log type (e.g.
    -- @DagProcessingLogs@) in CloudWatch Logs.
    ModuleLoggingConfiguration -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon Resource Name (ARN) for the CloudWatch Logs group where the
    -- Apache Airflow log type (e.g. @DagProcessingLogs@) is published. For
    -- example,
    -- @arn:aws:logs:us-east-1:123456789012:log-group:airflow-MyMWAAEnvironment-MwaaEnvironment-DAGProcessing:*@.
    ModuleLoggingConfiguration -> Maybe Text
cloudWatchLogGroupArn :: Prelude.Maybe Prelude.Text
  }
  deriving (ModuleLoggingConfiguration -> ModuleLoggingConfiguration -> Bool
(ModuleLoggingConfiguration -> ModuleLoggingConfiguration -> Bool)
-> (ModuleLoggingConfiguration
    -> ModuleLoggingConfiguration -> Bool)
-> Eq ModuleLoggingConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModuleLoggingConfiguration -> ModuleLoggingConfiguration -> Bool
$c/= :: ModuleLoggingConfiguration -> ModuleLoggingConfiguration -> Bool
== :: ModuleLoggingConfiguration -> ModuleLoggingConfiguration -> Bool
$c== :: ModuleLoggingConfiguration -> ModuleLoggingConfiguration -> Bool
Prelude.Eq, ReadPrec [ModuleLoggingConfiguration]
ReadPrec ModuleLoggingConfiguration
Int -> ReadS ModuleLoggingConfiguration
ReadS [ModuleLoggingConfiguration]
(Int -> ReadS ModuleLoggingConfiguration)
-> ReadS [ModuleLoggingConfiguration]
-> ReadPrec ModuleLoggingConfiguration
-> ReadPrec [ModuleLoggingConfiguration]
-> Read ModuleLoggingConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModuleLoggingConfiguration]
$creadListPrec :: ReadPrec [ModuleLoggingConfiguration]
readPrec :: ReadPrec ModuleLoggingConfiguration
$creadPrec :: ReadPrec ModuleLoggingConfiguration
readList :: ReadS [ModuleLoggingConfiguration]
$creadList :: ReadS [ModuleLoggingConfiguration]
readsPrec :: Int -> ReadS ModuleLoggingConfiguration
$creadsPrec :: Int -> ReadS ModuleLoggingConfiguration
Prelude.Read, Int -> ModuleLoggingConfiguration -> ShowS
[ModuleLoggingConfiguration] -> ShowS
ModuleLoggingConfiguration -> String
(Int -> ModuleLoggingConfiguration -> ShowS)
-> (ModuleLoggingConfiguration -> String)
-> ([ModuleLoggingConfiguration] -> ShowS)
-> Show ModuleLoggingConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModuleLoggingConfiguration] -> ShowS
$cshowList :: [ModuleLoggingConfiguration] -> ShowS
show :: ModuleLoggingConfiguration -> String
$cshow :: ModuleLoggingConfiguration -> String
showsPrec :: Int -> ModuleLoggingConfiguration -> ShowS
$cshowsPrec :: Int -> ModuleLoggingConfiguration -> ShowS
Prelude.Show, (forall x.
 ModuleLoggingConfiguration -> Rep ModuleLoggingConfiguration x)
-> (forall x.
    Rep ModuleLoggingConfiguration x -> ModuleLoggingConfiguration)
-> Generic ModuleLoggingConfiguration
forall x.
Rep ModuleLoggingConfiguration x -> ModuleLoggingConfiguration
forall x.
ModuleLoggingConfiguration -> Rep ModuleLoggingConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModuleLoggingConfiguration x -> ModuleLoggingConfiguration
$cfrom :: forall x.
ModuleLoggingConfiguration -> Rep ModuleLoggingConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'ModuleLoggingConfiguration' 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:
--
-- 'logLevel', 'moduleLoggingConfiguration_logLevel' - Defines the Apache Airflow logs to send for the log type (e.g.
-- @DagProcessingLogs@) to CloudWatch Logs. Valid values: @CRITICAL@,
-- @ERROR@, @WARNING@, @INFO@.
--
-- 'enabled', 'moduleLoggingConfiguration_enabled' - Indicates whether to enable the Apache Airflow log type (e.g.
-- @DagProcessingLogs@) in CloudWatch Logs.
--
-- 'cloudWatchLogGroupArn', 'moduleLoggingConfiguration_cloudWatchLogGroupArn' - The Amazon Resource Name (ARN) for the CloudWatch Logs group where the
-- Apache Airflow log type (e.g. @DagProcessingLogs@) is published. For
-- example,
-- @arn:aws:logs:us-east-1:123456789012:log-group:airflow-MyMWAAEnvironment-MwaaEnvironment-DAGProcessing:*@.
newModuleLoggingConfiguration ::
  ModuleLoggingConfiguration
newModuleLoggingConfiguration :: ModuleLoggingConfiguration
newModuleLoggingConfiguration =
  ModuleLoggingConfiguration' :: Maybe LoggingLevel
-> Maybe Bool -> Maybe Text -> ModuleLoggingConfiguration
ModuleLoggingConfiguration'
    { $sel:logLevel:ModuleLoggingConfiguration' :: Maybe LoggingLevel
logLevel =
        Maybe LoggingLevel
forall a. Maybe a
Prelude.Nothing,
      $sel:enabled:ModuleLoggingConfiguration' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:cloudWatchLogGroupArn:ModuleLoggingConfiguration' :: Maybe Text
cloudWatchLogGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

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

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

-- | The Amazon Resource Name (ARN) for the CloudWatch Logs group where the
-- Apache Airflow log type (e.g. @DagProcessingLogs@) is published. For
-- example,
-- @arn:aws:logs:us-east-1:123456789012:log-group:airflow-MyMWAAEnvironment-MwaaEnvironment-DAGProcessing:*@.
moduleLoggingConfiguration_cloudWatchLogGroupArn :: Lens.Lens' ModuleLoggingConfiguration (Prelude.Maybe Prelude.Text)
moduleLoggingConfiguration_cloudWatchLogGroupArn :: (Maybe Text -> f (Maybe Text))
-> ModuleLoggingConfiguration -> f ModuleLoggingConfiguration
moduleLoggingConfiguration_cloudWatchLogGroupArn = (ModuleLoggingConfiguration -> Maybe Text)
-> (ModuleLoggingConfiguration
    -> Maybe Text -> ModuleLoggingConfiguration)
-> Lens
     ModuleLoggingConfiguration
     ModuleLoggingConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModuleLoggingConfiguration' {Maybe Text
cloudWatchLogGroupArn :: Maybe Text
$sel:cloudWatchLogGroupArn:ModuleLoggingConfiguration' :: ModuleLoggingConfiguration -> Maybe Text
cloudWatchLogGroupArn} -> Maybe Text
cloudWatchLogGroupArn) (\s :: ModuleLoggingConfiguration
s@ModuleLoggingConfiguration' {} Maybe Text
a -> ModuleLoggingConfiguration
s {$sel:cloudWatchLogGroupArn:ModuleLoggingConfiguration' :: Maybe Text
cloudWatchLogGroupArn = Maybe Text
a} :: ModuleLoggingConfiguration)

instance Core.FromJSON ModuleLoggingConfiguration where
  parseJSON :: Value -> Parser ModuleLoggingConfiguration
parseJSON =
    String
-> (Object -> Parser ModuleLoggingConfiguration)
-> Value
-> Parser ModuleLoggingConfiguration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModuleLoggingConfiguration"
      ( \Object
x ->
          Maybe LoggingLevel
-> Maybe Bool -> Maybe Text -> ModuleLoggingConfiguration
ModuleLoggingConfiguration'
            (Maybe LoggingLevel
 -> Maybe Bool -> Maybe Text -> ModuleLoggingConfiguration)
-> Parser (Maybe LoggingLevel)
-> Parser (Maybe Bool -> Maybe Text -> ModuleLoggingConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe LoggingLevel)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"LogLevel")
            Parser (Maybe Bool -> Maybe Text -> ModuleLoggingConfiguration)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> ModuleLoggingConfiguration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Enabled")
            Parser (Maybe Text -> ModuleLoggingConfiguration)
-> Parser (Maybe Text) -> Parser ModuleLoggingConfiguration
forall (f :: * -> *) a b. Applicative f => 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
"CloudWatchLogGroupArn")
      )

instance Prelude.Hashable ModuleLoggingConfiguration

instance Prelude.NFData ModuleLoggingConfiguration