{-# 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.StackResourceDriftInformation
-- 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.StackResourceDriftInformation 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

-- | Contains information about whether the resource\'s actual configuration
-- differs, or has /drifted/, from its expected configuration.
--
-- /See:/ 'newStackResourceDriftInformation' smart constructor.
data StackResourceDriftInformation = StackResourceDriftInformation'
  { -- | When CloudFormation last checked if the resource had drifted from its
    -- expected configuration.
    StackResourceDriftInformation -> 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 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>.
    --
    -- -   @IN_SYNC@: The resource\'s actual configuration matches its expected
    --     configuration.
    StackResourceDriftInformation -> StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
  }
  deriving (StackResourceDriftInformation
-> StackResourceDriftInformation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackResourceDriftInformation
-> StackResourceDriftInformation -> Bool
$c/= :: StackResourceDriftInformation
-> StackResourceDriftInformation -> Bool
== :: StackResourceDriftInformation
-> StackResourceDriftInformation -> Bool
$c== :: StackResourceDriftInformation
-> StackResourceDriftInformation -> Bool
Prelude.Eq, ReadPrec [StackResourceDriftInformation]
ReadPrec StackResourceDriftInformation
Int -> ReadS StackResourceDriftInformation
ReadS [StackResourceDriftInformation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackResourceDriftInformation]
$creadListPrec :: ReadPrec [StackResourceDriftInformation]
readPrec :: ReadPrec StackResourceDriftInformation
$creadPrec :: ReadPrec StackResourceDriftInformation
readList :: ReadS [StackResourceDriftInformation]
$creadList :: ReadS [StackResourceDriftInformation]
readsPrec :: Int -> ReadS StackResourceDriftInformation
$creadsPrec :: Int -> ReadS StackResourceDriftInformation
Prelude.Read, Int -> StackResourceDriftInformation -> ShowS
[StackResourceDriftInformation] -> ShowS
StackResourceDriftInformation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackResourceDriftInformation] -> ShowS
$cshowList :: [StackResourceDriftInformation] -> ShowS
show :: StackResourceDriftInformation -> String
$cshow :: StackResourceDriftInformation -> String
showsPrec :: Int -> StackResourceDriftInformation -> ShowS
$cshowsPrec :: Int -> StackResourceDriftInformation -> ShowS
Prelude.Show, forall x.
Rep StackResourceDriftInformation x
-> StackResourceDriftInformation
forall x.
StackResourceDriftInformation
-> Rep StackResourceDriftInformation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StackResourceDriftInformation x
-> StackResourceDriftInformation
$cfrom :: forall x.
StackResourceDriftInformation
-> Rep StackResourceDriftInformation x
Prelude.Generic)

-- |
-- Create a value of 'StackResourceDriftInformation' 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', 'stackResourceDriftInformation_lastCheckTimestamp' - When CloudFormation last checked if the resource had drifted from its
-- expected configuration.
--
-- 'stackResourceDriftStatus', 'stackResourceDriftInformation_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>.
--
-- -   @IN_SYNC@: The resource\'s actual configuration matches its expected
--     configuration.
newStackResourceDriftInformation ::
  -- | 'stackResourceDriftStatus'
  StackResourceDriftStatus ->
  StackResourceDriftInformation
newStackResourceDriftInformation :: StackResourceDriftStatus -> StackResourceDriftInformation
newStackResourceDriftInformation
  StackResourceDriftStatus
pStackResourceDriftStatus_ =
    StackResourceDriftInformation'
      { $sel:lastCheckTimestamp:StackResourceDriftInformation' :: Maybe ISO8601
lastCheckTimestamp =
          forall a. Maybe a
Prelude.Nothing,
        $sel:stackResourceDriftStatus:StackResourceDriftInformation' :: StackResourceDriftStatus
stackResourceDriftStatus =
          StackResourceDriftStatus
pStackResourceDriftStatus_
      }

-- | When CloudFormation last checked if the resource had drifted from its
-- expected configuration.
stackResourceDriftInformation_lastCheckTimestamp :: Lens.Lens' StackResourceDriftInformation (Prelude.Maybe Prelude.UTCTime)
stackResourceDriftInformation_lastCheckTimestamp :: Lens' StackResourceDriftInformation (Maybe UTCTime)
stackResourceDriftInformation_lastCheckTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDriftInformation' {Maybe ISO8601
lastCheckTimestamp :: Maybe ISO8601
$sel:lastCheckTimestamp:StackResourceDriftInformation' :: StackResourceDriftInformation -> Maybe ISO8601
lastCheckTimestamp} -> Maybe ISO8601
lastCheckTimestamp) (\s :: StackResourceDriftInformation
s@StackResourceDriftInformation' {} Maybe ISO8601
a -> StackResourceDriftInformation
s {$sel:lastCheckTimestamp:StackResourceDriftInformation' :: Maybe ISO8601
lastCheckTimestamp = Maybe ISO8601
a} :: StackResourceDriftInformation) 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 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>.
--
-- -   @IN_SYNC@: The resource\'s actual configuration matches its expected
--     configuration.
stackResourceDriftInformation_stackResourceDriftStatus :: Lens.Lens' StackResourceDriftInformation StackResourceDriftStatus
stackResourceDriftInformation_stackResourceDriftStatus :: Lens' StackResourceDriftInformation StackResourceDriftStatus
stackResourceDriftInformation_stackResourceDriftStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDriftInformation' {StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
$sel:stackResourceDriftStatus:StackResourceDriftInformation' :: StackResourceDriftInformation -> StackResourceDriftStatus
stackResourceDriftStatus} -> StackResourceDriftStatus
stackResourceDriftStatus) (\s :: StackResourceDriftInformation
s@StackResourceDriftInformation' {} StackResourceDriftStatus
a -> StackResourceDriftInformation
s {$sel:stackResourceDriftStatus:StackResourceDriftInformation' :: StackResourceDriftStatus
stackResourceDriftStatus = StackResourceDriftStatus
a} :: StackResourceDriftInformation)

instance Data.FromXML StackResourceDriftInformation where
  parseXML :: [Node] -> Either String StackResourceDriftInformation
parseXML [Node]
x =
    Maybe ISO8601
-> StackResourceDriftStatus -> StackResourceDriftInformation
StackResourceDriftInformation'
      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
    StackResourceDriftInformation
  where
  hashWithSalt :: Int -> StackResourceDriftInformation -> Int
hashWithSalt Int
_salt StackResourceDriftInformation' {Maybe ISO8601
StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
lastCheckTimestamp :: Maybe ISO8601
$sel:stackResourceDriftStatus:StackResourceDriftInformation' :: StackResourceDriftInformation -> StackResourceDriftStatus
$sel:lastCheckTimestamp:StackResourceDriftInformation' :: StackResourceDriftInformation -> 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 StackResourceDriftInformation where
  rnf :: StackResourceDriftInformation -> ()
rnf StackResourceDriftInformation' {Maybe ISO8601
StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
lastCheckTimestamp :: Maybe ISO8601
$sel:stackResourceDriftStatus:StackResourceDriftInformation' :: StackResourceDriftInformation -> StackResourceDriftStatus
$sel:lastCheckTimestamp:StackResourceDriftInformation' :: StackResourceDriftInformation -> 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