{-# 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.DirectoryService.Types.UpdateInfoEntry
-- 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.DirectoryService.Types.UpdateInfoEntry where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectoryService.Types.UpdateStatus
import Amazonka.DirectoryService.Types.UpdateValue
import qualified Amazonka.Prelude as Prelude

-- | An entry of update information related to a requested update type.
--
-- /See:/ 'newUpdateInfoEntry' smart constructor.
data UpdateInfoEntry = UpdateInfoEntry'
  { -- | This specifies if the update was initiated by the customer or by the
    -- service team.
    UpdateInfoEntry -> Maybe Text
initiatedBy :: Prelude.Maybe Prelude.Text,
    -- | The last updated date and time of a particular directory setting.
    UpdateInfoEntry -> Maybe POSIX
lastUpdatedDateTime :: Prelude.Maybe Data.POSIX,
    -- | The new value of the target setting.
    UpdateInfoEntry -> Maybe UpdateValue
newValue' :: Prelude.Maybe UpdateValue,
    -- | The old value of the target setting.
    UpdateInfoEntry -> Maybe UpdateValue
previousValue :: Prelude.Maybe UpdateValue,
    -- | The name of the Region.
    UpdateInfoEntry -> Maybe Text
region :: Prelude.Maybe Prelude.Text,
    -- | The start time of the @UpdateDirectorySetup@ for the particular type.
    UpdateInfoEntry -> Maybe POSIX
startTime :: Prelude.Maybe Data.POSIX,
    -- | The status of the update performed on the directory.
    UpdateInfoEntry -> Maybe UpdateStatus
status :: Prelude.Maybe UpdateStatus,
    -- | The reason for the current status of the update type activity.
    UpdateInfoEntry -> Maybe Text
statusReason :: Prelude.Maybe Prelude.Text
  }
  deriving (UpdateInfoEntry -> UpdateInfoEntry -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInfoEntry -> UpdateInfoEntry -> Bool
$c/= :: UpdateInfoEntry -> UpdateInfoEntry -> Bool
== :: UpdateInfoEntry -> UpdateInfoEntry -> Bool
$c== :: UpdateInfoEntry -> UpdateInfoEntry -> Bool
Prelude.Eq, ReadPrec [UpdateInfoEntry]
ReadPrec UpdateInfoEntry
Int -> ReadS UpdateInfoEntry
ReadS [UpdateInfoEntry]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInfoEntry]
$creadListPrec :: ReadPrec [UpdateInfoEntry]
readPrec :: ReadPrec UpdateInfoEntry
$creadPrec :: ReadPrec UpdateInfoEntry
readList :: ReadS [UpdateInfoEntry]
$creadList :: ReadS [UpdateInfoEntry]
readsPrec :: Int -> ReadS UpdateInfoEntry
$creadsPrec :: Int -> ReadS UpdateInfoEntry
Prelude.Read, Int -> UpdateInfoEntry -> ShowS
[UpdateInfoEntry] -> ShowS
UpdateInfoEntry -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInfoEntry] -> ShowS
$cshowList :: [UpdateInfoEntry] -> ShowS
show :: UpdateInfoEntry -> String
$cshow :: UpdateInfoEntry -> String
showsPrec :: Int -> UpdateInfoEntry -> ShowS
$cshowsPrec :: Int -> UpdateInfoEntry -> ShowS
Prelude.Show, forall x. Rep UpdateInfoEntry x -> UpdateInfoEntry
forall x. UpdateInfoEntry -> Rep UpdateInfoEntry x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateInfoEntry x -> UpdateInfoEntry
$cfrom :: forall x. UpdateInfoEntry -> Rep UpdateInfoEntry x
Prelude.Generic)

-- |
-- Create a value of 'UpdateInfoEntry' 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:
--
-- 'initiatedBy', 'updateInfoEntry_initiatedBy' - This specifies if the update was initiated by the customer or by the
-- service team.
--
-- 'lastUpdatedDateTime', 'updateInfoEntry_lastUpdatedDateTime' - The last updated date and time of a particular directory setting.
--
-- 'newValue'', 'updateInfoEntry_newValue' - The new value of the target setting.
--
-- 'previousValue', 'updateInfoEntry_previousValue' - The old value of the target setting.
--
-- 'region', 'updateInfoEntry_region' - The name of the Region.
--
-- 'startTime', 'updateInfoEntry_startTime' - The start time of the @UpdateDirectorySetup@ for the particular type.
--
-- 'status', 'updateInfoEntry_status' - The status of the update performed on the directory.
--
-- 'statusReason', 'updateInfoEntry_statusReason' - The reason for the current status of the update type activity.
newUpdateInfoEntry ::
  UpdateInfoEntry
newUpdateInfoEntry :: UpdateInfoEntry
newUpdateInfoEntry =
  UpdateInfoEntry'
    { $sel:initiatedBy:UpdateInfoEntry' :: Maybe Text
initiatedBy = forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedDateTime:UpdateInfoEntry' :: Maybe POSIX
lastUpdatedDateTime = forall a. Maybe a
Prelude.Nothing,
      $sel:newValue':UpdateInfoEntry' :: Maybe UpdateValue
newValue' = forall a. Maybe a
Prelude.Nothing,
      $sel:previousValue:UpdateInfoEntry' :: Maybe UpdateValue
previousValue = forall a. Maybe a
Prelude.Nothing,
      $sel:region:UpdateInfoEntry' :: Maybe Text
region = forall a. Maybe a
Prelude.Nothing,
      $sel:startTime:UpdateInfoEntry' :: Maybe POSIX
startTime = forall a. Maybe a
Prelude.Nothing,
      $sel:status:UpdateInfoEntry' :: Maybe UpdateStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusReason:UpdateInfoEntry' :: Maybe Text
statusReason = forall a. Maybe a
Prelude.Nothing
    }

-- | This specifies if the update was initiated by the customer or by the
-- service team.
updateInfoEntry_initiatedBy :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe Prelude.Text)
updateInfoEntry_initiatedBy :: Lens' UpdateInfoEntry (Maybe Text)
updateInfoEntry_initiatedBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe Text
initiatedBy :: Maybe Text
$sel:initiatedBy:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
initiatedBy} -> Maybe Text
initiatedBy) (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe Text
a -> UpdateInfoEntry
s {$sel:initiatedBy:UpdateInfoEntry' :: Maybe Text
initiatedBy = Maybe Text
a} :: UpdateInfoEntry)

-- | The last updated date and time of a particular directory setting.
updateInfoEntry_lastUpdatedDateTime :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe Prelude.UTCTime)
updateInfoEntry_lastUpdatedDateTime :: Lens' UpdateInfoEntry (Maybe UTCTime)
updateInfoEntry_lastUpdatedDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe POSIX
lastUpdatedDateTime :: Maybe POSIX
$sel:lastUpdatedDateTime:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe POSIX
lastUpdatedDateTime} -> Maybe POSIX
lastUpdatedDateTime) (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe POSIX
a -> UpdateInfoEntry
s {$sel:lastUpdatedDateTime:UpdateInfoEntry' :: Maybe POSIX
lastUpdatedDateTime = Maybe POSIX
a} :: UpdateInfoEntry) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The new value of the target setting.
updateInfoEntry_newValue :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe UpdateValue)
updateInfoEntry_newValue :: Lens' UpdateInfoEntry (Maybe UpdateValue)
updateInfoEntry_newValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe UpdateValue
newValue' :: Maybe UpdateValue
$sel:newValue':UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateValue
newValue'} -> Maybe UpdateValue
newValue') (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe UpdateValue
a -> UpdateInfoEntry
s {$sel:newValue':UpdateInfoEntry' :: Maybe UpdateValue
newValue' = Maybe UpdateValue
a} :: UpdateInfoEntry)

-- | The old value of the target setting.
updateInfoEntry_previousValue :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe UpdateValue)
updateInfoEntry_previousValue :: Lens' UpdateInfoEntry (Maybe UpdateValue)
updateInfoEntry_previousValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe UpdateValue
previousValue :: Maybe UpdateValue
$sel:previousValue:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateValue
previousValue} -> Maybe UpdateValue
previousValue) (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe UpdateValue
a -> UpdateInfoEntry
s {$sel:previousValue:UpdateInfoEntry' :: Maybe UpdateValue
previousValue = Maybe UpdateValue
a} :: UpdateInfoEntry)

-- | The name of the Region.
updateInfoEntry_region :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe Prelude.Text)
updateInfoEntry_region :: Lens' UpdateInfoEntry (Maybe Text)
updateInfoEntry_region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe Text
region :: Maybe Text
$sel:region:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
region} -> Maybe Text
region) (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe Text
a -> UpdateInfoEntry
s {$sel:region:UpdateInfoEntry' :: Maybe Text
region = Maybe Text
a} :: UpdateInfoEntry)

-- | The start time of the @UpdateDirectorySetup@ for the particular type.
updateInfoEntry_startTime :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe Prelude.UTCTime)
updateInfoEntry_startTime :: Lens' UpdateInfoEntry (Maybe UTCTime)
updateInfoEntry_startTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe POSIX
a -> UpdateInfoEntry
s {$sel:startTime:UpdateInfoEntry' :: Maybe POSIX
startTime = Maybe POSIX
a} :: UpdateInfoEntry) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The status of the update performed on the directory.
updateInfoEntry_status :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe UpdateStatus)
updateInfoEntry_status :: Lens' UpdateInfoEntry (Maybe UpdateStatus)
updateInfoEntry_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe UpdateStatus
status :: Maybe UpdateStatus
$sel:status:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateStatus
status} -> Maybe UpdateStatus
status) (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe UpdateStatus
a -> UpdateInfoEntry
s {$sel:status:UpdateInfoEntry' :: Maybe UpdateStatus
status = Maybe UpdateStatus
a} :: UpdateInfoEntry)

-- | The reason for the current status of the update type activity.
updateInfoEntry_statusReason :: Lens.Lens' UpdateInfoEntry (Prelude.Maybe Prelude.Text)
updateInfoEntry_statusReason :: Lens' UpdateInfoEntry (Maybe Text)
updateInfoEntry_statusReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInfoEntry' {Maybe Text
statusReason :: Maybe Text
$sel:statusReason:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
statusReason} -> Maybe Text
statusReason) (\s :: UpdateInfoEntry
s@UpdateInfoEntry' {} Maybe Text
a -> UpdateInfoEntry
s {$sel:statusReason:UpdateInfoEntry' :: Maybe Text
statusReason = Maybe Text
a} :: UpdateInfoEntry)

instance Data.FromJSON UpdateInfoEntry where
  parseJSON :: Value -> Parser UpdateInfoEntry
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"UpdateInfoEntry"
      ( \Object
x ->
          Maybe Text
-> Maybe POSIX
-> Maybe UpdateValue
-> Maybe UpdateValue
-> Maybe Text
-> Maybe POSIX
-> Maybe UpdateStatus
-> Maybe Text
-> UpdateInfoEntry
UpdateInfoEntry'
            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
"InitiatedBy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"LastUpdatedDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"NewValue")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"PreviousValue")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Region")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StartTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StatusReason")
      )

instance Prelude.Hashable UpdateInfoEntry where
  hashWithSalt :: Int -> UpdateInfoEntry -> Int
hashWithSalt Int
_salt UpdateInfoEntry' {Maybe Text
Maybe POSIX
Maybe UpdateStatus
Maybe UpdateValue
statusReason :: Maybe Text
status :: Maybe UpdateStatus
startTime :: Maybe POSIX
region :: Maybe Text
previousValue :: Maybe UpdateValue
newValue' :: Maybe UpdateValue
lastUpdatedDateTime :: Maybe POSIX
initiatedBy :: Maybe Text
$sel:statusReason:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
$sel:status:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateStatus
$sel:startTime:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe POSIX
$sel:region:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
$sel:previousValue:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateValue
$sel:newValue':UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateValue
$sel:lastUpdatedDateTime:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe POSIX
$sel:initiatedBy:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
initiatedBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
lastUpdatedDateTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateValue
newValue'
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateValue
previousValue
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
region
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
startTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusReason

instance Prelude.NFData UpdateInfoEntry where
  rnf :: UpdateInfoEntry -> ()
rnf UpdateInfoEntry' {Maybe Text
Maybe POSIX
Maybe UpdateStatus
Maybe UpdateValue
statusReason :: Maybe Text
status :: Maybe UpdateStatus
startTime :: Maybe POSIX
region :: Maybe Text
previousValue :: Maybe UpdateValue
newValue' :: Maybe UpdateValue
lastUpdatedDateTime :: Maybe POSIX
initiatedBy :: Maybe Text
$sel:statusReason:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
$sel:status:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateStatus
$sel:startTime:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe POSIX
$sel:region:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
$sel:previousValue:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateValue
$sel:newValue':UpdateInfoEntry' :: UpdateInfoEntry -> Maybe UpdateValue
$sel:lastUpdatedDateTime:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe POSIX
$sel:initiatedBy:UpdateInfoEntry' :: UpdateInfoEntry -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
initiatedBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastUpdatedDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateValue
newValue'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateValue
previousValue
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
region
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
startTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusReason