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

import Amazonka.CloudFormation.Types.ModuleInfo
import Amazonka.CloudFormation.Types.PhysicalResourceIdContextKeyValuePair
import Amazonka.CloudFormation.Types.PropertyDifference
import Amazonka.CloudFormation.Types.StackResourceDriftStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains the drift information for a resource that has been checked for
-- drift. This includes actual and expected property values for resources
-- in which CloudFormation has detected drift. Only resource properties
-- explicitly defined in the stack template are checked for drift. For more
-- information, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html Detecting Unregulated Configuration Changes to Stacks and Resources>.
--
-- Resources that do not currently support drift detection cannot be
-- checked. For a list of resources that support drift detection, see
-- <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift-resource-list.html Resources that Support Drift Detection>.
--
-- Use DetectStackResourceDrift to detect drift on individual resources, or
-- DetectStackDrift to detect drift on all resources in a given stack that
-- support drift detection.
--
-- /See:/ 'newStackResourceDrift' smart constructor.
data StackResourceDrift = StackResourceDrift'
  { -- | A JSON structure containing the actual property values of the stack
    -- resource.
    --
    -- For resources whose @StackResourceDriftStatus@ is @DELETED@, this
    -- structure will not be present.
    StackResourceDrift -> Maybe Text
actualProperties :: Prelude.Maybe Prelude.Text,
    -- | The name or unique identifier that corresponds to a physical instance ID
    -- of a resource supported by CloudFormation.
    StackResourceDrift -> Maybe Text
physicalResourceId :: Prelude.Maybe Prelude.Text,
    -- | Context information that enables CloudFormation to uniquely identify a
    -- resource. CloudFormation uses context key-value pairs in cases where a
    -- resource\'s logical and physical IDs are not enough to uniquely identify
    -- that resource. Each context key-value pair specifies a unique resource
    -- that contains the targeted resource.
    StackResourceDrift -> Maybe [PhysicalResourceIdContextKeyValuePair]
physicalResourceIdContext :: Prelude.Maybe [PhysicalResourceIdContextKeyValuePair],
    -- | A collection of the resource properties whose actual values differ from
    -- their expected values. These will be present only for resources whose
    -- @StackResourceDriftStatus@ is @MODIFIED@.
    StackResourceDrift -> Maybe [PropertyDifference]
propertyDifferences :: Prelude.Maybe [PropertyDifference],
    -- | Contains information about the module from which the resource was
    -- created, if the resource was created from a module included in the stack
    -- template.
    StackResourceDrift -> Maybe ModuleInfo
moduleInfo :: Prelude.Maybe ModuleInfo,
    -- | A JSON structure containing the expected property values of the stack
    -- resource, as defined in the stack template and any values specified as
    -- template parameters.
    --
    -- For resources whose @StackResourceDriftStatus@ is @DELETED@, this
    -- structure will not be present.
    StackResourceDrift -> Maybe Text
expectedProperties :: Prelude.Maybe Prelude.Text,
    -- | The ID of the stack.
    StackResourceDrift -> Text
stackId :: Prelude.Text,
    -- | The logical name of the resource specified in the template.
    StackResourceDrift -> Text
logicalResourceId :: Prelude.Text,
    -- | The type of the resource.
    StackResourceDrift -> Text
resourceType :: Prelude.Text,
    -- | Status of the resource\'s actual configuration compared to its expected
    -- configuration
    --
    -- -   @DELETED@: The resource differs from its expected template
    --     configuration because the resource has been deleted.
    --
    -- -   @MODIFIED@: One or more resource properties differ from their
    --     expected values (as defined in the stack template and any values
    --     specified as template parameters).
    --
    -- -   @IN_SYNC@: The resources\'s actual configuration matches its
    --     expected template configuration.
    --
    -- -   @NOT_CHECKED@: CloudFormation does not currently return this value.
    StackResourceDrift -> StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus,
    -- | Time at which CloudFormation performed drift detection on the stack
    -- resource.
    StackResourceDrift -> ISO8601
timestamp :: Core.ISO8601
  }
  deriving (StackResourceDrift -> StackResourceDrift -> Bool
(StackResourceDrift -> StackResourceDrift -> Bool)
-> (StackResourceDrift -> StackResourceDrift -> Bool)
-> Eq StackResourceDrift
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackResourceDrift -> StackResourceDrift -> Bool
$c/= :: StackResourceDrift -> StackResourceDrift -> Bool
== :: StackResourceDrift -> StackResourceDrift -> Bool
$c== :: StackResourceDrift -> StackResourceDrift -> Bool
Prelude.Eq, ReadPrec [StackResourceDrift]
ReadPrec StackResourceDrift
Int -> ReadS StackResourceDrift
ReadS [StackResourceDrift]
(Int -> ReadS StackResourceDrift)
-> ReadS [StackResourceDrift]
-> ReadPrec StackResourceDrift
-> ReadPrec [StackResourceDrift]
-> Read StackResourceDrift
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackResourceDrift]
$creadListPrec :: ReadPrec [StackResourceDrift]
readPrec :: ReadPrec StackResourceDrift
$creadPrec :: ReadPrec StackResourceDrift
readList :: ReadS [StackResourceDrift]
$creadList :: ReadS [StackResourceDrift]
readsPrec :: Int -> ReadS StackResourceDrift
$creadsPrec :: Int -> ReadS StackResourceDrift
Prelude.Read, Int -> StackResourceDrift -> ShowS
[StackResourceDrift] -> ShowS
StackResourceDrift -> String
(Int -> StackResourceDrift -> ShowS)
-> (StackResourceDrift -> String)
-> ([StackResourceDrift] -> ShowS)
-> Show StackResourceDrift
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackResourceDrift] -> ShowS
$cshowList :: [StackResourceDrift] -> ShowS
show :: StackResourceDrift -> String
$cshow :: StackResourceDrift -> String
showsPrec :: Int -> StackResourceDrift -> ShowS
$cshowsPrec :: Int -> StackResourceDrift -> ShowS
Prelude.Show, (forall x. StackResourceDrift -> Rep StackResourceDrift x)
-> (forall x. Rep StackResourceDrift x -> StackResourceDrift)
-> Generic StackResourceDrift
forall x. Rep StackResourceDrift x -> StackResourceDrift
forall x. StackResourceDrift -> Rep StackResourceDrift x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StackResourceDrift x -> StackResourceDrift
$cfrom :: forall x. StackResourceDrift -> Rep StackResourceDrift x
Prelude.Generic)

-- |
-- Create a value of 'StackResourceDrift' 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:
--
-- 'actualProperties', 'stackResourceDrift_actualProperties' - A JSON structure containing the actual property values of the stack
-- resource.
--
-- For resources whose @StackResourceDriftStatus@ is @DELETED@, this
-- structure will not be present.
--
-- 'physicalResourceId', 'stackResourceDrift_physicalResourceId' - The name or unique identifier that corresponds to a physical instance ID
-- of a resource supported by CloudFormation.
--
-- 'physicalResourceIdContext', 'stackResourceDrift_physicalResourceIdContext' - Context information that enables CloudFormation to uniquely identify a
-- resource. CloudFormation uses context key-value pairs in cases where a
-- resource\'s logical and physical IDs are not enough to uniquely identify
-- that resource. Each context key-value pair specifies a unique resource
-- that contains the targeted resource.
--
-- 'propertyDifferences', 'stackResourceDrift_propertyDifferences' - A collection of the resource properties whose actual values differ from
-- their expected values. These will be present only for resources whose
-- @StackResourceDriftStatus@ is @MODIFIED@.
--
-- 'moduleInfo', 'stackResourceDrift_moduleInfo' - Contains information about the module from which the resource was
-- created, if the resource was created from a module included in the stack
-- template.
--
-- 'expectedProperties', 'stackResourceDrift_expectedProperties' - A JSON structure containing the expected property values of the stack
-- resource, as defined in the stack template and any values specified as
-- template parameters.
--
-- For resources whose @StackResourceDriftStatus@ is @DELETED@, this
-- structure will not be present.
--
-- 'stackId', 'stackResourceDrift_stackId' - The ID of the stack.
--
-- 'logicalResourceId', 'stackResourceDrift_logicalResourceId' - The logical name of the resource specified in the template.
--
-- 'resourceType', 'stackResourceDrift_resourceType' - The type of the resource.
--
-- 'stackResourceDriftStatus', 'stackResourceDrift_stackResourceDriftStatus' - Status of the resource\'s actual configuration compared to its expected
-- configuration
--
-- -   @DELETED@: The resource differs from its expected template
--     configuration because the resource has been deleted.
--
-- -   @MODIFIED@: One or more resource properties differ from their
--     expected values (as defined in the stack template and any values
--     specified as template parameters).
--
-- -   @IN_SYNC@: The resources\'s actual configuration matches its
--     expected template configuration.
--
-- -   @NOT_CHECKED@: CloudFormation does not currently return this value.
--
-- 'timestamp', 'stackResourceDrift_timestamp' - Time at which CloudFormation performed drift detection on the stack
-- resource.
newStackResourceDrift ::
  -- | 'stackId'
  Prelude.Text ->
  -- | 'logicalResourceId'
  Prelude.Text ->
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'stackResourceDriftStatus'
  StackResourceDriftStatus ->
  -- | 'timestamp'
  Prelude.UTCTime ->
  StackResourceDrift
newStackResourceDrift :: Text
-> Text
-> Text
-> StackResourceDriftStatus
-> UTCTime
-> StackResourceDrift
newStackResourceDrift
  Text
pStackId_
  Text
pLogicalResourceId_
  Text
pResourceType_
  StackResourceDriftStatus
pStackResourceDriftStatus_
  UTCTime
pTimestamp_ =
    StackResourceDrift' :: Maybe Text
-> Maybe Text
-> Maybe [PhysicalResourceIdContextKeyValuePair]
-> Maybe [PropertyDifference]
-> Maybe ModuleInfo
-> Maybe Text
-> Text
-> Text
-> Text
-> StackResourceDriftStatus
-> ISO8601
-> StackResourceDrift
StackResourceDrift'
      { $sel:actualProperties:StackResourceDrift' :: Maybe Text
actualProperties =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:physicalResourceId:StackResourceDrift' :: Maybe Text
physicalResourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:physicalResourceIdContext:StackResourceDrift' :: Maybe [PhysicalResourceIdContextKeyValuePair]
physicalResourceIdContext = Maybe [PhysicalResourceIdContextKeyValuePair]
forall a. Maybe a
Prelude.Nothing,
        $sel:propertyDifferences:StackResourceDrift' :: Maybe [PropertyDifference]
propertyDifferences = Maybe [PropertyDifference]
forall a. Maybe a
Prelude.Nothing,
        $sel:moduleInfo:StackResourceDrift' :: Maybe ModuleInfo
moduleInfo = Maybe ModuleInfo
forall a. Maybe a
Prelude.Nothing,
        $sel:expectedProperties:StackResourceDrift' :: Maybe Text
expectedProperties = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:stackId:StackResourceDrift' :: Text
stackId = Text
pStackId_,
        $sel:logicalResourceId:StackResourceDrift' :: Text
logicalResourceId = Text
pLogicalResourceId_,
        $sel:resourceType:StackResourceDrift' :: Text
resourceType = Text
pResourceType_,
        $sel:stackResourceDriftStatus:StackResourceDrift' :: StackResourceDriftStatus
stackResourceDriftStatus =
          StackResourceDriftStatus
pStackResourceDriftStatus_,
        $sel:timestamp:StackResourceDrift' :: ISO8601
timestamp = Tagged UTCTime (Identity UTCTime)
-> Tagged ISO8601 (Identity ISO8601)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged ISO8601 (Identity ISO8601))
-> UTCTime -> ISO8601
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pTimestamp_
      }

-- | A JSON structure containing the actual property values of the stack
-- resource.
--
-- For resources whose @StackResourceDriftStatus@ is @DELETED@, this
-- structure will not be present.
stackResourceDrift_actualProperties :: Lens.Lens' StackResourceDrift (Prelude.Maybe Prelude.Text)
stackResourceDrift_actualProperties :: (Maybe Text -> f (Maybe Text))
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_actualProperties = (StackResourceDrift -> Maybe Text)
-> (StackResourceDrift -> Maybe Text -> StackResourceDrift)
-> Lens
     StackResourceDrift StackResourceDrift (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Maybe Text
actualProperties :: Maybe Text
$sel:actualProperties:StackResourceDrift' :: StackResourceDrift -> Maybe Text
actualProperties} -> Maybe Text
actualProperties) (\s :: StackResourceDrift
s@StackResourceDrift' {} Maybe Text
a -> StackResourceDrift
s {$sel:actualProperties:StackResourceDrift' :: Maybe Text
actualProperties = Maybe Text
a} :: StackResourceDrift)

-- | The name or unique identifier that corresponds to a physical instance ID
-- of a resource supported by CloudFormation.
stackResourceDrift_physicalResourceId :: Lens.Lens' StackResourceDrift (Prelude.Maybe Prelude.Text)
stackResourceDrift_physicalResourceId :: (Maybe Text -> f (Maybe Text))
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_physicalResourceId = (StackResourceDrift -> Maybe Text)
-> (StackResourceDrift -> Maybe Text -> StackResourceDrift)
-> Lens
     StackResourceDrift StackResourceDrift (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Maybe Text
physicalResourceId :: Maybe Text
$sel:physicalResourceId:StackResourceDrift' :: StackResourceDrift -> Maybe Text
physicalResourceId} -> Maybe Text
physicalResourceId) (\s :: StackResourceDrift
s@StackResourceDrift' {} Maybe Text
a -> StackResourceDrift
s {$sel:physicalResourceId:StackResourceDrift' :: Maybe Text
physicalResourceId = Maybe Text
a} :: StackResourceDrift)

-- | Context information that enables CloudFormation to uniquely identify a
-- resource. CloudFormation uses context key-value pairs in cases where a
-- resource\'s logical and physical IDs are not enough to uniquely identify
-- that resource. Each context key-value pair specifies a unique resource
-- that contains the targeted resource.
stackResourceDrift_physicalResourceIdContext :: Lens.Lens' StackResourceDrift (Prelude.Maybe [PhysicalResourceIdContextKeyValuePair])
stackResourceDrift_physicalResourceIdContext :: (Maybe [PhysicalResourceIdContextKeyValuePair]
 -> f (Maybe [PhysicalResourceIdContextKeyValuePair]))
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_physicalResourceIdContext = (StackResourceDrift
 -> Maybe [PhysicalResourceIdContextKeyValuePair])
-> (StackResourceDrift
    -> Maybe [PhysicalResourceIdContextKeyValuePair]
    -> StackResourceDrift)
-> Lens
     StackResourceDrift
     StackResourceDrift
     (Maybe [PhysicalResourceIdContextKeyValuePair])
     (Maybe [PhysicalResourceIdContextKeyValuePair])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Maybe [PhysicalResourceIdContextKeyValuePair]
physicalResourceIdContext :: Maybe [PhysicalResourceIdContextKeyValuePair]
$sel:physicalResourceIdContext:StackResourceDrift' :: StackResourceDrift -> Maybe [PhysicalResourceIdContextKeyValuePair]
physicalResourceIdContext} -> Maybe [PhysicalResourceIdContextKeyValuePair]
physicalResourceIdContext) (\s :: StackResourceDrift
s@StackResourceDrift' {} Maybe [PhysicalResourceIdContextKeyValuePair]
a -> StackResourceDrift
s {$sel:physicalResourceIdContext:StackResourceDrift' :: Maybe [PhysicalResourceIdContextKeyValuePair]
physicalResourceIdContext = Maybe [PhysicalResourceIdContextKeyValuePair]
a} :: StackResourceDrift) ((Maybe [PhysicalResourceIdContextKeyValuePair]
  -> f (Maybe [PhysicalResourceIdContextKeyValuePair]))
 -> StackResourceDrift -> f StackResourceDrift)
-> ((Maybe [PhysicalResourceIdContextKeyValuePair]
     -> f (Maybe [PhysicalResourceIdContextKeyValuePair]))
    -> Maybe [PhysicalResourceIdContextKeyValuePair]
    -> f (Maybe [PhysicalResourceIdContextKeyValuePair]))
-> (Maybe [PhysicalResourceIdContextKeyValuePair]
    -> f (Maybe [PhysicalResourceIdContextKeyValuePair]))
-> StackResourceDrift
-> f StackResourceDrift
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PhysicalResourceIdContextKeyValuePair]
  [PhysicalResourceIdContextKeyValuePair]
  [PhysicalResourceIdContextKeyValuePair]
  [PhysicalResourceIdContextKeyValuePair]
-> Iso
     (Maybe [PhysicalResourceIdContextKeyValuePair])
     (Maybe [PhysicalResourceIdContextKeyValuePair])
     (Maybe [PhysicalResourceIdContextKeyValuePair])
     (Maybe [PhysicalResourceIdContextKeyValuePair])
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
  [PhysicalResourceIdContextKeyValuePair]
  [PhysicalResourceIdContextKeyValuePair]
  [PhysicalResourceIdContextKeyValuePair]
  [PhysicalResourceIdContextKeyValuePair]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A collection of the resource properties whose actual values differ from
-- their expected values. These will be present only for resources whose
-- @StackResourceDriftStatus@ is @MODIFIED@.
stackResourceDrift_propertyDifferences :: Lens.Lens' StackResourceDrift (Prelude.Maybe [PropertyDifference])
stackResourceDrift_propertyDifferences :: (Maybe [PropertyDifference] -> f (Maybe [PropertyDifference]))
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_propertyDifferences = (StackResourceDrift -> Maybe [PropertyDifference])
-> (StackResourceDrift
    -> Maybe [PropertyDifference] -> StackResourceDrift)
-> Lens
     StackResourceDrift
     StackResourceDrift
     (Maybe [PropertyDifference])
     (Maybe [PropertyDifference])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Maybe [PropertyDifference]
propertyDifferences :: Maybe [PropertyDifference]
$sel:propertyDifferences:StackResourceDrift' :: StackResourceDrift -> Maybe [PropertyDifference]
propertyDifferences} -> Maybe [PropertyDifference]
propertyDifferences) (\s :: StackResourceDrift
s@StackResourceDrift' {} Maybe [PropertyDifference]
a -> StackResourceDrift
s {$sel:propertyDifferences:StackResourceDrift' :: Maybe [PropertyDifference]
propertyDifferences = Maybe [PropertyDifference]
a} :: StackResourceDrift) ((Maybe [PropertyDifference] -> f (Maybe [PropertyDifference]))
 -> StackResourceDrift -> f StackResourceDrift)
-> ((Maybe [PropertyDifference] -> f (Maybe [PropertyDifference]))
    -> Maybe [PropertyDifference] -> f (Maybe [PropertyDifference]))
-> (Maybe [PropertyDifference] -> f (Maybe [PropertyDifference]))
-> StackResourceDrift
-> f StackResourceDrift
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [PropertyDifference]
  [PropertyDifference]
  [PropertyDifference]
  [PropertyDifference]
-> Iso
     (Maybe [PropertyDifference])
     (Maybe [PropertyDifference])
     (Maybe [PropertyDifference])
     (Maybe [PropertyDifference])
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
  [PropertyDifference]
  [PropertyDifference]
  [PropertyDifference]
  [PropertyDifference]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Contains information about the module from which the resource was
-- created, if the resource was created from a module included in the stack
-- template.
stackResourceDrift_moduleInfo :: Lens.Lens' StackResourceDrift (Prelude.Maybe ModuleInfo)
stackResourceDrift_moduleInfo :: (Maybe ModuleInfo -> f (Maybe ModuleInfo))
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_moduleInfo = (StackResourceDrift -> Maybe ModuleInfo)
-> (StackResourceDrift -> Maybe ModuleInfo -> StackResourceDrift)
-> Lens
     StackResourceDrift
     StackResourceDrift
     (Maybe ModuleInfo)
     (Maybe ModuleInfo)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Maybe ModuleInfo
moduleInfo :: Maybe ModuleInfo
$sel:moduleInfo:StackResourceDrift' :: StackResourceDrift -> Maybe ModuleInfo
moduleInfo} -> Maybe ModuleInfo
moduleInfo) (\s :: StackResourceDrift
s@StackResourceDrift' {} Maybe ModuleInfo
a -> StackResourceDrift
s {$sel:moduleInfo:StackResourceDrift' :: Maybe ModuleInfo
moduleInfo = Maybe ModuleInfo
a} :: StackResourceDrift)

-- | A JSON structure containing the expected property values of the stack
-- resource, as defined in the stack template and any values specified as
-- template parameters.
--
-- For resources whose @StackResourceDriftStatus@ is @DELETED@, this
-- structure will not be present.
stackResourceDrift_expectedProperties :: Lens.Lens' StackResourceDrift (Prelude.Maybe Prelude.Text)
stackResourceDrift_expectedProperties :: (Maybe Text -> f (Maybe Text))
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_expectedProperties = (StackResourceDrift -> Maybe Text)
-> (StackResourceDrift -> Maybe Text -> StackResourceDrift)
-> Lens
     StackResourceDrift StackResourceDrift (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Maybe Text
expectedProperties :: Maybe Text
$sel:expectedProperties:StackResourceDrift' :: StackResourceDrift -> Maybe Text
expectedProperties} -> Maybe Text
expectedProperties) (\s :: StackResourceDrift
s@StackResourceDrift' {} Maybe Text
a -> StackResourceDrift
s {$sel:expectedProperties:StackResourceDrift' :: Maybe Text
expectedProperties = Maybe Text
a} :: StackResourceDrift)

-- | The ID of the stack.
stackResourceDrift_stackId :: Lens.Lens' StackResourceDrift Prelude.Text
stackResourceDrift_stackId :: (Text -> f Text) -> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_stackId = (StackResourceDrift -> Text)
-> (StackResourceDrift -> Text -> StackResourceDrift)
-> Lens StackResourceDrift StackResourceDrift Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Text
stackId :: Text
$sel:stackId:StackResourceDrift' :: StackResourceDrift -> Text
stackId} -> Text
stackId) (\s :: StackResourceDrift
s@StackResourceDrift' {} Text
a -> StackResourceDrift
s {$sel:stackId:StackResourceDrift' :: Text
stackId = Text
a} :: StackResourceDrift)

-- | The logical name of the resource specified in the template.
stackResourceDrift_logicalResourceId :: Lens.Lens' StackResourceDrift Prelude.Text
stackResourceDrift_logicalResourceId :: (Text -> f Text) -> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_logicalResourceId = (StackResourceDrift -> Text)
-> (StackResourceDrift -> Text -> StackResourceDrift)
-> Lens StackResourceDrift StackResourceDrift Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Text
logicalResourceId :: Text
$sel:logicalResourceId:StackResourceDrift' :: StackResourceDrift -> Text
logicalResourceId} -> Text
logicalResourceId) (\s :: StackResourceDrift
s@StackResourceDrift' {} Text
a -> StackResourceDrift
s {$sel:logicalResourceId:StackResourceDrift' :: Text
logicalResourceId = Text
a} :: StackResourceDrift)

-- | The type of the resource.
stackResourceDrift_resourceType :: Lens.Lens' StackResourceDrift Prelude.Text
stackResourceDrift_resourceType :: (Text -> f Text) -> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_resourceType = (StackResourceDrift -> Text)
-> (StackResourceDrift -> Text -> StackResourceDrift)
-> Lens StackResourceDrift StackResourceDrift Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {Text
resourceType :: Text
$sel:resourceType:StackResourceDrift' :: StackResourceDrift -> Text
resourceType} -> Text
resourceType) (\s :: StackResourceDrift
s@StackResourceDrift' {} Text
a -> StackResourceDrift
s {$sel:resourceType:StackResourceDrift' :: Text
resourceType = Text
a} :: StackResourceDrift)

-- | Status of the resource\'s actual configuration compared to its expected
-- configuration
--
-- -   @DELETED@: The resource differs from its expected template
--     configuration because the resource has been deleted.
--
-- -   @MODIFIED@: One or more resource properties differ from their
--     expected values (as defined in the stack template and any values
--     specified as template parameters).
--
-- -   @IN_SYNC@: The resources\'s actual configuration matches its
--     expected template configuration.
--
-- -   @NOT_CHECKED@: CloudFormation does not currently return this value.
stackResourceDrift_stackResourceDriftStatus :: Lens.Lens' StackResourceDrift StackResourceDriftStatus
stackResourceDrift_stackResourceDriftStatus :: (StackResourceDriftStatus -> f StackResourceDriftStatus)
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_stackResourceDriftStatus = (StackResourceDrift -> StackResourceDriftStatus)
-> (StackResourceDrift
    -> StackResourceDriftStatus -> StackResourceDrift)
-> Lens
     StackResourceDrift
     StackResourceDrift
     StackResourceDriftStatus
     StackResourceDriftStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {StackResourceDriftStatus
stackResourceDriftStatus :: StackResourceDriftStatus
$sel:stackResourceDriftStatus:StackResourceDrift' :: StackResourceDrift -> StackResourceDriftStatus
stackResourceDriftStatus} -> StackResourceDriftStatus
stackResourceDriftStatus) (\s :: StackResourceDrift
s@StackResourceDrift' {} StackResourceDriftStatus
a -> StackResourceDrift
s {$sel:stackResourceDriftStatus:StackResourceDrift' :: StackResourceDriftStatus
stackResourceDriftStatus = StackResourceDriftStatus
a} :: StackResourceDrift)

-- | Time at which CloudFormation performed drift detection on the stack
-- resource.
stackResourceDrift_timestamp :: Lens.Lens' StackResourceDrift Prelude.UTCTime
stackResourceDrift_timestamp :: (UTCTime -> f UTCTime)
-> StackResourceDrift -> f StackResourceDrift
stackResourceDrift_timestamp = (StackResourceDrift -> ISO8601)
-> (StackResourceDrift -> ISO8601 -> StackResourceDrift)
-> Lens StackResourceDrift StackResourceDrift ISO8601 ISO8601
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceDrift' {ISO8601
timestamp :: ISO8601
$sel:timestamp:StackResourceDrift' :: StackResourceDrift -> ISO8601
timestamp} -> ISO8601
timestamp) (\s :: StackResourceDrift
s@StackResourceDrift' {} ISO8601
a -> StackResourceDrift
s {$sel:timestamp:StackResourceDrift' :: ISO8601
timestamp = ISO8601
a} :: StackResourceDrift) ((ISO8601 -> f ISO8601)
 -> StackResourceDrift -> f StackResourceDrift)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> StackResourceDrift
-> f StackResourceDrift
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

instance Core.FromXML StackResourceDrift where
  parseXML :: [Node] -> Either String StackResourceDrift
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe [PhysicalResourceIdContextKeyValuePair]
-> Maybe [PropertyDifference]
-> Maybe ModuleInfo
-> Maybe Text
-> Text
-> Text
-> Text
-> StackResourceDriftStatus
-> ISO8601
-> StackResourceDrift
StackResourceDrift'
      (Maybe Text
 -> Maybe Text
 -> Maybe [PhysicalResourceIdContextKeyValuePair]
 -> Maybe [PropertyDifference]
 -> Maybe ModuleInfo
 -> Maybe Text
 -> Text
 -> Text
 -> Text
 -> StackResourceDriftStatus
 -> ISO8601
 -> StackResourceDrift)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe [PhysicalResourceIdContextKeyValuePair]
      -> Maybe [PropertyDifference]
      -> Maybe ModuleInfo
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> StackResourceDriftStatus
      -> ISO8601
      -> StackResourceDrift)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ActualProperties")
      Either
  String
  (Maybe Text
   -> Maybe [PhysicalResourceIdContextKeyValuePair]
   -> Maybe [PropertyDifference]
   -> Maybe ModuleInfo
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> StackResourceDriftStatus
   -> ISO8601
   -> StackResourceDrift)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [PhysicalResourceIdContextKeyValuePair]
      -> Maybe [PropertyDifference]
      -> Maybe ModuleInfo
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> StackResourceDriftStatus
      -> ISO8601
      -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PhysicalResourceId")
      Either
  String
  (Maybe [PhysicalResourceIdContextKeyValuePair]
   -> Maybe [PropertyDifference]
   -> Maybe ModuleInfo
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> StackResourceDriftStatus
   -> ISO8601
   -> StackResourceDrift)
-> Either String (Maybe [PhysicalResourceIdContextKeyValuePair])
-> Either
     String
     (Maybe [PropertyDifference]
      -> Maybe ModuleInfo
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> StackResourceDriftStatus
      -> ISO8601
      -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PhysicalResourceIdContext"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node]
    -> Either String (Maybe [PhysicalResourceIdContextKeyValuePair]))
-> Either String (Maybe [PhysicalResourceIdContextKeyValuePair])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [PhysicalResourceIdContextKeyValuePair])
-> [Node]
-> Either String (Maybe [PhysicalResourceIdContextKeyValuePair])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text
-> [Node] -> Either String [PhysicalResourceIdContextKeyValuePair]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe [PropertyDifference]
   -> Maybe ModuleInfo
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> StackResourceDriftStatus
   -> ISO8601
   -> StackResourceDrift)
-> Either String (Maybe [PropertyDifference])
-> Either
     String
     (Maybe ModuleInfo
      -> Maybe Text
      -> Text
      -> Text
      -> Text
      -> StackResourceDriftStatus
      -> ISO8601
      -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"PropertyDifferences"
                      Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
                      Either String [Node]
-> ([Node] -> Either String (Maybe [PropertyDifference]))
-> Either String (Maybe [PropertyDifference])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [PropertyDifference])
-> [Node] -> Either String (Maybe [PropertyDifference])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [PropertyDifference]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
                  )
      Either
  String
  (Maybe ModuleInfo
   -> Maybe Text
   -> Text
   -> Text
   -> Text
   -> StackResourceDriftStatus
   -> ISO8601
   -> StackResourceDrift)
-> Either String (Maybe ModuleInfo)
-> Either
     String
     (Maybe Text
      -> Text
      -> Text
      -> Text
      -> StackResourceDriftStatus
      -> ISO8601
      -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ModuleInfo)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ModuleInfo")
      Either
  String
  (Maybe Text
   -> Text
   -> Text
   -> Text
   -> StackResourceDriftStatus
   -> ISO8601
   -> StackResourceDrift)
-> Either String (Maybe Text)
-> Either
     String
     (Text
      -> Text
      -> Text
      -> StackResourceDriftStatus
      -> ISO8601
      -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ExpectedProperties")
      Either
  String
  (Text
   -> Text
   -> Text
   -> StackResourceDriftStatus
   -> ISO8601
   -> StackResourceDrift)
-> Either String Text
-> Either
     String
     (Text
      -> Text
      -> StackResourceDriftStatus
      -> ISO8601
      -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"StackId")
      Either
  String
  (Text
   -> Text
   -> StackResourceDriftStatus
   -> ISO8601
   -> StackResourceDrift)
-> Either String Text
-> Either
     String
     (Text -> StackResourceDriftStatus -> ISO8601 -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"LogicalResourceId")
      Either
  String
  (Text -> StackResourceDriftStatus -> ISO8601 -> StackResourceDrift)
-> Either String Text
-> Either
     String (StackResourceDriftStatus -> ISO8601 -> StackResourceDrift)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ResourceType")
      Either
  String (StackResourceDriftStatus -> ISO8601 -> StackResourceDrift)
-> Either String StackResourceDriftStatus
-> Either String (ISO8601 -> StackResourceDrift)
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")
      Either String (ISO8601 -> StackResourceDrift)
-> Either String ISO8601 -> Either String StackResourceDrift
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ISO8601
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Timestamp")

instance Prelude.Hashable StackResourceDrift

instance Prelude.NFData StackResourceDrift