{-# 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.LakeFormation.Types.AuditContext
-- 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.LakeFormation.Types.AuditContext where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | A structure used to include auditing information on the privileged API.
--
-- /See:/ 'newAuditContext' smart constructor.
data AuditContext = AuditContext'
  { -- | The filter engine can populate the \'AdditionalAuditContext\'
    -- information with the request ID for you to track. This information will
    -- be displayed in CloudTrail log in your account.
    AuditContext -> Maybe Text
additionalAuditContext :: Prelude.Maybe Prelude.Text
  }
  deriving (AuditContext -> AuditContext -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AuditContext -> AuditContext -> Bool
$c/= :: AuditContext -> AuditContext -> Bool
== :: AuditContext -> AuditContext -> Bool
$c== :: AuditContext -> AuditContext -> Bool
Prelude.Eq, ReadPrec [AuditContext]
ReadPrec AuditContext
Int -> ReadS AuditContext
ReadS [AuditContext]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AuditContext]
$creadListPrec :: ReadPrec [AuditContext]
readPrec :: ReadPrec AuditContext
$creadPrec :: ReadPrec AuditContext
readList :: ReadS [AuditContext]
$creadList :: ReadS [AuditContext]
readsPrec :: Int -> ReadS AuditContext
$creadsPrec :: Int -> ReadS AuditContext
Prelude.Read, Int -> AuditContext -> ShowS
[AuditContext] -> ShowS
AuditContext -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AuditContext] -> ShowS
$cshowList :: [AuditContext] -> ShowS
show :: AuditContext -> String
$cshow :: AuditContext -> String
showsPrec :: Int -> AuditContext -> ShowS
$cshowsPrec :: Int -> AuditContext -> ShowS
Prelude.Show, forall x. Rep AuditContext x -> AuditContext
forall x. AuditContext -> Rep AuditContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AuditContext x -> AuditContext
$cfrom :: forall x. AuditContext -> Rep AuditContext x
Prelude.Generic)

-- |
-- Create a value of 'AuditContext' 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:
--
-- 'additionalAuditContext', 'auditContext_additionalAuditContext' - The filter engine can populate the \'AdditionalAuditContext\'
-- information with the request ID for you to track. This information will
-- be displayed in CloudTrail log in your account.
newAuditContext ::
  AuditContext
newAuditContext :: AuditContext
newAuditContext =
  AuditContext'
    { $sel:additionalAuditContext:AuditContext' :: Maybe Text
additionalAuditContext =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The filter engine can populate the \'AdditionalAuditContext\'
-- information with the request ID for you to track. This information will
-- be displayed in CloudTrail log in your account.
auditContext_additionalAuditContext :: Lens.Lens' AuditContext (Prelude.Maybe Prelude.Text)
auditContext_additionalAuditContext :: Lens' AuditContext (Maybe Text)
auditContext_additionalAuditContext = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AuditContext' {Maybe Text
additionalAuditContext :: Maybe Text
$sel:additionalAuditContext:AuditContext' :: AuditContext -> Maybe Text
additionalAuditContext} -> Maybe Text
additionalAuditContext) (\s :: AuditContext
s@AuditContext' {} Maybe Text
a -> AuditContext
s {$sel:additionalAuditContext:AuditContext' :: Maybe Text
additionalAuditContext = Maybe Text
a} :: AuditContext)

instance Prelude.Hashable AuditContext where
  hashWithSalt :: Int -> AuditContext -> Int
hashWithSalt Int
_salt AuditContext' {Maybe Text
additionalAuditContext :: Maybe Text
$sel:additionalAuditContext:AuditContext' :: AuditContext -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
additionalAuditContext

instance Prelude.NFData AuditContext where
  rnf :: AuditContext -> ()
rnf AuditContext' {Maybe Text
additionalAuditContext :: Maybe Text
$sel:additionalAuditContext:AuditContext' :: AuditContext -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
additionalAuditContext

instance Data.ToJSON AuditContext where
  toJSON :: AuditContext -> Value
toJSON AuditContext' {Maybe Text
additionalAuditContext :: Maybe Text
$sel:additionalAuditContext:AuditContext' :: AuditContext -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"AdditionalAuditContext" 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
additionalAuditContext
          ]
      )