{-# 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.MwAA.Types.LastUpdate
-- 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.MwAA.Types.LastUpdate where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MwAA.Types.UpdateError
import Amazonka.MwAA.Types.UpdateStatus
import qualified Amazonka.Prelude as Prelude

-- | Describes the status of the last update on the environment, and any
-- errors that were encountered.
--
-- /See:/ 'newLastUpdate' smart constructor.
data LastUpdate = LastUpdate'
  { -- | The day and time of the last update on the environment.
    LastUpdate -> Maybe POSIX
createdAt :: Prelude.Maybe Data.POSIX,
    -- | The error that was encountered during the last update of the
    -- environment.
    LastUpdate -> Maybe UpdateError
error :: Prelude.Maybe UpdateError,
    -- | The source of the last update to the environment. Includes internal
    -- processes by Amazon MWAA, such as an environment maintenance update.
    LastUpdate -> Maybe Text
source :: Prelude.Maybe Prelude.Text,
    -- | The status of the last update on the environment.
    LastUpdate -> Maybe UpdateStatus
status :: Prelude.Maybe UpdateStatus
  }
  deriving (LastUpdate -> LastUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LastUpdate -> LastUpdate -> Bool
$c/= :: LastUpdate -> LastUpdate -> Bool
== :: LastUpdate -> LastUpdate -> Bool
$c== :: LastUpdate -> LastUpdate -> Bool
Prelude.Eq, ReadPrec [LastUpdate]
ReadPrec LastUpdate
Int -> ReadS LastUpdate
ReadS [LastUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LastUpdate]
$creadListPrec :: ReadPrec [LastUpdate]
readPrec :: ReadPrec LastUpdate
$creadPrec :: ReadPrec LastUpdate
readList :: ReadS [LastUpdate]
$creadList :: ReadS [LastUpdate]
readsPrec :: Int -> ReadS LastUpdate
$creadsPrec :: Int -> ReadS LastUpdate
Prelude.Read, Int -> LastUpdate -> ShowS
[LastUpdate] -> ShowS
LastUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LastUpdate] -> ShowS
$cshowList :: [LastUpdate] -> ShowS
show :: LastUpdate -> String
$cshow :: LastUpdate -> String
showsPrec :: Int -> LastUpdate -> ShowS
$cshowsPrec :: Int -> LastUpdate -> ShowS
Prelude.Show, forall x. Rep LastUpdate x -> LastUpdate
forall x. LastUpdate -> Rep LastUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LastUpdate x -> LastUpdate
$cfrom :: forall x. LastUpdate -> Rep LastUpdate x
Prelude.Generic)

-- |
-- Create a value of 'LastUpdate' 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:
--
-- 'createdAt', 'lastUpdate_createdAt' - The day and time of the last update on the environment.
--
-- 'error', 'lastUpdate_error' - The error that was encountered during the last update of the
-- environment.
--
-- 'source', 'lastUpdate_source' - The source of the last update to the environment. Includes internal
-- processes by Amazon MWAA, such as an environment maintenance update.
--
-- 'status', 'lastUpdate_status' - The status of the last update on the environment.
newLastUpdate ::
  LastUpdate
newLastUpdate :: LastUpdate
newLastUpdate =
  LastUpdate'
    { $sel:createdAt:LastUpdate' :: Maybe POSIX
createdAt = forall a. Maybe a
Prelude.Nothing,
      $sel:error:LastUpdate' :: Maybe UpdateError
error = forall a. Maybe a
Prelude.Nothing,
      $sel:source:LastUpdate' :: Maybe Text
source = forall a. Maybe a
Prelude.Nothing,
      $sel:status:LastUpdate' :: Maybe UpdateStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The day and time of the last update on the environment.
lastUpdate_createdAt :: Lens.Lens' LastUpdate (Prelude.Maybe Prelude.UTCTime)
lastUpdate_createdAt :: Lens' LastUpdate (Maybe UTCTime)
lastUpdate_createdAt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastUpdate' {Maybe POSIX
createdAt :: Maybe POSIX
$sel:createdAt:LastUpdate' :: LastUpdate -> Maybe POSIX
createdAt} -> Maybe POSIX
createdAt) (\s :: LastUpdate
s@LastUpdate' {} Maybe POSIX
a -> LastUpdate
s {$sel:createdAt:LastUpdate' :: Maybe POSIX
createdAt = Maybe POSIX
a} :: LastUpdate) 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 error that was encountered during the last update of the
-- environment.
lastUpdate_error :: Lens.Lens' LastUpdate (Prelude.Maybe UpdateError)
lastUpdate_error :: Lens' LastUpdate (Maybe UpdateError)
lastUpdate_error = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastUpdate' {Maybe UpdateError
error :: Maybe UpdateError
$sel:error:LastUpdate' :: LastUpdate -> Maybe UpdateError
error} -> Maybe UpdateError
error) (\s :: LastUpdate
s@LastUpdate' {} Maybe UpdateError
a -> LastUpdate
s {$sel:error:LastUpdate' :: Maybe UpdateError
error = Maybe UpdateError
a} :: LastUpdate)

-- | The source of the last update to the environment. Includes internal
-- processes by Amazon MWAA, such as an environment maintenance update.
lastUpdate_source :: Lens.Lens' LastUpdate (Prelude.Maybe Prelude.Text)
lastUpdate_source :: Lens' LastUpdate (Maybe Text)
lastUpdate_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastUpdate' {Maybe Text
source :: Maybe Text
$sel:source:LastUpdate' :: LastUpdate -> Maybe Text
source} -> Maybe Text
source) (\s :: LastUpdate
s@LastUpdate' {} Maybe Text
a -> LastUpdate
s {$sel:source:LastUpdate' :: Maybe Text
source = Maybe Text
a} :: LastUpdate)

-- | The status of the last update on the environment.
lastUpdate_status :: Lens.Lens' LastUpdate (Prelude.Maybe UpdateStatus)
lastUpdate_status :: Lens' LastUpdate (Maybe UpdateStatus)
lastUpdate_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LastUpdate' {Maybe UpdateStatus
status :: Maybe UpdateStatus
$sel:status:LastUpdate' :: LastUpdate -> Maybe UpdateStatus
status} -> Maybe UpdateStatus
status) (\s :: LastUpdate
s@LastUpdate' {} Maybe UpdateStatus
a -> LastUpdate
s {$sel:status:LastUpdate' :: Maybe UpdateStatus
status = Maybe UpdateStatus
a} :: LastUpdate)

instance Data.FromJSON LastUpdate where
  parseJSON :: Value -> Parser LastUpdate
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"LastUpdate"
      ( \Object
x ->
          Maybe POSIX
-> Maybe UpdateError
-> Maybe Text
-> Maybe UpdateStatus
-> LastUpdate
LastUpdate'
            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
"CreatedAt")
            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
"Error")
            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
"Source")
            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")
      )

instance Prelude.Hashable LastUpdate where
  hashWithSalt :: Int -> LastUpdate -> Int
hashWithSalt Int
_salt LastUpdate' {Maybe Text
Maybe POSIX
Maybe UpdateError
Maybe UpdateStatus
status :: Maybe UpdateStatus
source :: Maybe Text
error :: Maybe UpdateError
createdAt :: Maybe POSIX
$sel:status:LastUpdate' :: LastUpdate -> Maybe UpdateStatus
$sel:source:LastUpdate' :: LastUpdate -> Maybe Text
$sel:error:LastUpdate' :: LastUpdate -> Maybe UpdateError
$sel:createdAt:LastUpdate' :: LastUpdate -> Maybe POSIX
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdAt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateError
error
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
source
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe UpdateStatus
status

instance Prelude.NFData LastUpdate where
  rnf :: LastUpdate -> ()
rnf LastUpdate' {Maybe Text
Maybe POSIX
Maybe UpdateError
Maybe UpdateStatus
status :: Maybe UpdateStatus
source :: Maybe Text
error :: Maybe UpdateError
createdAt :: Maybe POSIX
$sel:status:LastUpdate' :: LastUpdate -> Maybe UpdateStatus
$sel:source:LastUpdate' :: LastUpdate -> Maybe Text
$sel:error:LastUpdate' :: LastUpdate -> Maybe UpdateError
$sel:createdAt:LastUpdate' :: LastUpdate -> Maybe POSIX
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdAt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateError
error
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
source
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe UpdateStatus
status