{-# 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.FSx.Types.LustreLogConfiguration
-- 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.FSx.Types.LustreLogConfiguration where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FSx.Types.LustreAccessAuditLogLevel
import qualified Amazonka.Prelude as Prelude

-- | The configuration for Lustre logging used to write the enabled logging
-- events for your Amazon FSx for Lustre file system or Amazon File Cache
-- resource to Amazon CloudWatch Logs.
--
-- /See:/ 'newLustreLogConfiguration' smart constructor.
data LustreLogConfiguration = LustreLogConfiguration'
  { -- | The Amazon Resource Name (ARN) that specifies the destination of the
    -- logs. The destination can be any Amazon CloudWatch Logs log group ARN.
    -- The destination ARN must be in the same Amazon Web Services partition,
    -- Amazon Web Services Region, and Amazon Web Services account as your
    -- Amazon FSx file system.
    LustreLogConfiguration -> Maybe Text
destination :: Prelude.Maybe Prelude.Text,
    -- | The data repository events that are logged by Amazon FSx.
    --
    -- -   @WARN_ONLY@ - only warning events are logged.
    --
    -- -   @ERROR_ONLY@ - only error events are logged.
    --
    -- -   @WARN_ERROR@ - both warning events and error events are logged.
    --
    -- -   @DISABLED@ - logging of data repository events is turned off.
    --
    -- Note that Amazon File Cache uses a default setting of @WARN_ERROR@,
    -- which can\'t be changed.
    LustreLogConfiguration -> LustreAccessAuditLogLevel
level :: LustreAccessAuditLogLevel
  }
  deriving (LustreLogConfiguration -> LustreLogConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LustreLogConfiguration -> LustreLogConfiguration -> Bool
$c/= :: LustreLogConfiguration -> LustreLogConfiguration -> Bool
== :: LustreLogConfiguration -> LustreLogConfiguration -> Bool
$c== :: LustreLogConfiguration -> LustreLogConfiguration -> Bool
Prelude.Eq, ReadPrec [LustreLogConfiguration]
ReadPrec LustreLogConfiguration
Int -> ReadS LustreLogConfiguration
ReadS [LustreLogConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LustreLogConfiguration]
$creadListPrec :: ReadPrec [LustreLogConfiguration]
readPrec :: ReadPrec LustreLogConfiguration
$creadPrec :: ReadPrec LustreLogConfiguration
readList :: ReadS [LustreLogConfiguration]
$creadList :: ReadS [LustreLogConfiguration]
readsPrec :: Int -> ReadS LustreLogConfiguration
$creadsPrec :: Int -> ReadS LustreLogConfiguration
Prelude.Read, Int -> LustreLogConfiguration -> ShowS
[LustreLogConfiguration] -> ShowS
LustreLogConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LustreLogConfiguration] -> ShowS
$cshowList :: [LustreLogConfiguration] -> ShowS
show :: LustreLogConfiguration -> String
$cshow :: LustreLogConfiguration -> String
showsPrec :: Int -> LustreLogConfiguration -> ShowS
$cshowsPrec :: Int -> LustreLogConfiguration -> ShowS
Prelude.Show, forall x. Rep LustreLogConfiguration x -> LustreLogConfiguration
forall x. LustreLogConfiguration -> Rep LustreLogConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LustreLogConfiguration x -> LustreLogConfiguration
$cfrom :: forall x. LustreLogConfiguration -> Rep LustreLogConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'LustreLogConfiguration' 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:
--
-- 'destination', 'lustreLogConfiguration_destination' - The Amazon Resource Name (ARN) that specifies the destination of the
-- logs. The destination can be any Amazon CloudWatch Logs log group ARN.
-- The destination ARN must be in the same Amazon Web Services partition,
-- Amazon Web Services Region, and Amazon Web Services account as your
-- Amazon FSx file system.
--
-- 'level', 'lustreLogConfiguration_level' - The data repository events that are logged by Amazon FSx.
--
-- -   @WARN_ONLY@ - only warning events are logged.
--
-- -   @ERROR_ONLY@ - only error events are logged.
--
-- -   @WARN_ERROR@ - both warning events and error events are logged.
--
-- -   @DISABLED@ - logging of data repository events is turned off.
--
-- Note that Amazon File Cache uses a default setting of @WARN_ERROR@,
-- which can\'t be changed.
newLustreLogConfiguration ::
  -- | 'level'
  LustreAccessAuditLogLevel ->
  LustreLogConfiguration
newLustreLogConfiguration :: LustreAccessAuditLogLevel -> LustreLogConfiguration
newLustreLogConfiguration LustreAccessAuditLogLevel
pLevel_ =
  LustreLogConfiguration'
    { $sel:destination:LustreLogConfiguration' :: Maybe Text
destination =
        forall a. Maybe a
Prelude.Nothing,
      $sel:level:LustreLogConfiguration' :: LustreAccessAuditLogLevel
level = LustreAccessAuditLogLevel
pLevel_
    }

-- | The Amazon Resource Name (ARN) that specifies the destination of the
-- logs. The destination can be any Amazon CloudWatch Logs log group ARN.
-- The destination ARN must be in the same Amazon Web Services partition,
-- Amazon Web Services Region, and Amazon Web Services account as your
-- Amazon FSx file system.
lustreLogConfiguration_destination :: Lens.Lens' LustreLogConfiguration (Prelude.Maybe Prelude.Text)
lustreLogConfiguration_destination :: Lens' LustreLogConfiguration (Maybe Text)
lustreLogConfiguration_destination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LustreLogConfiguration' {Maybe Text
destination :: Maybe Text
$sel:destination:LustreLogConfiguration' :: LustreLogConfiguration -> Maybe Text
destination} -> Maybe Text
destination) (\s :: LustreLogConfiguration
s@LustreLogConfiguration' {} Maybe Text
a -> LustreLogConfiguration
s {$sel:destination:LustreLogConfiguration' :: Maybe Text
destination = Maybe Text
a} :: LustreLogConfiguration)

-- | The data repository events that are logged by Amazon FSx.
--
-- -   @WARN_ONLY@ - only warning events are logged.
--
-- -   @ERROR_ONLY@ - only error events are logged.
--
-- -   @WARN_ERROR@ - both warning events and error events are logged.
--
-- -   @DISABLED@ - logging of data repository events is turned off.
--
-- Note that Amazon File Cache uses a default setting of @WARN_ERROR@,
-- which can\'t be changed.
lustreLogConfiguration_level :: Lens.Lens' LustreLogConfiguration LustreAccessAuditLogLevel
lustreLogConfiguration_level :: Lens' LustreLogConfiguration LustreAccessAuditLogLevel
lustreLogConfiguration_level = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LustreLogConfiguration' {LustreAccessAuditLogLevel
level :: LustreAccessAuditLogLevel
$sel:level:LustreLogConfiguration' :: LustreLogConfiguration -> LustreAccessAuditLogLevel
level} -> LustreAccessAuditLogLevel
level) (\s :: LustreLogConfiguration
s@LustreLogConfiguration' {} LustreAccessAuditLogLevel
a -> LustreLogConfiguration
s {$sel:level:LustreLogConfiguration' :: LustreAccessAuditLogLevel
level = LustreAccessAuditLogLevel
a} :: LustreLogConfiguration)

instance Data.FromJSON LustreLogConfiguration where
  parseJSON :: Value -> Parser LustreLogConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LustreLogConfiguration"
      ( \Object
x ->
          Maybe Text -> LustreAccessAuditLogLevel -> LustreLogConfiguration
LustreLogConfiguration'
            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
"Destination")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Level")
      )

instance Prelude.Hashable LustreLogConfiguration where
  hashWithSalt :: Int -> LustreLogConfiguration -> Int
hashWithSalt Int
_salt LustreLogConfiguration' {Maybe Text
LustreAccessAuditLogLevel
level :: LustreAccessAuditLogLevel
destination :: Maybe Text
$sel:level:LustreLogConfiguration' :: LustreLogConfiguration -> LustreAccessAuditLogLevel
$sel:destination:LustreLogConfiguration' :: LustreLogConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
destination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LustreAccessAuditLogLevel
level

instance Prelude.NFData LustreLogConfiguration where
  rnf :: LustreLogConfiguration -> ()
rnf LustreLogConfiguration' {Maybe Text
LustreAccessAuditLogLevel
level :: LustreAccessAuditLogLevel
destination :: Maybe Text
$sel:level:LustreLogConfiguration' :: LustreLogConfiguration -> LustreAccessAuditLogLevel
$sel:destination:LustreLogConfiguration' :: LustreLogConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
destination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LustreAccessAuditLogLevel
level