{-# 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.CloudFormation.Types.StackDriftInformation
-- 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.CloudFormation.Types.StackDriftInformation where

import Amazonka.CloudFormation.Types.StackDriftStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about whether the stack\'s actual configuration
-- differs, or has /drifted/, from its expected configuration, as defined
-- in the stack template and any values specified as template parameters. A
-- stack is considered to have drifted if one or more of its resources have
-- drifted.
--
-- /See:/ 'newStackDriftInformation' smart constructor.
data StackDriftInformation = StackDriftInformation'
  { -- | Most recent time when a drift detection operation was initiated on the
    -- stack, or any of its individual resources that support drift detection.
    StackDriftInformation -> Maybe ISO8601
lastCheckTimestamp :: Prelude.Maybe Core.ISO8601,
    -- | Status of the stack\'s actual configuration compared to its expected
    -- template configuration.
    --
    -- -   @DRIFTED@: The stack differs from its expected template
    --     configuration. A stack is considered to have drifted if one or more
    --     of its resources have drifted.
    --
    -- -   @NOT_CHECKED@: CloudFormation has not checked if the stack differs
    --     from its expected template configuration.
    --
    -- -   @IN_SYNC@: The stack\'s actual configuration matches its expected
    --     template configuration.
    --
    -- -   @UNKNOWN@: This value is reserved for future use.
    StackDriftInformation -> StackDriftStatus
stackDriftStatus :: StackDriftStatus
  }
  deriving (StackDriftInformation -> StackDriftInformation -> Bool
(StackDriftInformation -> StackDriftInformation -> Bool)
-> (StackDriftInformation -> StackDriftInformation -> Bool)
-> Eq StackDriftInformation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackDriftInformation -> StackDriftInformation -> Bool
$c/= :: StackDriftInformation -> StackDriftInformation -> Bool
== :: StackDriftInformation -> StackDriftInformation -> Bool
$c== :: StackDriftInformation -> StackDriftInformation -> Bool
Prelude.Eq, ReadPrec [StackDriftInformation]
ReadPrec StackDriftInformation
Int -> ReadS StackDriftInformation
ReadS [StackDriftInformation]
(Int -> ReadS StackDriftInformation)
-> ReadS [StackDriftInformation]
-> ReadPrec StackDriftInformation
-> ReadPrec [StackDriftInformation]
-> Read StackDriftInformation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackDriftInformation]
$creadListPrec :: ReadPrec [StackDriftInformation]
readPrec :: ReadPrec StackDriftInformation
$creadPrec :: ReadPrec StackDriftInformation
readList :: ReadS [StackDriftInformation]
$creadList :: ReadS [StackDriftInformation]
readsPrec :: Int -> ReadS StackDriftInformation
$creadsPrec :: Int -> ReadS StackDriftInformation
Prelude.Read, Int -> StackDriftInformation -> ShowS
[StackDriftInformation] -> ShowS
StackDriftInformation -> String
(Int -> StackDriftInformation -> ShowS)
-> (StackDriftInformation -> String)
-> ([StackDriftInformation] -> ShowS)
-> Show StackDriftInformation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackDriftInformation] -> ShowS
$cshowList :: [StackDriftInformation] -> ShowS
show :: StackDriftInformation -> String
$cshow :: StackDriftInformation -> String
showsPrec :: Int -> StackDriftInformation -> ShowS
$cshowsPrec :: Int -> StackDriftInformation -> ShowS
Prelude.Show, (forall x. StackDriftInformation -> Rep StackDriftInformation x)
-> (forall x. Rep StackDriftInformation x -> StackDriftInformation)
-> Generic StackDriftInformation
forall x. Rep StackDriftInformation x -> StackDriftInformation
forall x. StackDriftInformation -> Rep StackDriftInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StackDriftInformation x -> StackDriftInformation
$cfrom :: forall x. StackDriftInformation -> Rep StackDriftInformation x
Prelude.Generic)

-- |
-- Create a value of 'StackDriftInformation' 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:
--
-- 'lastCheckTimestamp', 'stackDriftInformation_lastCheckTimestamp' - Most recent time when a drift detection operation was initiated on the
-- stack, or any of its individual resources that support drift detection.
--
-- 'stackDriftStatus', 'stackDriftInformation_stackDriftStatus' - Status of the stack\'s actual configuration compared to its expected
-- template configuration.
--
-- -   @DRIFTED@: The stack differs from its expected template
--     configuration. A stack is considered to have drifted if one or more
--     of its resources have drifted.
--
-- -   @NOT_CHECKED@: CloudFormation has not checked if the stack differs
--     from its expected template configuration.
--
-- -   @IN_SYNC@: The stack\'s actual configuration matches its expected
--     template configuration.
--
-- -   @UNKNOWN@: This value is reserved for future use.
newStackDriftInformation ::
  -- | 'stackDriftStatus'
  StackDriftStatus ->
  StackDriftInformation
newStackDriftInformation :: StackDriftStatus -> StackDriftInformation
newStackDriftInformation StackDriftStatus
pStackDriftStatus_ =
  StackDriftInformation' :: Maybe ISO8601 -> StackDriftStatus -> StackDriftInformation
StackDriftInformation'
    { $sel:lastCheckTimestamp:StackDriftInformation' :: Maybe ISO8601
lastCheckTimestamp =
        Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:stackDriftStatus:StackDriftInformation' :: StackDriftStatus
stackDriftStatus = StackDriftStatus
pStackDriftStatus_
    }

-- | Most recent time when a drift detection operation was initiated on the
-- stack, or any of its individual resources that support drift detection.
stackDriftInformation_lastCheckTimestamp :: Lens.Lens' StackDriftInformation (Prelude.Maybe Prelude.UTCTime)
stackDriftInformation_lastCheckTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StackDriftInformation -> f StackDriftInformation
stackDriftInformation_lastCheckTimestamp = (StackDriftInformation -> Maybe ISO8601)
-> (StackDriftInformation
    -> Maybe ISO8601 -> StackDriftInformation)
-> Lens
     StackDriftInformation
     StackDriftInformation
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackDriftInformation' {Maybe ISO8601
lastCheckTimestamp :: Maybe ISO8601
$sel:lastCheckTimestamp:StackDriftInformation' :: StackDriftInformation -> Maybe ISO8601
lastCheckTimestamp} -> Maybe ISO8601
lastCheckTimestamp) (\s :: StackDriftInformation
s@StackDriftInformation' {} Maybe ISO8601
a -> StackDriftInformation
s {$sel:lastCheckTimestamp:StackDriftInformation' :: Maybe ISO8601
lastCheckTimestamp = Maybe ISO8601
a} :: StackDriftInformation) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> StackDriftInformation -> f StackDriftInformation)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StackDriftInformation
-> f StackDriftInformation
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | Status of the stack\'s actual configuration compared to its expected
-- template configuration.
--
-- -   @DRIFTED@: The stack differs from its expected template
--     configuration. A stack is considered to have drifted if one or more
--     of its resources have drifted.
--
-- -   @NOT_CHECKED@: CloudFormation has not checked if the stack differs
--     from its expected template configuration.
--
-- -   @IN_SYNC@: The stack\'s actual configuration matches its expected
--     template configuration.
--
-- -   @UNKNOWN@: This value is reserved for future use.
stackDriftInformation_stackDriftStatus :: Lens.Lens' StackDriftInformation StackDriftStatus
stackDriftInformation_stackDriftStatus :: (StackDriftStatus -> f StackDriftStatus)
-> StackDriftInformation -> f StackDriftInformation
stackDriftInformation_stackDriftStatus = (StackDriftInformation -> StackDriftStatus)
-> (StackDriftInformation
    -> StackDriftStatus -> StackDriftInformation)
-> Lens
     StackDriftInformation
     StackDriftInformation
     StackDriftStatus
     StackDriftStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackDriftInformation' {StackDriftStatus
stackDriftStatus :: StackDriftStatus
$sel:stackDriftStatus:StackDriftInformation' :: StackDriftInformation -> StackDriftStatus
stackDriftStatus} -> StackDriftStatus
stackDriftStatus) (\s :: StackDriftInformation
s@StackDriftInformation' {} StackDriftStatus
a -> StackDriftInformation
s {$sel:stackDriftStatus:StackDriftInformation' :: StackDriftStatus
stackDriftStatus = StackDriftStatus
a} :: StackDriftInformation)

instance Core.FromXML StackDriftInformation where
  parseXML :: [Node] -> Either String StackDriftInformation
parseXML [Node]
x =
    Maybe ISO8601 -> StackDriftStatus -> StackDriftInformation
StackDriftInformation'
      (Maybe ISO8601 -> StackDriftStatus -> StackDriftInformation)
-> Either String (Maybe ISO8601)
-> Either String (StackDriftStatus -> StackDriftInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"LastCheckTimestamp")
      Either String (StackDriftStatus -> StackDriftInformation)
-> Either String StackDriftStatus
-> Either String StackDriftInformation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String StackDriftStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"StackDriftStatus")

instance Prelude.Hashable StackDriftInformation

instance Prelude.NFData StackDriftInformation