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

import Amazonka.CloudFormation.Types.StackDriftStatus
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

-- | 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:/ 'newStackDriftInformationSummary' smart constructor.
data StackDriftInformationSummary = StackDriftInformationSummary'
  { -- | Most recent time when a drift detection operation was initiated on the
    -- stack, or any of its individual resources that support drift detection.
    StackDriftInformationSummary -> Maybe ISO8601
lastCheckTimestamp :: Prelude.Maybe Data.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 hasn\'t 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.
    StackDriftInformationSummary -> StackDriftStatus
stackDriftStatus :: StackDriftStatus
  }
  deriving (StackDriftInformationSummary
-> StackDriftInformationSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackDriftInformationSummary
-> StackDriftInformationSummary -> Bool
$c/= :: StackDriftInformationSummary
-> StackDriftInformationSummary -> Bool
== :: StackDriftInformationSummary
-> StackDriftInformationSummary -> Bool
$c== :: StackDriftInformationSummary
-> StackDriftInformationSummary -> Bool
Prelude.Eq, ReadPrec [StackDriftInformationSummary]
ReadPrec StackDriftInformationSummary
Int -> ReadS StackDriftInformationSummary
ReadS [StackDriftInformationSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackDriftInformationSummary]
$creadListPrec :: ReadPrec [StackDriftInformationSummary]
readPrec :: ReadPrec StackDriftInformationSummary
$creadPrec :: ReadPrec StackDriftInformationSummary
readList :: ReadS [StackDriftInformationSummary]
$creadList :: ReadS [StackDriftInformationSummary]
readsPrec :: Int -> ReadS StackDriftInformationSummary
$creadsPrec :: Int -> ReadS StackDriftInformationSummary
Prelude.Read, Int -> StackDriftInformationSummary -> ShowS
[StackDriftInformationSummary] -> ShowS
StackDriftInformationSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackDriftInformationSummary] -> ShowS
$cshowList :: [StackDriftInformationSummary] -> ShowS
show :: StackDriftInformationSummary -> String
$cshow :: StackDriftInformationSummary -> String
showsPrec :: Int -> StackDriftInformationSummary -> ShowS
$cshowsPrec :: Int -> StackDriftInformationSummary -> ShowS
Prelude.Show, forall x.
Rep StackDriftInformationSummary x -> StackDriftInformationSummary
forall x.
StackDriftInformationSummary -> Rep StackDriftInformationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StackDriftInformationSummary x -> StackDriftInformationSummary
$cfrom :: forall x.
StackDriftInformationSummary -> Rep StackDriftInformationSummary x
Prelude.Generic)

-- |
-- Create a value of 'StackDriftInformationSummary' 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', 'stackDriftInformationSummary_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', 'stackDriftInformationSummary_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 hasn\'t 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.
newStackDriftInformationSummary ::
  -- | 'stackDriftStatus'
  StackDriftStatus ->
  StackDriftInformationSummary
newStackDriftInformationSummary :: StackDriftStatus -> StackDriftInformationSummary
newStackDriftInformationSummary StackDriftStatus
pStackDriftStatus_ =
  StackDriftInformationSummary'
    { $sel:lastCheckTimestamp:StackDriftInformationSummary' :: Maybe ISO8601
lastCheckTimestamp =
        forall a. Maybe a
Prelude.Nothing,
      $sel:stackDriftStatus:StackDriftInformationSummary' :: 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.
stackDriftInformationSummary_lastCheckTimestamp :: Lens.Lens' StackDriftInformationSummary (Prelude.Maybe Prelude.UTCTime)
stackDriftInformationSummary_lastCheckTimestamp :: Lens' StackDriftInformationSummary (Maybe UTCTime)
stackDriftInformationSummary_lastCheckTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackDriftInformationSummary' {Maybe ISO8601
lastCheckTimestamp :: Maybe ISO8601
$sel:lastCheckTimestamp:StackDriftInformationSummary' :: StackDriftInformationSummary -> Maybe ISO8601
lastCheckTimestamp} -> Maybe ISO8601
lastCheckTimestamp) (\s :: StackDriftInformationSummary
s@StackDriftInformationSummary' {} Maybe ISO8601
a -> StackDriftInformationSummary
s {$sel:lastCheckTimestamp:StackDriftInformationSummary' :: Maybe ISO8601
lastCheckTimestamp = Maybe ISO8601
a} :: StackDriftInformationSummary) 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

-- | 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 hasn\'t 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.
stackDriftInformationSummary_stackDriftStatus :: Lens.Lens' StackDriftInformationSummary StackDriftStatus
stackDriftInformationSummary_stackDriftStatus :: Lens' StackDriftInformationSummary StackDriftStatus
stackDriftInformationSummary_stackDriftStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackDriftInformationSummary' {StackDriftStatus
stackDriftStatus :: StackDriftStatus
$sel:stackDriftStatus:StackDriftInformationSummary' :: StackDriftInformationSummary -> StackDriftStatus
stackDriftStatus} -> StackDriftStatus
stackDriftStatus) (\s :: StackDriftInformationSummary
s@StackDriftInformationSummary' {} StackDriftStatus
a -> StackDriftInformationSummary
s {$sel:stackDriftStatus:StackDriftInformationSummary' :: StackDriftStatus
stackDriftStatus = StackDriftStatus
a} :: StackDriftInformationSummary)

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

instance
  Prelude.Hashable
    StackDriftInformationSummary
  where
  hashWithSalt :: Int -> StackDriftInformationSummary -> Int
hashWithSalt Int
_salt StackDriftInformationSummary' {Maybe ISO8601
StackDriftStatus
stackDriftStatus :: StackDriftStatus
lastCheckTimestamp :: Maybe ISO8601
$sel:stackDriftStatus:StackDriftInformationSummary' :: StackDriftInformationSummary -> StackDriftStatus
$sel:lastCheckTimestamp:StackDriftInformationSummary' :: StackDriftInformationSummary -> Maybe ISO8601
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
lastCheckTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` StackDriftStatus
stackDriftStatus

instance Prelude.NFData StackDriftInformationSummary where
  rnf :: StackDriftInformationSummary -> ()
rnf StackDriftInformationSummary' {Maybe ISO8601
StackDriftStatus
stackDriftStatus :: StackDriftStatus
lastCheckTimestamp :: Maybe ISO8601
$sel:stackDriftStatus:StackDriftInformationSummary' :: StackDriftInformationSummary -> StackDriftStatus
$sel:lastCheckTimestamp:StackDriftInformationSummary' :: StackDriftInformationSummary -> Maybe ISO8601
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
lastCheckTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StackDriftStatus
stackDriftStatus