{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# 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.DescribeStackDriftDetectionStatus
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns information about a stack drift detection operation. A stack
-- drift detection operation detects whether a stack\'s actual
-- configuration differs, or has /drifted/, from it\'s 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. For more information about stack and
-- resource drift, see
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html Detecting Unregulated Configuration Changes to Stacks and Resources>.
--
-- Use DetectStackDrift to initiate a stack drift detection operation.
-- @DetectStackDrift@ returns a @StackDriftDetectionId@ you can use to
-- monitor the progress of the operation using
-- @DescribeStackDriftDetectionStatus@. Once the drift detection operation
-- has completed, use DescribeStackResourceDrifts to return drift
-- information about the stack and its resources.
module Amazonka.CloudFormation.DescribeStackDriftDetectionStatus
  ( -- * Creating a Request
    DescribeStackDriftDetectionStatus (..),
    newDescribeStackDriftDetectionStatus,

    -- * Request Lenses
    describeStackDriftDetectionStatus_stackDriftDetectionId,

    -- * Destructuring the Response
    DescribeStackDriftDetectionStatusResponse (..),
    newDescribeStackDriftDetectionStatusResponse,

    -- * Response Lenses
    describeStackDriftDetectionStatusResponse_detectionStatusReason,
    describeStackDriftDetectionStatusResponse_driftedStackResourceCount,
    describeStackDriftDetectionStatusResponse_stackDriftStatus,
    describeStackDriftDetectionStatusResponse_httpStatus,
    describeStackDriftDetectionStatusResponse_stackId,
    describeStackDriftDetectionStatusResponse_stackDriftDetectionId,
    describeStackDriftDetectionStatusResponse_detectionStatus,
    describeStackDriftDetectionStatusResponse_timestamp,
  )
where

import Amazonka.CloudFormation.Types
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeStackDriftDetectionStatus' smart constructor.
data DescribeStackDriftDetectionStatus = DescribeStackDriftDetectionStatus'
  { -- | The ID of the drift detection results of this operation.
    --
    -- CloudFormation generates new results, with a new drift detection ID,
    -- each time this operation is run. However, the number of drift results
    -- CloudFormation retains for any given stack, and for how long, may vary.
    DescribeStackDriftDetectionStatus -> Text
stackDriftDetectionId :: Prelude.Text
  }
  deriving (DescribeStackDriftDetectionStatus
-> DescribeStackDriftDetectionStatus -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStackDriftDetectionStatus
-> DescribeStackDriftDetectionStatus -> Bool
$c/= :: DescribeStackDriftDetectionStatus
-> DescribeStackDriftDetectionStatus -> Bool
== :: DescribeStackDriftDetectionStatus
-> DescribeStackDriftDetectionStatus -> Bool
$c== :: DescribeStackDriftDetectionStatus
-> DescribeStackDriftDetectionStatus -> Bool
Prelude.Eq, ReadPrec [DescribeStackDriftDetectionStatus]
ReadPrec DescribeStackDriftDetectionStatus
Int -> ReadS DescribeStackDriftDetectionStatus
ReadS [DescribeStackDriftDetectionStatus]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStackDriftDetectionStatus]
$creadListPrec :: ReadPrec [DescribeStackDriftDetectionStatus]
readPrec :: ReadPrec DescribeStackDriftDetectionStatus
$creadPrec :: ReadPrec DescribeStackDriftDetectionStatus
readList :: ReadS [DescribeStackDriftDetectionStatus]
$creadList :: ReadS [DescribeStackDriftDetectionStatus]
readsPrec :: Int -> ReadS DescribeStackDriftDetectionStatus
$creadsPrec :: Int -> ReadS DescribeStackDriftDetectionStatus
Prelude.Read, Int -> DescribeStackDriftDetectionStatus -> ShowS
[DescribeStackDriftDetectionStatus] -> ShowS
DescribeStackDriftDetectionStatus -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStackDriftDetectionStatus] -> ShowS
$cshowList :: [DescribeStackDriftDetectionStatus] -> ShowS
show :: DescribeStackDriftDetectionStatus -> String
$cshow :: DescribeStackDriftDetectionStatus -> String
showsPrec :: Int -> DescribeStackDriftDetectionStatus -> ShowS
$cshowsPrec :: Int -> DescribeStackDriftDetectionStatus -> ShowS
Prelude.Show, forall x.
Rep DescribeStackDriftDetectionStatus x
-> DescribeStackDriftDetectionStatus
forall x.
DescribeStackDriftDetectionStatus
-> Rep DescribeStackDriftDetectionStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeStackDriftDetectionStatus x
-> DescribeStackDriftDetectionStatus
$cfrom :: forall x.
DescribeStackDriftDetectionStatus
-> Rep DescribeStackDriftDetectionStatus x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStackDriftDetectionStatus' 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:
--
-- 'stackDriftDetectionId', 'describeStackDriftDetectionStatus_stackDriftDetectionId' - The ID of the drift detection results of this operation.
--
-- CloudFormation generates new results, with a new drift detection ID,
-- each time this operation is run. However, the number of drift results
-- CloudFormation retains for any given stack, and for how long, may vary.
newDescribeStackDriftDetectionStatus ::
  -- | 'stackDriftDetectionId'
  Prelude.Text ->
  DescribeStackDriftDetectionStatus
newDescribeStackDriftDetectionStatus :: Text -> DescribeStackDriftDetectionStatus
newDescribeStackDriftDetectionStatus
  Text
pStackDriftDetectionId_ =
    DescribeStackDriftDetectionStatus'
      { $sel:stackDriftDetectionId:DescribeStackDriftDetectionStatus' :: Text
stackDriftDetectionId =
          Text
pStackDriftDetectionId_
      }

-- | The ID of the drift detection results of this operation.
--
-- CloudFormation generates new results, with a new drift detection ID,
-- each time this operation is run. However, the number of drift results
-- CloudFormation retains for any given stack, and for how long, may vary.
describeStackDriftDetectionStatus_stackDriftDetectionId :: Lens.Lens' DescribeStackDriftDetectionStatus Prelude.Text
describeStackDriftDetectionStatus_stackDriftDetectionId :: Lens' DescribeStackDriftDetectionStatus Text
describeStackDriftDetectionStatus_stackDriftDetectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatus' {Text
stackDriftDetectionId :: Text
$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatus' :: DescribeStackDriftDetectionStatus -> Text
stackDriftDetectionId} -> Text
stackDriftDetectionId) (\s :: DescribeStackDriftDetectionStatus
s@DescribeStackDriftDetectionStatus' {} Text
a -> DescribeStackDriftDetectionStatus
s {$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatus' :: Text
stackDriftDetectionId = Text
a} :: DescribeStackDriftDetectionStatus)

instance
  Core.AWSRequest
    DescribeStackDriftDetectionStatus
  where
  type
    AWSResponse DescribeStackDriftDetectionStatus =
      DescribeStackDriftDetectionStatusResponse
  request :: (Service -> Service)
-> DescribeStackDriftDetectionStatus
-> Request DescribeStackDriftDetectionStatus
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeStackDriftDetectionStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeStackDriftDetectionStatus)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeStackDriftDetectionStatusResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Text
-> Maybe Int
-> Maybe StackDriftStatus
-> Int
-> Text
-> Text
-> StackDriftDetectionStatus
-> ISO8601
-> DescribeStackDriftDetectionStatusResponse
DescribeStackDriftDetectionStatusResponse'
            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
"DetectionStatusReason")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"DriftedStackResourceCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"StackDriftStatus")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            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
"StackId")
            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
"StackDriftDetectionId")
            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
"DetectionStatus")
            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
"Timestamp")
      )

instance
  Prelude.Hashable
    DescribeStackDriftDetectionStatus
  where
  hashWithSalt :: Int -> DescribeStackDriftDetectionStatus -> Int
hashWithSalt
    Int
_salt
    DescribeStackDriftDetectionStatus' {Text
stackDriftDetectionId :: Text
$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatus' :: DescribeStackDriftDetectionStatus -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
stackDriftDetectionId

instance
  Prelude.NFData
    DescribeStackDriftDetectionStatus
  where
  rnf :: DescribeStackDriftDetectionStatus -> ()
rnf DescribeStackDriftDetectionStatus' {Text
stackDriftDetectionId :: Text
$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatus' :: DescribeStackDriftDetectionStatus -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
stackDriftDetectionId

instance
  Data.ToHeaders
    DescribeStackDriftDetectionStatus
  where
  toHeaders :: DescribeStackDriftDetectionStatus -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance
  Data.ToPath
    DescribeStackDriftDetectionStatus
  where
  toPath :: DescribeStackDriftDetectionStatus -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance
  Data.ToQuery
    DescribeStackDriftDetectionStatus
  where
  toQuery :: DescribeStackDriftDetectionStatus -> QueryString
toQuery DescribeStackDriftDetectionStatus' {Text
stackDriftDetectionId :: Text
$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatus' :: DescribeStackDriftDetectionStatus -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"DescribeStackDriftDetectionStatus" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2010-05-15" :: Prelude.ByteString),
        ByteString
"StackDriftDetectionId"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
stackDriftDetectionId
      ]

-- | /See:/ 'newDescribeStackDriftDetectionStatusResponse' smart constructor.
data DescribeStackDriftDetectionStatusResponse = DescribeStackDriftDetectionStatusResponse'
  { -- | The reason the stack drift detection operation has its current status.
    DescribeStackDriftDetectionStatusResponse -> Maybe Text
detectionStatusReason :: Prelude.Maybe Prelude.Text,
    -- | Total number of stack resources that have drifted. This is NULL until
    -- the drift detection operation reaches a status of @DETECTION_COMPLETE@.
    -- This value will be 0 for stacks whose drift status is @IN_SYNC@.
    DescribeStackDriftDetectionStatusResponse -> Maybe Int
driftedStackResourceCount :: Prelude.Maybe Prelude.Int,
    -- | Status of the stack\'s actual configuration compared to its expected
    -- 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.
    DescribeStackDriftDetectionStatusResponse -> Maybe StackDriftStatus
stackDriftStatus :: Prelude.Maybe StackDriftStatus,
    -- | The response's http status code.
    DescribeStackDriftDetectionStatusResponse -> Int
httpStatus :: Prelude.Int,
    -- | The ID of the stack.
    DescribeStackDriftDetectionStatusResponse -> Text
stackId :: Prelude.Text,
    -- | The ID of the drift detection results of this operation.
    --
    -- CloudFormation generates new results, with a new drift detection ID,
    -- each time this operation is run. However, the number of reports
    -- CloudFormation retains for any given stack, and for how long, may vary.
    DescribeStackDriftDetectionStatusResponse -> Text
stackDriftDetectionId :: Prelude.Text,
    -- | The status of the stack drift detection operation.
    --
    -- -   @DETECTION_COMPLETE@: The stack drift detection operation has
    --     successfully completed for all resources in the stack that support
    --     drift detection. (Resources that don\'t currently support stack
    --     detection remain unchecked.)
    --
    --     If you specified logical resource IDs for CloudFormation to use as a
    --     filter for the stack drift detection operation, only the resources
    --     with those logical IDs are checked for drift.
    --
    -- -   @DETECTION_FAILED@: The stack drift detection operation has failed
    --     for at least one resource in the stack. Results will be available
    --     for resources on which CloudFormation successfully completed drift
    --     detection.
    --
    -- -   @DETECTION_IN_PROGRESS@: The stack drift detection operation is
    --     currently in progress.
    DescribeStackDriftDetectionStatusResponse
-> StackDriftDetectionStatus
detectionStatus :: StackDriftDetectionStatus,
    -- | Time at which the stack drift detection operation was initiated.
    DescribeStackDriftDetectionStatusResponse -> ISO8601
timestamp :: Data.ISO8601
  }
  deriving (DescribeStackDriftDetectionStatusResponse
-> DescribeStackDriftDetectionStatusResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeStackDriftDetectionStatusResponse
-> DescribeStackDriftDetectionStatusResponse -> Bool
$c/= :: DescribeStackDriftDetectionStatusResponse
-> DescribeStackDriftDetectionStatusResponse -> Bool
== :: DescribeStackDriftDetectionStatusResponse
-> DescribeStackDriftDetectionStatusResponse -> Bool
$c== :: DescribeStackDriftDetectionStatusResponse
-> DescribeStackDriftDetectionStatusResponse -> Bool
Prelude.Eq, ReadPrec [DescribeStackDriftDetectionStatusResponse]
ReadPrec DescribeStackDriftDetectionStatusResponse
Int -> ReadS DescribeStackDriftDetectionStatusResponse
ReadS [DescribeStackDriftDetectionStatusResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeStackDriftDetectionStatusResponse]
$creadListPrec :: ReadPrec [DescribeStackDriftDetectionStatusResponse]
readPrec :: ReadPrec DescribeStackDriftDetectionStatusResponse
$creadPrec :: ReadPrec DescribeStackDriftDetectionStatusResponse
readList :: ReadS [DescribeStackDriftDetectionStatusResponse]
$creadList :: ReadS [DescribeStackDriftDetectionStatusResponse]
readsPrec :: Int -> ReadS DescribeStackDriftDetectionStatusResponse
$creadsPrec :: Int -> ReadS DescribeStackDriftDetectionStatusResponse
Prelude.Read, Int -> DescribeStackDriftDetectionStatusResponse -> ShowS
[DescribeStackDriftDetectionStatusResponse] -> ShowS
DescribeStackDriftDetectionStatusResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeStackDriftDetectionStatusResponse] -> ShowS
$cshowList :: [DescribeStackDriftDetectionStatusResponse] -> ShowS
show :: DescribeStackDriftDetectionStatusResponse -> String
$cshow :: DescribeStackDriftDetectionStatusResponse -> String
showsPrec :: Int -> DescribeStackDriftDetectionStatusResponse -> ShowS
$cshowsPrec :: Int -> DescribeStackDriftDetectionStatusResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeStackDriftDetectionStatusResponse x
-> DescribeStackDriftDetectionStatusResponse
forall x.
DescribeStackDriftDetectionStatusResponse
-> Rep DescribeStackDriftDetectionStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeStackDriftDetectionStatusResponse x
-> DescribeStackDriftDetectionStatusResponse
$cfrom :: forall x.
DescribeStackDriftDetectionStatusResponse
-> Rep DescribeStackDriftDetectionStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeStackDriftDetectionStatusResponse' 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:
--
-- 'detectionStatusReason', 'describeStackDriftDetectionStatusResponse_detectionStatusReason' - The reason the stack drift detection operation has its current status.
--
-- 'driftedStackResourceCount', 'describeStackDriftDetectionStatusResponse_driftedStackResourceCount' - Total number of stack resources that have drifted. This is NULL until
-- the drift detection operation reaches a status of @DETECTION_COMPLETE@.
-- This value will be 0 for stacks whose drift status is @IN_SYNC@.
--
-- 'stackDriftStatus', 'describeStackDriftDetectionStatusResponse_stackDriftStatus' - Status of the stack\'s actual configuration compared to its expected
-- 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.
--
-- 'httpStatus', 'describeStackDriftDetectionStatusResponse_httpStatus' - The response's http status code.
--
-- 'stackId', 'describeStackDriftDetectionStatusResponse_stackId' - The ID of the stack.
--
-- 'stackDriftDetectionId', 'describeStackDriftDetectionStatusResponse_stackDriftDetectionId' - The ID of the drift detection results of this operation.
--
-- CloudFormation generates new results, with a new drift detection ID,
-- each time this operation is run. However, the number of reports
-- CloudFormation retains for any given stack, and for how long, may vary.
--
-- 'detectionStatus', 'describeStackDriftDetectionStatusResponse_detectionStatus' - The status of the stack drift detection operation.
--
-- -   @DETECTION_COMPLETE@: The stack drift detection operation has
--     successfully completed for all resources in the stack that support
--     drift detection. (Resources that don\'t currently support stack
--     detection remain unchecked.)
--
--     If you specified logical resource IDs for CloudFormation to use as a
--     filter for the stack drift detection operation, only the resources
--     with those logical IDs are checked for drift.
--
-- -   @DETECTION_FAILED@: The stack drift detection operation has failed
--     for at least one resource in the stack. Results will be available
--     for resources on which CloudFormation successfully completed drift
--     detection.
--
-- -   @DETECTION_IN_PROGRESS@: The stack drift detection operation is
--     currently in progress.
--
-- 'timestamp', 'describeStackDriftDetectionStatusResponse_timestamp' - Time at which the stack drift detection operation was initiated.
newDescribeStackDriftDetectionStatusResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'stackId'
  Prelude.Text ->
  -- | 'stackDriftDetectionId'
  Prelude.Text ->
  -- | 'detectionStatus'
  StackDriftDetectionStatus ->
  -- | 'timestamp'
  Prelude.UTCTime ->
  DescribeStackDriftDetectionStatusResponse
newDescribeStackDriftDetectionStatusResponse :: Int
-> Text
-> Text
-> StackDriftDetectionStatus
-> UTCTime
-> DescribeStackDriftDetectionStatusResponse
newDescribeStackDriftDetectionStatusResponse
  Int
pHttpStatus_
  Text
pStackId_
  Text
pStackDriftDetectionId_
  StackDriftDetectionStatus
pDetectionStatus_
  UTCTime
pTimestamp_ =
    DescribeStackDriftDetectionStatusResponse'
      { $sel:detectionStatusReason:DescribeStackDriftDetectionStatusResponse' :: Maybe Text
detectionStatusReason =
          forall a. Maybe a
Prelude.Nothing,
        $sel:driftedStackResourceCount:DescribeStackDriftDetectionStatusResponse' :: Maybe Int
driftedStackResourceCount =
          forall a. Maybe a
Prelude.Nothing,
        $sel:stackDriftStatus:DescribeStackDriftDetectionStatusResponse' :: Maybe StackDriftStatus
stackDriftStatus =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:DescribeStackDriftDetectionStatusResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:stackId:DescribeStackDriftDetectionStatusResponse' :: Text
stackId = Text
pStackId_,
        $sel:stackDriftDetectionId:DescribeStackDriftDetectionStatusResponse' :: Text
stackDriftDetectionId =
          Text
pStackDriftDetectionId_,
        $sel:detectionStatus:DescribeStackDriftDetectionStatusResponse' :: StackDriftDetectionStatus
detectionStatus =
          StackDriftDetectionStatus
pDetectionStatus_,
        $sel:timestamp:DescribeStackDriftDetectionStatusResponse' :: ISO8601
timestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pTimestamp_
      }

-- | The reason the stack drift detection operation has its current status.
describeStackDriftDetectionStatusResponse_detectionStatusReason :: Lens.Lens' DescribeStackDriftDetectionStatusResponse (Prelude.Maybe Prelude.Text)
describeStackDriftDetectionStatusResponse_detectionStatusReason :: Lens' DescribeStackDriftDetectionStatusResponse (Maybe Text)
describeStackDriftDetectionStatusResponse_detectionStatusReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatusResponse' {Maybe Text
detectionStatusReason :: Maybe Text
$sel:detectionStatusReason:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Maybe Text
detectionStatusReason} -> Maybe Text
detectionStatusReason) (\s :: DescribeStackDriftDetectionStatusResponse
s@DescribeStackDriftDetectionStatusResponse' {} Maybe Text
a -> DescribeStackDriftDetectionStatusResponse
s {$sel:detectionStatusReason:DescribeStackDriftDetectionStatusResponse' :: Maybe Text
detectionStatusReason = Maybe Text
a} :: DescribeStackDriftDetectionStatusResponse)

-- | Total number of stack resources that have drifted. This is NULL until
-- the drift detection operation reaches a status of @DETECTION_COMPLETE@.
-- This value will be 0 for stacks whose drift status is @IN_SYNC@.
describeStackDriftDetectionStatusResponse_driftedStackResourceCount :: Lens.Lens' DescribeStackDriftDetectionStatusResponse (Prelude.Maybe Prelude.Int)
describeStackDriftDetectionStatusResponse_driftedStackResourceCount :: Lens' DescribeStackDriftDetectionStatusResponse (Maybe Int)
describeStackDriftDetectionStatusResponse_driftedStackResourceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatusResponse' {Maybe Int
driftedStackResourceCount :: Maybe Int
$sel:driftedStackResourceCount:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Maybe Int
driftedStackResourceCount} -> Maybe Int
driftedStackResourceCount) (\s :: DescribeStackDriftDetectionStatusResponse
s@DescribeStackDriftDetectionStatusResponse' {} Maybe Int
a -> DescribeStackDriftDetectionStatusResponse
s {$sel:driftedStackResourceCount:DescribeStackDriftDetectionStatusResponse' :: Maybe Int
driftedStackResourceCount = Maybe Int
a} :: DescribeStackDriftDetectionStatusResponse)

-- | Status of the stack\'s actual configuration compared to its expected
-- 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.
describeStackDriftDetectionStatusResponse_stackDriftStatus :: Lens.Lens' DescribeStackDriftDetectionStatusResponse (Prelude.Maybe StackDriftStatus)
describeStackDriftDetectionStatusResponse_stackDriftStatus :: Lens'
  DescribeStackDriftDetectionStatusResponse (Maybe StackDriftStatus)
describeStackDriftDetectionStatusResponse_stackDriftStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatusResponse' {Maybe StackDriftStatus
stackDriftStatus :: Maybe StackDriftStatus
$sel:stackDriftStatus:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Maybe StackDriftStatus
stackDriftStatus} -> Maybe StackDriftStatus
stackDriftStatus) (\s :: DescribeStackDriftDetectionStatusResponse
s@DescribeStackDriftDetectionStatusResponse' {} Maybe StackDriftStatus
a -> DescribeStackDriftDetectionStatusResponse
s {$sel:stackDriftStatus:DescribeStackDriftDetectionStatusResponse' :: Maybe StackDriftStatus
stackDriftStatus = Maybe StackDriftStatus
a} :: DescribeStackDriftDetectionStatusResponse)

-- | The response's http status code.
describeStackDriftDetectionStatusResponse_httpStatus :: Lens.Lens' DescribeStackDriftDetectionStatusResponse Prelude.Int
describeStackDriftDetectionStatusResponse_httpStatus :: Lens' DescribeStackDriftDetectionStatusResponse Int
describeStackDriftDetectionStatusResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeStackDriftDetectionStatusResponse
s@DescribeStackDriftDetectionStatusResponse' {} Int
a -> DescribeStackDriftDetectionStatusResponse
s {$sel:httpStatus:DescribeStackDriftDetectionStatusResponse' :: Int
httpStatus = Int
a} :: DescribeStackDriftDetectionStatusResponse)

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

-- | The ID of the drift detection results of this operation.
--
-- CloudFormation generates new results, with a new drift detection ID,
-- each time this operation is run. However, the number of reports
-- CloudFormation retains for any given stack, and for how long, may vary.
describeStackDriftDetectionStatusResponse_stackDriftDetectionId :: Lens.Lens' DescribeStackDriftDetectionStatusResponse Prelude.Text
describeStackDriftDetectionStatusResponse_stackDriftDetectionId :: Lens' DescribeStackDriftDetectionStatusResponse Text
describeStackDriftDetectionStatusResponse_stackDriftDetectionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatusResponse' {Text
stackDriftDetectionId :: Text
$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Text
stackDriftDetectionId} -> Text
stackDriftDetectionId) (\s :: DescribeStackDriftDetectionStatusResponse
s@DescribeStackDriftDetectionStatusResponse' {} Text
a -> DescribeStackDriftDetectionStatusResponse
s {$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatusResponse' :: Text
stackDriftDetectionId = Text
a} :: DescribeStackDriftDetectionStatusResponse)

-- | The status of the stack drift detection operation.
--
-- -   @DETECTION_COMPLETE@: The stack drift detection operation has
--     successfully completed for all resources in the stack that support
--     drift detection. (Resources that don\'t currently support stack
--     detection remain unchecked.)
--
--     If you specified logical resource IDs for CloudFormation to use as a
--     filter for the stack drift detection operation, only the resources
--     with those logical IDs are checked for drift.
--
-- -   @DETECTION_FAILED@: The stack drift detection operation has failed
--     for at least one resource in the stack. Results will be available
--     for resources on which CloudFormation successfully completed drift
--     detection.
--
-- -   @DETECTION_IN_PROGRESS@: The stack drift detection operation is
--     currently in progress.
describeStackDriftDetectionStatusResponse_detectionStatus :: Lens.Lens' DescribeStackDriftDetectionStatusResponse StackDriftDetectionStatus
describeStackDriftDetectionStatusResponse_detectionStatus :: Lens'
  DescribeStackDriftDetectionStatusResponse StackDriftDetectionStatus
describeStackDriftDetectionStatusResponse_detectionStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatusResponse' {StackDriftDetectionStatus
detectionStatus :: StackDriftDetectionStatus
$sel:detectionStatus:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse
-> StackDriftDetectionStatus
detectionStatus} -> StackDriftDetectionStatus
detectionStatus) (\s :: DescribeStackDriftDetectionStatusResponse
s@DescribeStackDriftDetectionStatusResponse' {} StackDriftDetectionStatus
a -> DescribeStackDriftDetectionStatusResponse
s {$sel:detectionStatus:DescribeStackDriftDetectionStatusResponse' :: StackDriftDetectionStatus
detectionStatus = StackDriftDetectionStatus
a} :: DescribeStackDriftDetectionStatusResponse)

-- | Time at which the stack drift detection operation was initiated.
describeStackDriftDetectionStatusResponse_timestamp :: Lens.Lens' DescribeStackDriftDetectionStatusResponse Prelude.UTCTime
describeStackDriftDetectionStatusResponse_timestamp :: Lens' DescribeStackDriftDetectionStatusResponse UTCTime
describeStackDriftDetectionStatusResponse_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeStackDriftDetectionStatusResponse' {ISO8601
timestamp :: ISO8601
$sel:timestamp:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> ISO8601
timestamp} -> ISO8601
timestamp) (\s :: DescribeStackDriftDetectionStatusResponse
s@DescribeStackDriftDetectionStatusResponse' {} ISO8601
a -> DescribeStackDriftDetectionStatusResponse
s {$sel:timestamp:DescribeStackDriftDetectionStatusResponse' :: ISO8601
timestamp = ISO8601
a} :: DescribeStackDriftDetectionStatusResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

instance
  Prelude.NFData
    DescribeStackDriftDetectionStatusResponse
  where
  rnf :: DescribeStackDriftDetectionStatusResponse -> ()
rnf DescribeStackDriftDetectionStatusResponse' {Int
Maybe Int
Maybe Text
Maybe StackDriftStatus
Text
ISO8601
StackDriftDetectionStatus
timestamp :: ISO8601
detectionStatus :: StackDriftDetectionStatus
stackDriftDetectionId :: Text
stackId :: Text
httpStatus :: Int
stackDriftStatus :: Maybe StackDriftStatus
driftedStackResourceCount :: Maybe Int
detectionStatusReason :: Maybe Text
$sel:timestamp:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> ISO8601
$sel:detectionStatus:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse
-> StackDriftDetectionStatus
$sel:stackDriftDetectionId:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Text
$sel:stackId:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Text
$sel:httpStatus:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Int
$sel:stackDriftStatus:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Maybe StackDriftStatus
$sel:driftedStackResourceCount:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Maybe Int
$sel:detectionStatusReason:DescribeStackDriftDetectionStatusResponse' :: DescribeStackDriftDetectionStatusResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
detectionStatusReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
driftedStackResourceCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe StackDriftStatus
stackDriftStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stackId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
stackDriftDetectionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf StackDriftDetectionStatus
detectionStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
timestamp