{-# 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.WindowsAuditLogCreateConfiguration
-- 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.WindowsAuditLogCreateConfiguration 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 Windows file access auditing configuration used when creating or
-- updating an Amazon FSx for Windows File Server file system.
--
-- /See:/ 'newWindowsAuditLogCreateConfiguration' smart constructor.
data WindowsAuditLogCreateConfiguration = WindowsAuditLogCreateConfiguration'
  { -- | The Amazon Resource Name (ARN) that specifies 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, with the following
    -- requirements:
    --
    -- -   The destination ARN that you provide (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.
    --
    -- -   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.
    --
    -- -   If you do not provide a destination in @AuditLogDestination@, Amazon
    --     FSx will create and use a log stream in the CloudWatch Logs
    --     @\/aws\/fsx\/windows@ log group.
    --
    -- -   If @AuditLogDestination@ is provided and the resource does not
    --     exist, the request will fail with a @BadRequest@ error.
    --
    -- -   If @FileAccessAuditLogLevel@ and @FileShareAccessAuditLogLevel@ are
    --     both set to @DISABLED@, you cannot specify a destination in
    --     @AuditLogDestination@.
    WindowsAuditLogCreateConfiguration -> 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.
    WindowsAuditLogCreateConfiguration -> 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.
    WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
  }
  deriving (WindowsAuditLogCreateConfiguration
-> WindowsAuditLogCreateConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: WindowsAuditLogCreateConfiguration
-> WindowsAuditLogCreateConfiguration -> Bool
$c/= :: WindowsAuditLogCreateConfiguration
-> WindowsAuditLogCreateConfiguration -> Bool
== :: WindowsAuditLogCreateConfiguration
-> WindowsAuditLogCreateConfiguration -> Bool
$c== :: WindowsAuditLogCreateConfiguration
-> WindowsAuditLogCreateConfiguration -> Bool
Prelude.Eq, ReadPrec [WindowsAuditLogCreateConfiguration]
ReadPrec WindowsAuditLogCreateConfiguration
Int -> ReadS WindowsAuditLogCreateConfiguration
ReadS [WindowsAuditLogCreateConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [WindowsAuditLogCreateConfiguration]
$creadListPrec :: ReadPrec [WindowsAuditLogCreateConfiguration]
readPrec :: ReadPrec WindowsAuditLogCreateConfiguration
$creadPrec :: ReadPrec WindowsAuditLogCreateConfiguration
readList :: ReadS [WindowsAuditLogCreateConfiguration]
$creadList :: ReadS [WindowsAuditLogCreateConfiguration]
readsPrec :: Int -> ReadS WindowsAuditLogCreateConfiguration
$creadsPrec :: Int -> ReadS WindowsAuditLogCreateConfiguration
Prelude.Read, Int -> WindowsAuditLogCreateConfiguration -> ShowS
[WindowsAuditLogCreateConfiguration] -> ShowS
WindowsAuditLogCreateConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [WindowsAuditLogCreateConfiguration] -> ShowS
$cshowList :: [WindowsAuditLogCreateConfiguration] -> ShowS
show :: WindowsAuditLogCreateConfiguration -> String
$cshow :: WindowsAuditLogCreateConfiguration -> String
showsPrec :: Int -> WindowsAuditLogCreateConfiguration -> ShowS
$cshowsPrec :: Int -> WindowsAuditLogCreateConfiguration -> ShowS
Prelude.Show, forall x.
Rep WindowsAuditLogCreateConfiguration x
-> WindowsAuditLogCreateConfiguration
forall x.
WindowsAuditLogCreateConfiguration
-> Rep WindowsAuditLogCreateConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep WindowsAuditLogCreateConfiguration x
-> WindowsAuditLogCreateConfiguration
$cfrom :: forall x.
WindowsAuditLogCreateConfiguration
-> Rep WindowsAuditLogCreateConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'WindowsAuditLogCreateConfiguration' 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', 'windowsAuditLogCreateConfiguration_auditLogDestination' - The Amazon Resource Name (ARN) that specifies 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, with the following
-- requirements:
--
-- -   The destination ARN that you provide (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.
--
-- -   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.
--
-- -   If you do not provide a destination in @AuditLogDestination@, Amazon
--     FSx will create and use a log stream in the CloudWatch Logs
--     @\/aws\/fsx\/windows@ log group.
--
-- -   If @AuditLogDestination@ is provided and the resource does not
--     exist, the request will fail with a @BadRequest@ error.
--
-- -   If @FileAccessAuditLogLevel@ and @FileShareAccessAuditLogLevel@ are
--     both set to @DISABLED@, you cannot specify a destination in
--     @AuditLogDestination@.
--
-- 'fileAccessAuditLogLevel', 'windowsAuditLogCreateConfiguration_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', 'windowsAuditLogCreateConfiguration_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.
newWindowsAuditLogCreateConfiguration ::
  -- | 'fileAccessAuditLogLevel'
  WindowsAccessAuditLogLevel ->
  -- | 'fileShareAccessAuditLogLevel'
  WindowsAccessAuditLogLevel ->
  WindowsAuditLogCreateConfiguration
newWindowsAuditLogCreateConfiguration :: WindowsAccessAuditLogLevel
-> WindowsAccessAuditLogLevel -> WindowsAuditLogCreateConfiguration
newWindowsAuditLogCreateConfiguration
  WindowsAccessAuditLogLevel
pFileAccessAuditLogLevel_
  WindowsAccessAuditLogLevel
pFileShareAccessAuditLogLevel_ =
    WindowsAuditLogCreateConfiguration'
      { $sel:auditLogDestination:WindowsAuditLogCreateConfiguration' :: Maybe Text
auditLogDestination =
          forall a. Maybe a
Prelude.Nothing,
        $sel:fileAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel =
          WindowsAccessAuditLogLevel
pFileAccessAuditLogLevel_,
        $sel:fileShareAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel =
          WindowsAccessAuditLogLevel
pFileShareAccessAuditLogLevel_
      }

-- | The Amazon Resource Name (ARN) that specifies 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, with the following
-- requirements:
--
-- -   The destination ARN that you provide (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.
--
-- -   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.
--
-- -   If you do not provide a destination in @AuditLogDestination@, Amazon
--     FSx will create and use a log stream in the CloudWatch Logs
--     @\/aws\/fsx\/windows@ log group.
--
-- -   If @AuditLogDestination@ is provided and the resource does not
--     exist, the request will fail with a @BadRequest@ error.
--
-- -   If @FileAccessAuditLogLevel@ and @FileShareAccessAuditLogLevel@ are
--     both set to @DISABLED@, you cannot specify a destination in
--     @AuditLogDestination@.
windowsAuditLogCreateConfiguration_auditLogDestination :: Lens.Lens' WindowsAuditLogCreateConfiguration (Prelude.Maybe Prelude.Text)
windowsAuditLogCreateConfiguration_auditLogDestination :: Lens' WindowsAuditLogCreateConfiguration (Maybe Text)
windowsAuditLogCreateConfiguration_auditLogDestination = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WindowsAuditLogCreateConfiguration' {Maybe Text
auditLogDestination :: Maybe Text
$sel:auditLogDestination:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> Maybe Text
auditLogDestination} -> Maybe Text
auditLogDestination) (\s :: WindowsAuditLogCreateConfiguration
s@WindowsAuditLogCreateConfiguration' {} Maybe Text
a -> WindowsAuditLogCreateConfiguration
s {$sel:auditLogDestination:WindowsAuditLogCreateConfiguration' :: Maybe Text
auditLogDestination = Maybe Text
a} :: WindowsAuditLogCreateConfiguration)

-- | 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.
windowsAuditLogCreateConfiguration_fileAccessAuditLogLevel :: Lens.Lens' WindowsAuditLogCreateConfiguration WindowsAccessAuditLogLevel
windowsAuditLogCreateConfiguration_fileAccessAuditLogLevel :: Lens' WindowsAuditLogCreateConfiguration WindowsAccessAuditLogLevel
windowsAuditLogCreateConfiguration_fileAccessAuditLogLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WindowsAuditLogCreateConfiguration' {WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel
$sel:fileAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
fileAccessAuditLogLevel} -> WindowsAccessAuditLogLevel
fileAccessAuditLogLevel) (\s :: WindowsAuditLogCreateConfiguration
s@WindowsAuditLogCreateConfiguration' {} WindowsAccessAuditLogLevel
a -> WindowsAuditLogCreateConfiguration
s {$sel:fileAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel = WindowsAccessAuditLogLevel
a} :: WindowsAuditLogCreateConfiguration)

-- | 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.
windowsAuditLogCreateConfiguration_fileShareAccessAuditLogLevel :: Lens.Lens' WindowsAuditLogCreateConfiguration WindowsAccessAuditLogLevel
windowsAuditLogCreateConfiguration_fileShareAccessAuditLogLevel :: Lens' WindowsAuditLogCreateConfiguration WindowsAccessAuditLogLevel
windowsAuditLogCreateConfiguration_fileShareAccessAuditLogLevel = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\WindowsAuditLogCreateConfiguration' {WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
$sel:fileShareAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel} -> WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel) (\s :: WindowsAuditLogCreateConfiguration
s@WindowsAuditLogCreateConfiguration' {} WindowsAccessAuditLogLevel
a -> WindowsAuditLogCreateConfiguration
s {$sel:fileShareAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel = WindowsAccessAuditLogLevel
a} :: WindowsAuditLogCreateConfiguration)

instance
  Prelude.Hashable
    WindowsAuditLogCreateConfiguration
  where
  hashWithSalt :: Int -> WindowsAuditLogCreateConfiguration -> Int
hashWithSalt
    Int
_salt
    WindowsAuditLogCreateConfiguration' {Maybe Text
WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel
auditLogDestination :: Maybe Text
$sel:fileShareAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
$sel:fileAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
$sel:auditLogDestination:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> 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
    WindowsAuditLogCreateConfiguration
  where
  rnf :: WindowsAuditLogCreateConfiguration -> ()
rnf WindowsAuditLogCreateConfiguration' {Maybe Text
WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel
auditLogDestination :: Maybe Text
$sel:fileShareAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
$sel:fileAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
$sel:auditLogDestination:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> 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

instance
  Data.ToJSON
    WindowsAuditLogCreateConfiguration
  where
  toJSON :: WindowsAuditLogCreateConfiguration -> Value
toJSON WindowsAuditLogCreateConfiguration' {Maybe Text
WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel :: WindowsAccessAuditLogLevel
fileAccessAuditLogLevel :: WindowsAccessAuditLogLevel
auditLogDestination :: Maybe Text
$sel:fileShareAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
$sel:fileAccessAuditLogLevel:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> WindowsAccessAuditLogLevel
$sel:auditLogDestination:WindowsAuditLogCreateConfiguration' :: WindowsAuditLogCreateConfiguration -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AuditLogDestination" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
auditLogDestination,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"FileAccessAuditLogLevel"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= WindowsAccessAuditLogLevel
fileAccessAuditLogLevel
              ),
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"FileShareAccessAuditLogLevel"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= WindowsAccessAuditLogLevel
fileShareAccessAuditLogLevel
              )
          ]
      )