{-# 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.AuditManager.Types.ChangeLog
-- 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.AuditManager.Types.ChangeLog where

import Amazonka.AuditManager.Types.ActionEnum
import Amazonka.AuditManager.Types.ObjectTypeEnum
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The record of a change within Audit Manager, such as a modified
-- assessment, a delegated control set, and so on.
--
-- /See:/ 'newChangeLog' smart constructor.
data ChangeLog = ChangeLog'
  { -- | The name of the changelog object.
    ChangeLog -> Maybe Text
objectName :: Prelude.Maybe Prelude.Text,
    -- | The time of creation for the changelog object.
    ChangeLog -> Maybe POSIX
createdAt :: Prelude.Maybe Core.POSIX,
    -- | The changelog object type, such as an assessment, control, or control
    -- set.
    ChangeLog -> Maybe ObjectTypeEnum
objectType :: Prelude.Maybe ObjectTypeEnum,
    -- | The IAM user or role that performed the action.
    ChangeLog -> Maybe Text
createdBy :: Prelude.Maybe Prelude.Text,
    -- | The action performed.
    ChangeLog -> Maybe ActionEnum
action :: Prelude.Maybe ActionEnum
  }
  deriving (ChangeLog -> ChangeLog -> Bool
(ChangeLog -> ChangeLog -> Bool)
-> (ChangeLog -> ChangeLog -> Bool) -> Eq ChangeLog
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ChangeLog -> ChangeLog -> Bool
$c/= :: ChangeLog -> ChangeLog -> Bool
== :: ChangeLog -> ChangeLog -> Bool
$c== :: ChangeLog -> ChangeLog -> Bool
Prelude.Eq, ReadPrec [ChangeLog]
ReadPrec ChangeLog
Int -> ReadS ChangeLog
ReadS [ChangeLog]
(Int -> ReadS ChangeLog)
-> ReadS [ChangeLog]
-> ReadPrec ChangeLog
-> ReadPrec [ChangeLog]
-> Read ChangeLog
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ChangeLog]
$creadListPrec :: ReadPrec [ChangeLog]
readPrec :: ReadPrec ChangeLog
$creadPrec :: ReadPrec ChangeLog
readList :: ReadS [ChangeLog]
$creadList :: ReadS [ChangeLog]
readsPrec :: Int -> ReadS ChangeLog
$creadsPrec :: Int -> ReadS ChangeLog
Prelude.Read, Int -> ChangeLog -> ShowS
[ChangeLog] -> ShowS
ChangeLog -> String
(Int -> ChangeLog -> ShowS)
-> (ChangeLog -> String)
-> ([ChangeLog] -> ShowS)
-> Show ChangeLog
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ChangeLog] -> ShowS
$cshowList :: [ChangeLog] -> ShowS
show :: ChangeLog -> String
$cshow :: ChangeLog -> String
showsPrec :: Int -> ChangeLog -> ShowS
$cshowsPrec :: Int -> ChangeLog -> ShowS
Prelude.Show, (forall x. ChangeLog -> Rep ChangeLog x)
-> (forall x. Rep ChangeLog x -> ChangeLog) -> Generic ChangeLog
forall x. Rep ChangeLog x -> ChangeLog
forall x. ChangeLog -> Rep ChangeLog x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ChangeLog x -> ChangeLog
$cfrom :: forall x. ChangeLog -> Rep ChangeLog x
Prelude.Generic)

-- |
-- Create a value of 'ChangeLog' 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:
--
-- 'objectName', 'changeLog_objectName' - The name of the changelog object.
--
-- 'createdAt', 'changeLog_createdAt' - The time of creation for the changelog object.
--
-- 'objectType', 'changeLog_objectType' - The changelog object type, such as an assessment, control, or control
-- set.
--
-- 'createdBy', 'changeLog_createdBy' - The IAM user or role that performed the action.
--
-- 'action', 'changeLog_action' - The action performed.
newChangeLog ::
  ChangeLog
newChangeLog :: ChangeLog
newChangeLog =
  ChangeLog' :: Maybe Text
-> Maybe POSIX
-> Maybe ObjectTypeEnum
-> Maybe Text
-> Maybe ActionEnum
-> ChangeLog
ChangeLog'
    { $sel:objectName:ChangeLog' :: Maybe Text
objectName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdAt:ChangeLog' :: Maybe POSIX
createdAt = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:objectType:ChangeLog' :: Maybe ObjectTypeEnum
objectType = Maybe ObjectTypeEnum
forall a. Maybe a
Prelude.Nothing,
      $sel:createdBy:ChangeLog' :: Maybe Text
createdBy = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:action:ChangeLog' :: Maybe ActionEnum
action = Maybe ActionEnum
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the changelog object.
changeLog_objectName :: Lens.Lens' ChangeLog (Prelude.Maybe Prelude.Text)
changeLog_objectName :: (Maybe Text -> f (Maybe Text)) -> ChangeLog -> f ChangeLog
changeLog_objectName = (ChangeLog -> Maybe Text)
-> (ChangeLog -> Maybe Text -> ChangeLog)
-> Lens ChangeLog ChangeLog (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeLog' {Maybe Text
objectName :: Maybe Text
$sel:objectName:ChangeLog' :: ChangeLog -> Maybe Text
objectName} -> Maybe Text
objectName) (\s :: ChangeLog
s@ChangeLog' {} Maybe Text
a -> ChangeLog
s {$sel:objectName:ChangeLog' :: Maybe Text
objectName = Maybe Text
a} :: ChangeLog)

-- | The time of creation for the changelog object.
changeLog_createdAt :: Lens.Lens' ChangeLog (Prelude.Maybe Prelude.UTCTime)
changeLog_createdAt :: (Maybe UTCTime -> f (Maybe UTCTime)) -> ChangeLog -> f ChangeLog
changeLog_createdAt = (ChangeLog -> Maybe POSIX)
-> (ChangeLog -> Maybe POSIX -> ChangeLog)
-> Lens ChangeLog ChangeLog (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeLog' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:ChangeLog' :: ChangeLog -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: ChangeLog
s@ChangeLog' {} Maybe POSIX
a -> ChangeLog
s {$sel:createdAt:ChangeLog' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: ChangeLog) ((Maybe POSIX -> f (Maybe POSIX)) -> ChangeLog -> f ChangeLog)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ChangeLog
-> f ChangeLog
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The changelog object type, such as an assessment, control, or control
-- set.
changeLog_objectType :: Lens.Lens' ChangeLog (Prelude.Maybe ObjectTypeEnum)
changeLog_objectType :: (Maybe ObjectTypeEnum -> f (Maybe ObjectTypeEnum))
-> ChangeLog -> f ChangeLog
changeLog_objectType = (ChangeLog -> Maybe ObjectTypeEnum)
-> (ChangeLog -> Maybe ObjectTypeEnum -> ChangeLog)
-> Lens
     ChangeLog ChangeLog (Maybe ObjectTypeEnum) (Maybe ObjectTypeEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeLog' {Maybe ObjectTypeEnum
objectType :: Maybe ObjectTypeEnum
$sel:objectType:ChangeLog' :: ChangeLog -> Maybe ObjectTypeEnum
objectType} -> Maybe ObjectTypeEnum
objectType) (\s :: ChangeLog
s@ChangeLog' {} Maybe ObjectTypeEnum
a -> ChangeLog
s {$sel:objectType:ChangeLog' :: Maybe ObjectTypeEnum
objectType = Maybe ObjectTypeEnum
a} :: ChangeLog)

-- | The IAM user or role that performed the action.
changeLog_createdBy :: Lens.Lens' ChangeLog (Prelude.Maybe Prelude.Text)
changeLog_createdBy :: (Maybe Text -> f (Maybe Text)) -> ChangeLog -> f ChangeLog
changeLog_createdBy = (ChangeLog -> Maybe Text)
-> (ChangeLog -> Maybe Text -> ChangeLog)
-> Lens ChangeLog ChangeLog (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeLog' {Maybe Text
createdBy :: Maybe Text
$sel:createdBy:ChangeLog' :: ChangeLog -> Maybe Text
createdBy} -> Maybe Text
createdBy) (\s :: ChangeLog
s@ChangeLog' {} Maybe Text
a -> ChangeLog
s {$sel:createdBy:ChangeLog' :: Maybe Text
createdBy = Maybe Text
a} :: ChangeLog)

-- | The action performed.
changeLog_action :: Lens.Lens' ChangeLog (Prelude.Maybe ActionEnum)
changeLog_action :: (Maybe ActionEnum -> f (Maybe ActionEnum))
-> ChangeLog -> f ChangeLog
changeLog_action = (ChangeLog -> Maybe ActionEnum)
-> (ChangeLog -> Maybe ActionEnum -> ChangeLog)
-> Lens ChangeLog ChangeLog (Maybe ActionEnum) (Maybe ActionEnum)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ChangeLog' {Maybe ActionEnum
action :: Maybe ActionEnum
$sel:action:ChangeLog' :: ChangeLog -> Maybe ActionEnum
action} -> Maybe ActionEnum
action) (\s :: ChangeLog
s@ChangeLog' {} Maybe ActionEnum
a -> ChangeLog
s {$sel:action:ChangeLog' :: Maybe ActionEnum
action = Maybe ActionEnum
a} :: ChangeLog)

instance Core.FromJSON ChangeLog where
  parseJSON :: Value -> Parser ChangeLog
parseJSON =
    String -> (Object -> Parser ChangeLog) -> Value -> Parser ChangeLog
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ChangeLog"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe ObjectTypeEnum
-> Maybe Text
-> Maybe ActionEnum
-> ChangeLog
ChangeLog'
            (Maybe Text
 -> Maybe POSIX
 -> Maybe ObjectTypeEnum
 -> Maybe Text
 -> Maybe ActionEnum
 -> ChangeLog)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe ObjectTypeEnum
      -> Maybe Text
      -> Maybe ActionEnum
      -> ChangeLog)
forall (f :: * -> *) a b. Functor 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
"objectName")
            Parser
  (Maybe POSIX
   -> Maybe ObjectTypeEnum
   -> Maybe Text
   -> Maybe ActionEnum
   -> ChangeLog)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ObjectTypeEnum
      -> Maybe Text -> Maybe ActionEnum -> ChangeLog)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdAt")
            Parser
  (Maybe ObjectTypeEnum
   -> Maybe Text -> Maybe ActionEnum -> ChangeLog)
-> Parser (Maybe ObjectTypeEnum)
-> Parser (Maybe Text -> Maybe ActionEnum -> ChangeLog)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ObjectTypeEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"objectType")
            Parser (Maybe Text -> Maybe ActionEnum -> ChangeLog)
-> Parser (Maybe Text) -> Parser (Maybe ActionEnum -> ChangeLog)
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
"createdBy")
            Parser (Maybe ActionEnum -> ChangeLog)
-> Parser (Maybe ActionEnum) -> Parser ChangeLog
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ActionEnum)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"action")
      )

instance Prelude.Hashable ChangeLog

instance Prelude.NFData ChangeLog