{-# 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.WindowsAuditLogConfiguration
-- 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.WindowsAuditLogConfiguration 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.WindowsAccessAuditLogLevel
import qualified Amazonka.Prelude as Prelude

-- | The configuration that Amazon FSx for Windows File Server uses to audit
-- and log user accesses of files, folders, and file shares on the Amazon
-- FSx for Windows File Server file system. For more information, see
-- <https://docs.aws.amazon.com/fsx/latest/WindowsGuide/file-access-auditing.html File access auditing>.
--
-- /See:/ 'newWindowsAuditLogConfiguration' smart constructor.
data WindowsAuditLogConfiguration = WindowsAuditLogConfiguration'
  { -- | The Amazon Resource Name (ARN) for the destination of the audit logs.
    -- The destination can be any Amazon CloudWatch Logs log group ARN or
    -- Amazon Kinesis Data Firehose delivery stream ARN.
    --
    -- The name of the Amazon CloudWatch Logs log group must begin with the
    -- @\/aws\/fsx@ prefix. The name of the Amazon Kinesis Data Firehouse
    -- delivery stream must begin with the @aws-fsx@ prefix.
    --
    -- The destination ARN (either CloudWatch Logs log group or Kinesis Data
    -- Firehose delivery stream) must be in the same Amazon Web Services
    -- partition, Amazon Web Services Region, and Amazon Web Services account
    -- as your Amazon FSx file system.
    WindowsAuditLogConfiguration -> Maybe Text
auditLogDestination :: Prelude.Maybe Prelude.Text,
    -- | Sets which attempt type is logged by Amazon FSx for file and folder
    -- accesses.
    --
    -- -   @SUCCESS_ONLY@ - only successful attempts to access files or folders
    --     are logged.
    --
    -- -   @FAILURE_ONLY@ - only failed attempts to access files or folders are
    --     logged.
    --
    -- -   @SUCCESS_AND_FAILURE@ - both successful attempts and failed attempts
    --     to access files or folders are logged.
    --
    -- -   @DISABLED@ - access auditing of files and folders is turned off.
    WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel,
    -- | Sets which attempt type is logged by Amazon FSx for file share accesses.
    --
    -- -   @SUCCESS_ONLY@ - only successful attempts to access file shares are
    --     logged.
    --
    -- -   @FAILURE_ONLY@ - only failed attempts to access file shares are
    --     logged.
    --
    -- -   @SUCCESS_AND_FAILURE@ - both successful attempts and failed attempts
    --     to access file shares are logged.
    --
    -- -   @DISABLED@ - access auditing of file shares is turned off.
    WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
  }
  deriving (WindowsAuditLogConfiguration
-> WindowsAuditLogConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WindowsAuditLogConfiguration
-> WindowsAuditLogConfiguration -> Bool
$c/= :: WindowsAuditLogConfiguration
-> WindowsAuditLogConfiguration -> Bool
== :: WindowsAuditLogConfiguration
-> WindowsAuditLogConfiguration -> Bool
$c== :: WindowsAuditLogConfiguration
-> WindowsAuditLogConfiguration -> Bool
Prelude.Eq, ReadPrec [WindowsAuditLogConfiguration]
ReadPrec WindowsAuditLogConfiguration
Int -> ReadS WindowsAuditLogConfiguration
ReadS [WindowsAuditLogConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WindowsAuditLogConfiguration]
$creadListPrec :: ReadPrec [WindowsAuditLogConfiguration]
readPrec :: ReadPrec WindowsAuditLogConfiguration
$creadPrec :: ReadPrec WindowsAuditLogConfiguration
readList :: ReadS [WindowsAuditLogConfiguration]
$creadList :: ReadS [WindowsAuditLogConfiguration]
readsPrec :: Int -> ReadS WindowsAuditLogConfiguration
$creadsPrec :: Int -> ReadS WindowsAuditLogConfiguration
Prelude.Read, Int -> WindowsAuditLogConfiguration -> ShowS
[WindowsAuditLogConfiguration] -> ShowS
WindowsAuditLogConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WindowsAuditLogConfiguration] -> ShowS
$cshowList :: [WindowsAuditLogConfiguration] -> ShowS
show :: WindowsAuditLogConfiguration -> String
$cshow :: WindowsAuditLogConfiguration -> String
showsPrec :: Int -> WindowsAuditLogConfiguration -> ShowS
$cshowsPrec :: Int -> WindowsAuditLogConfiguration -> ShowS
Prelude.Show, forall x.
Rep WindowsAuditLogConfiguration x -> WindowsAuditLogConfiguration
forall x.
WindowsAuditLogConfiguration -> Rep WindowsAuditLogConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WindowsAuditLogConfiguration x -> WindowsAuditLogConfiguration
$cfrom :: forall x.
WindowsAuditLogConfiguration -> Rep WindowsAuditLogConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'WindowsAuditLogConfiguration' 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:
--
-- 'auditLogDestination', 'windowsAuditLogConfiguration_auditLogDestination' - The Amazon Resource Name (ARN) for the destination of the audit logs.
-- The destination can be any Amazon CloudWatch Logs log group ARN or
-- Amazon Kinesis Data Firehose delivery stream ARN.
--
-- The name of the Amazon CloudWatch Logs log group must begin with the
-- @\/aws\/fsx@ prefix. The name of the Amazon Kinesis Data Firehouse
-- delivery stream must begin with the @aws-fsx@ prefix.
--
-- The destination ARN (either CloudWatch Logs log group or Kinesis Data
-- Firehose delivery stream) must be in the same Amazon Web Services
-- partition, Amazon Web Services Region, and Amazon Web Services account
-- as your Amazon FSx file system.
--
-- 'fileAccessAuditLogLevel', 'windowsAuditLogConfiguration_fileAccessAuditLogLevel' - Sets which attempt type is logged by Amazon FSx for file and folder
-- accesses.
--
-- -   @SUCCESS_ONLY@ - only successful attempts to access files or folders
--     are logged.
--
-- -   @FAILURE_ONLY@ - only failed attempts to access files or folders are
--     logged.
--
-- -   @SUCCESS_AND_FAILURE@ - both successful attempts and failed attempts
--     to access files or folders are logged.
--
-- -   @DISABLED@ - access auditing of files and folders is turned off.
--
-- 'fileShareAccessAuditLogLevel', 'windowsAuditLogConfiguration_fileShareAccessAuditLogLevel' - Sets which attempt type is logged by Amazon FSx for file share accesses.
--
-- -   @SUCCESS_ONLY@ - only successful attempts to access file shares are
--     logged.
--
-- -   @FAILURE_ONLY@ - only failed attempts to access file shares are
--     logged.
--
-- -   @SUCCESS_AND_FAILURE@ - both successful attempts and failed attempts
--     to access file shares are logged.
--
-- -   @DISABLED@ - access auditing of file shares is turned off.
newWindowsAuditLogConfiguration ::
  -- | 'fileAccessAuditLogLevel'
  WindowsAccessAuditLogLevel ->
  -- | 'fileShareAccessAuditLogLevel'
  WindowsAccessAuditLogLevel ->
  WindowsAuditLogConfiguration
newWindowsAuditLogConfiguration :: WindowsAccessAuditLogLevel
-> WindowsAccessAuditLogLevel -> WindowsAuditLogConfiguration
newWindowsAuditLogConfiguration
  WindowsAccessAuditLogLevel
pFileAccessAuditLogLevel_
  WindowsAccessAuditLogLevel
pFileShareAccessAuditLogLevel_ =
    WindowsAuditLogConfiguration'
      { $sel:auditLogDestination:WindowsAuditLogConfiguration' :: Maybe Text
auditLogDestination =
          forall a. Maybe a
Prelude.Nothing,
        $sel:fileAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel =
          WindowsAccessAuditLogLevel
pFileAccessAuditLogLevel_,
        $sel:fileShareAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel =
          WindowsAccessAuditLogLevel
pFileShareAccessAuditLogLevel_
      }

-- | The Amazon Resource Name (ARN) for the destination of the audit logs.
-- The destination can be any Amazon CloudWatch Logs log group ARN or
-- Amazon Kinesis Data Firehose delivery stream ARN.
--
-- The name of the Amazon CloudWatch Logs log group must begin with the
-- @\/aws\/fsx@ prefix. The name of the Amazon Kinesis Data Firehouse
-- delivery stream must begin with the @aws-fsx@ prefix.
--
-- The destination ARN (either CloudWatch Logs log group or Kinesis Data
-- Firehose delivery stream) must be in the same Amazon Web Services
-- partition, Amazon Web Services Region, and Amazon Web Services account
-- as your Amazon FSx file system.
windowsAuditLogConfiguration_auditLogDestination :: Lens.Lens' WindowsAuditLogConfiguration (Prelude.Maybe Prelude.Text)
windowsAuditLogConfiguration_auditLogDestination :: Lens' WindowsAuditLogConfiguration (Maybe Text)
windowsAuditLogConfiguration_auditLogDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WindowsAuditLogConfiguration' {Maybe Text
auditLogDestination :: Maybe Text
$sel:auditLogDestination:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> Maybe Text
auditLogDestination} -> Maybe Text
auditLogDestination) (\s :: WindowsAuditLogConfiguration
s@WindowsAuditLogConfiguration' {} Maybe Text
a -> WindowsAuditLogConfiguration
s {$sel:auditLogDestination:WindowsAuditLogConfiguration' :: Maybe Text
auditLogDestination = Maybe Text
a} :: WindowsAuditLogConfiguration)

-- | Sets which attempt type is logged by Amazon FSx for file and folder
-- accesses.
--
-- -   @SUCCESS_ONLY@ - only successful attempts to access files or folders
--     are logged.
--
-- -   @FAILURE_ONLY@ - only failed attempts to access files or folders are
--     logged.
--
-- -   @SUCCESS_AND_FAILURE@ - both successful attempts and failed attempts
--     to access files or folders are logged.
--
-- -   @DISABLED@ - access auditing of files and folders is turned off.
windowsAuditLogConfiguration_fileAccessAuditLogLevel :: Lens.Lens' WindowsAuditLogConfiguration WindowsAccessAuditLogLevel
windowsAuditLogConfiguration_fileAccessAuditLogLevel :: Lens' WindowsAuditLogConfiguration WindowsAccessAuditLogLevel
windowsAuditLogConfiguration_fileAccessAuditLogLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WindowsAuditLogConfiguration' {WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel
$sel:fileAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
fileAccessAuditLogLevel} -> WindowsAccessAuditLogLevel
fileAccessAuditLogLevel) (\s :: WindowsAuditLogConfiguration
s@WindowsAuditLogConfiguration' {} WindowsAccessAuditLogLevel
a -> WindowsAuditLogConfiguration
s {$sel:fileAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel = WindowsAccessAuditLogLevel
a} :: WindowsAuditLogConfiguration)

-- | Sets which attempt type is logged by Amazon FSx for file share accesses.
--
-- -   @SUCCESS_ONLY@ - only successful attempts to access file shares are
--     logged.
--
-- -   @FAILURE_ONLY@ - only failed attempts to access file shares are
--     logged.
--
-- -   @SUCCESS_AND_FAILURE@ - both successful attempts and failed attempts
--     to access file shares are logged.
--
-- -   @DISABLED@ - access auditing of file shares is turned off.
windowsAuditLogConfiguration_fileShareAccessAuditLogLevel :: Lens.Lens' WindowsAuditLogConfiguration WindowsAccessAuditLogLevel
windowsAuditLogConfiguration_fileShareAccessAuditLogLevel :: Lens' WindowsAuditLogConfiguration WindowsAccessAuditLogLevel
windowsAuditLogConfiguration_fileShareAccessAuditLogLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WindowsAuditLogConfiguration' {WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
$sel:fileShareAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel} -> WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel) (\s :: WindowsAuditLogConfiguration
s@WindowsAuditLogConfiguration' {} WindowsAccessAuditLogLevel
a -> WindowsAuditLogConfiguration
s {$sel:fileShareAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel = WindowsAccessAuditLogLevel
a} :: WindowsAuditLogConfiguration)

instance Data.FromJSON WindowsAuditLogConfiguration where
  parseJSON :: Value -> Parser WindowsAuditLogConfiguration
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"WindowsAuditLogConfiguration"
      ( \Object
x ->
          Maybe Text
-> WindowsAccessAuditLogLevel
-> WindowsAccessAuditLogLevel
-> WindowsAuditLogConfiguration
WindowsAuditLogConfiguration'
            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
"AuditLogDestination")
            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
"FileAccessAuditLogLevel")
            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
"FileShareAccessAuditLogLevel")
      )

instance
  Prelude.Hashable
    WindowsAuditLogConfiguration
  where
  hashWithSalt :: Int -> WindowsAuditLogConfiguration -> Int
hashWithSalt Int
_salt WindowsAuditLogConfiguration' {Maybe Text
WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel
auditLogDestination :: Maybe Text
$sel:fileShareAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
$sel:fileAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
$sel:auditLogDestination:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
auditLogDestination
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WindowsAccessAuditLogLevel
fileAccessAuditLogLevel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel

instance Prelude.NFData WindowsAuditLogConfiguration where
  rnf :: WindowsAuditLogConfiguration -> ()
rnf WindowsAuditLogConfiguration' {Maybe Text
WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel
auditLogDestination :: Maybe Text
$sel:fileShareAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
$sel:fileAccessAuditLogLevel:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> WindowsAccessAuditLogLevel
$sel:auditLogDestination:WindowsAuditLogConfiguration' :: WindowsAuditLogConfiguration -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
auditLogDestination
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WindowsAccessAuditLogLevel
fileAccessAuditLogLevel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel