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

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

-- | 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 Data.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 hasn\'t checked if the resource
    --     differs from its expected configuration.
    --
    --     Any resources that don\'t 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 about 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 resource\'s actual configuration matches its expected
    --     configuration.
    StackResourceDriftInformationSummary -> StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
  }
  deriving (StackResourceDriftInformationSummary
-> StackResourceDriftInformationSummary -> Bool
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]
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
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.
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 hasn\'t checked if the resource
--     differs from its expected configuration.
--
--     Any resources that don\'t 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 about 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 resource\'s actual configuration matches its expected
--     configuration.
newStackResourceDriftInformationSummary ::
  -- | 'stackResourceDriftStatus'
  StackResourceDriftStatus ->
  StackResourceDriftInformationSummary
newStackResourceDriftInformationSummary :: StackResourceDriftStatus -> StackResourceDriftInformationSummary
newStackResourceDriftInformationSummary
  StackResourceDriftStatus
pStackResourceDriftStatus_ =
    StackResourceDriftInformationSummary'
      { $sel:lastCheckTimestamp:StackResourceDriftInformationSummary' :: Maybe ISO8601
lastCheckTimestamp =
          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 :: Lens' StackResourceDriftInformationSummary (Maybe UTCTime)
stackResourceDriftInformationSummary_lastCheckTimestamp = 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) 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 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 hasn\'t checked if the resource
--     differs from its expected configuration.
--
--     Any resources that don\'t 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 about 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 resource\'s actual configuration matches its expected
--     configuration.
stackResourceDriftInformationSummary_stackResourceDriftStatus :: Lens.Lens' StackResourceDriftInformationSummary StackResourceDriftStatus
stackResourceDriftInformationSummary_stackResourceDriftStatus :: Lens' StackResourceDriftInformationSummary StackResourceDriftStatus
stackResourceDriftInformationSummary_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
  Data.FromXML
    StackResourceDriftInformationSummary
  where
  parseXML :: [Node] -> Either String StackResourceDriftInformationSummary
parseXML [Node]
x =
    Maybe ISO8601
-> StackResourceDriftStatus -> StackResourceDriftInformationSummary
StackResourceDriftInformationSummary'
      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
"StackResourceDriftStatus")

instance
  Prelude.Hashable
    StackResourceDriftInformationSummary
  where
  hashWithSalt :: Int -> StackResourceDriftInformationSummary -> Int
hashWithSalt
    Int
_salt
    StackResourceDriftInformationSummary' {Maybe ISO8601
StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
lastCheckTimestamp :: Maybe ISO8601
$sel:stackResourceDriftStatus:StackResourceDriftInformationSummary' :: StackResourceDriftInformationSummary -> StackResourceDriftStatus
$sel:lastCheckTimestamp:StackResourceDriftInformationSummary' :: StackResourceDriftInformationSummary -> 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` StackResourceDriftStatus
stackResourceDriftStatus

instance
  Prelude.NFData
    StackResourceDriftInformationSummary
  where
  rnf :: StackResourceDriftInformationSummary -> ()
rnf StackResourceDriftInformationSummary' {Maybe ISO8601
StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
lastCheckTimestamp :: Maybe ISO8601
$sel:stackResourceDriftStatus:StackResourceDriftInformationSummary' :: StackResourceDriftInformationSummary -> StackResourceDriftStatus
$sel:lastCheckTimestamp:StackResourceDriftInformationSummary' :: StackResourceDriftInformationSummary -> 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 StackResourceDriftStatus
stackResourceDriftStatus