{-# 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.StackResourceDriftInformationSummary
-- 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.StackResourceDriftInformationSummary where

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

-- | Summarizes information about whether the resource\'s actual
-- configuration differs, or has /drifted/, from its expected
-- configuration.
--
-- /See:/ 'newStackResourceDriftInformationSummary' smart constructor.
data StackResourceDriftInformationSummary = StackResourceDriftInformationSummary'
  { -- | When CloudFormation last checked if the resource had drifted from its
    -- expected configuration.
    StackResourceDriftInformationSummary -> Maybe ISO8601
lastCheckTimestamp :: Prelude.Maybe Core.ISO8601,
    -- | Status of the resource\'s actual configuration compared to its expected
    -- configuration
    --
    -- -   @DELETED@: The resource differs from its expected configuration in
    --     that it has been deleted.
    --
    -- -   @MODIFIED@: The resource differs from its expected configuration.
    --
    -- -   @NOT_CHECKED@: CloudFormation has not checked if the resource
    --     differs from its expected configuration.
    --
    --     Any resources that do not currently support drift detection have a
    --     status of @NOT_CHECKED@. For more information, see
    --     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html Resources that Support Drift Detection>.
    --     If you performed an ContinueUpdateRollback operation on a stack, any
    --     resources included in @ResourcesToSkip@ will also have a status of
    --     @NOT_CHECKED@. For more information on skipping resources during
    --     rollback operations, see
    --     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-continueupdaterollback.html Continue Rolling Back an Update>
    --     in the CloudFormation User Guide.
    --
    -- -   @IN_SYNC@: The resources\'s actual configuration matches its
    --     expected configuration.
    StackResourceDriftInformationSummary -> StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
  }
  deriving (StackResourceDriftInformationSummary
-> StackResourceDriftInformationSummary -> Bool
(StackResourceDriftInformationSummary
 -> StackResourceDriftInformationSummary -> Bool)
-> (StackResourceDriftInformationSummary
    -> StackResourceDriftInformationSummary -> Bool)
-> Eq StackResourceDriftInformationSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackResourceDriftInformationSummary
-> StackResourceDriftInformationSummary -> Bool
$c/= :: StackResourceDriftInformationSummary
-> StackResourceDriftInformationSummary -> Bool
== :: StackResourceDriftInformationSummary
-> StackResourceDriftInformationSummary -> Bool
$c== :: StackResourceDriftInformationSummary
-> StackResourceDriftInformationSummary -> Bool
Prelude.Eq, ReadPrec [StackResourceDriftInformationSummary]
ReadPrec StackResourceDriftInformationSummary
Int -> ReadS StackResourceDriftInformationSummary
ReadS [StackResourceDriftInformationSummary]
(Int -> ReadS StackResourceDriftInformationSummary)
-> ReadS [StackResourceDriftInformationSummary]
-> ReadPrec StackResourceDriftInformationSummary
-> ReadPrec [StackResourceDriftInformationSummary]
-> Read StackResourceDriftInformationSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackResourceDriftInformationSummary]
$creadListPrec :: ReadPrec [StackResourceDriftInformationSummary]
readPrec :: ReadPrec StackResourceDriftInformationSummary
$creadPrec :: ReadPrec StackResourceDriftInformationSummary
readList :: ReadS [StackResourceDriftInformationSummary]
$creadList :: ReadS [StackResourceDriftInformationSummary]
readsPrec :: Int -> ReadS StackResourceDriftInformationSummary
$creadsPrec :: Int -> ReadS StackResourceDriftInformationSummary
Prelude.Read, Int -> StackResourceDriftInformationSummary -> ShowS
[StackResourceDriftInformationSummary] -> ShowS
StackResourceDriftInformationSummary -> String
(Int -> StackResourceDriftInformationSummary -> ShowS)
-> (StackResourceDriftInformationSummary -> String)
-> ([StackResourceDriftInformationSummary] -> ShowS)
-> Show StackResourceDriftInformationSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackResourceDriftInformationSummary] -> ShowS
$cshowList :: [StackResourceDriftInformationSummary] -> ShowS
show :: StackResourceDriftInformationSummary -> String
$cshow :: StackResourceDriftInformationSummary -> String
showsPrec :: Int -> StackResourceDriftInformationSummary -> ShowS
$cshowsPrec :: Int -> StackResourceDriftInformationSummary -> ShowS
Prelude.Show, (forall x.
 StackResourceDriftInformationSummary
 -> Rep StackResourceDriftInformationSummary x)
-> (forall x.
    Rep StackResourceDriftInformationSummary x
    -> StackResourceDriftInformationSummary)
-> Generic StackResourceDriftInformationSummary
forall x.
Rep StackResourceDriftInformationSummary x
-> StackResourceDriftInformationSummary
forall x.
StackResourceDriftInformationSummary
-> Rep StackResourceDriftInformationSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StackResourceDriftInformationSummary x
-> StackResourceDriftInformationSummary
$cfrom :: forall x.
StackResourceDriftInformationSummary
-> Rep StackResourceDriftInformationSummary x
Prelude.Generic)

-- |
-- Create a value of 'StackResourceDriftInformationSummary' 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', 'stackResourceDriftInformationSummary_lastCheckTimestamp' - When CloudFormation last checked if the resource had drifted from its
-- expected configuration.
--
-- 'stackResourceDriftStatus', 'stackResourceDriftInformationSummary_stackResourceDriftStatus' - Status of the resource\'s actual configuration compared to its expected
-- configuration
--
-- -   @DELETED@: The resource differs from its expected configuration in
--     that it has been deleted.
--
-- -   @MODIFIED@: The resource differs from its expected configuration.
--
-- -   @NOT_CHECKED@: CloudFormation has not checked if the resource
--     differs from its expected configuration.
--
--     Any resources that do not currently support drift detection have a
--     status of @NOT_CHECKED@. For more information, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html Resources that Support Drift Detection>.
--     If you performed an ContinueUpdateRollback operation on a stack, any
--     resources included in @ResourcesToSkip@ will also have a status of
--     @NOT_CHECKED@. For more information on skipping resources during
--     rollback operations, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-continueupdaterollback.html Continue Rolling Back an Update>
--     in the CloudFormation User Guide.
--
-- -   @IN_SYNC@: The resources\'s actual configuration matches its
--     expected configuration.
newStackResourceDriftInformationSummary ::
  -- | 'stackResourceDriftStatus'
  StackResourceDriftStatus ->
  StackResourceDriftInformationSummary
newStackResourceDriftInformationSummary :: StackResourceDriftStatus -> StackResourceDriftInformationSummary
newStackResourceDriftInformationSummary
  StackResourceDriftStatus
pStackResourceDriftStatus_ =
    StackResourceDriftInformationSummary' :: Maybe ISO8601
-> StackResourceDriftStatus -> StackResourceDriftInformationSummary
StackResourceDriftInformationSummary'
      { $sel:lastCheckTimestamp:StackResourceDriftInformationSummary' :: Maybe ISO8601
lastCheckTimestamp =
          Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
        $sel:stackResourceDriftStatus:StackResourceDriftInformationSummary' :: StackResourceDriftStatus
stackResourceDriftStatus =
          StackResourceDriftStatus
pStackResourceDriftStatus_
      }

-- | When CloudFormation last checked if the resource had drifted from its
-- expected configuration.
stackResourceDriftInformationSummary_lastCheckTimestamp :: Lens.Lens' StackResourceDriftInformationSummary (Prelude.Maybe Prelude.UTCTime)
stackResourceDriftInformationSummary_lastCheckTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> StackResourceDriftInformationSummary
-> f StackResourceDriftInformationSummary
stackResourceDriftInformationSummary_lastCheckTimestamp = (StackResourceDriftInformationSummary -> Maybe ISO8601)
-> (StackResourceDriftInformationSummary
    -> Maybe ISO8601 -> StackResourceDriftInformationSummary)
-> Lens
     StackResourceDriftInformationSummary
     StackResourceDriftInformationSummary
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDriftInformationSummary' {Maybe ISO8601
lastCheckTimestamp :: Maybe ISO8601
$sel:lastCheckTimestamp:StackResourceDriftInformationSummary' :: StackResourceDriftInformationSummary -> Maybe ISO8601
lastCheckTimestamp} -> Maybe ISO8601
lastCheckTimestamp) (\s :: StackResourceDriftInformationSummary
s@StackResourceDriftInformationSummary' {} Maybe ISO8601
a -> StackResourceDriftInformationSummary
s {$sel:lastCheckTimestamp:StackResourceDriftInformationSummary' :: Maybe ISO8601
lastCheckTimestamp = Maybe ISO8601
a} :: StackResourceDriftInformationSummary) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> StackResourceDriftInformationSummary
 -> f StackResourceDriftInformationSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> StackResourceDriftInformationSummary
-> f StackResourceDriftInformationSummary
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 resource\'s actual configuration compared to its expected
-- configuration
--
-- -   @DELETED@: The resource differs from its expected configuration in
--     that it has been deleted.
--
-- -   @MODIFIED@: The resource differs from its expected configuration.
--
-- -   @NOT_CHECKED@: CloudFormation has not checked if the resource
--     differs from its expected configuration.
--
--     Any resources that do not currently support drift detection have a
--     status of @NOT_CHECKED@. For more information, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html Resources that Support Drift Detection>.
--     If you performed an ContinueUpdateRollback operation on a stack, any
--     resources included in @ResourcesToSkip@ will also have a status of
--     @NOT_CHECKED@. For more information on skipping resources during
--     rollback operations, see
--     <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-continueupdaterollback.html Continue Rolling Back an Update>
--     in the CloudFormation User Guide.
--
-- -   @IN_SYNC@: The resources\'s actual configuration matches its
--     expected configuration.
stackResourceDriftInformationSummary_stackResourceDriftStatus :: Lens.Lens' StackResourceDriftInformationSummary StackResourceDriftStatus
stackResourceDriftInformationSummary_stackResourceDriftStatus :: (StackResourceDriftStatus -> f StackResourceDriftStatus)
-> StackResourceDriftInformationSummary
-> f StackResourceDriftInformationSummary
stackResourceDriftInformationSummary_stackResourceDriftStatus = (StackResourceDriftInformationSummary -> StackResourceDriftStatus)
-> (StackResourceDriftInformationSummary
    -> StackResourceDriftStatus
    -> StackResourceDriftInformationSummary)
-> Lens
     StackResourceDriftInformationSummary
     StackResourceDriftInformationSummary
     StackResourceDriftStatus
     StackResourceDriftStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDriftInformationSummary' {StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
$sel:stackResourceDriftStatus:StackResourceDriftInformationSummary' :: StackResourceDriftInformationSummary -> StackResourceDriftStatus
stackResourceDriftStatus} -> StackResourceDriftStatus
stackResourceDriftStatus) (\s :: StackResourceDriftInformationSummary
s@StackResourceDriftInformationSummary' {} StackResourceDriftStatus
a -> StackResourceDriftInformationSummary
s {$sel:stackResourceDriftStatus:StackResourceDriftInformationSummary' :: StackResourceDriftStatus
stackResourceDriftStatus = StackResourceDriftStatus
a} :: StackResourceDriftInformationSummary)

instance
  Core.FromXML
    StackResourceDriftInformationSummary
  where
  parseXML :: [Node] -> Either String StackResourceDriftInformationSummary
parseXML [Node]
x =
    Maybe ISO8601
-> StackResourceDriftStatus -> StackResourceDriftInformationSummary
StackResourceDriftInformationSummary'
      (Maybe ISO8601
 -> StackResourceDriftStatus
 -> StackResourceDriftInformationSummary)
-> Either String (Maybe ISO8601)
-> Either
     String
     (StackResourceDriftStatus -> StackResourceDriftInformationSummary)
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
  (StackResourceDriftStatus -> StackResourceDriftInformationSummary)
-> Either String StackResourceDriftStatus
-> Either String StackResourceDriftInformationSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String StackResourceDriftStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"StackResourceDriftStatus")

instance
  Prelude.Hashable
    StackResourceDriftInformationSummary

instance
  Prelude.NFData
    StackResourceDriftInformationSummary