{-# 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-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)
--
-- 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 on 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_stackDriftStatus,
    describeStackDriftDetectionStatusResponse_driftedStackResourceCount,
    describeStackDriftDetectionStatusResponse_detectionStatusReason,
    describeStackDriftDetectionStatusResponse_httpStatus,
    describeStackDriftDetectionStatusResponse_stackId,
    describeStackDriftDetectionStatusResponse_stackDriftDetectionId,
    describeStackDriftDetectionStatusResponse_detectionStatus,
    describeStackDriftDetectionStatusResponse_timestamp,
  )
where

import Amazonka.CloudFormation.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(DescribeStackDriftDetectionStatus
 -> DescribeStackDriftDetectionStatus -> Bool)
-> (DescribeStackDriftDetectionStatus
    -> DescribeStackDriftDetectionStatus -> Bool)
-> Eq DescribeStackDriftDetectionStatus
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]
(Int -> ReadS DescribeStackDriftDetectionStatus)
-> ReadS [DescribeStackDriftDetectionStatus]
-> ReadPrec DescribeStackDriftDetectionStatus
-> ReadPrec [DescribeStackDriftDetectionStatus]
-> Read 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
(Int -> DescribeStackDriftDetectionStatus -> ShowS)
-> (DescribeStackDriftDetectionStatus -> String)
-> ([DescribeStackDriftDetectionStatus] -> ShowS)
-> Show DescribeStackDriftDetectionStatus
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.
 DescribeStackDriftDetectionStatus
 -> Rep DescribeStackDriftDetectionStatus x)
-> (forall x.
    Rep DescribeStackDriftDetectionStatus x
    -> DescribeStackDriftDetectionStatus)
-> Generic DescribeStackDriftDetectionStatus
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' :: Text -> DescribeStackDriftDetectionStatus
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 :: (Text -> f Text)
-> DescribeStackDriftDetectionStatus
-> f DescribeStackDriftDetectionStatus
describeStackDriftDetectionStatus_stackDriftDetectionId = (DescribeStackDriftDetectionStatus -> Text)
-> (DescribeStackDriftDetectionStatus
    -> Text -> DescribeStackDriftDetectionStatus)
-> Lens
     DescribeStackDriftDetectionStatus
     DescribeStackDriftDetectionStatus
     Text
     Text
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 :: DescribeStackDriftDetectionStatus
-> Request DescribeStackDriftDetectionStatus
request = Service
-> DescribeStackDriftDetectionStatus
-> Request DescribeStackDriftDetectionStatus
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeStackDriftDetectionStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeStackDriftDetectionStatus)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse DescribeStackDriftDetectionStatus))
-> Logger
-> Service
-> Proxy DescribeStackDriftDetectionStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeStackDriftDetectionStatus)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"DescribeStackDriftDetectionStatusResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe StackDriftStatus
-> Maybe Int
-> Maybe Text
-> Int
-> Text
-> Text
-> StackDriftDetectionStatus
-> ISO8601
-> DescribeStackDriftDetectionStatusResponse
DescribeStackDriftDetectionStatusResponse'
            (Maybe StackDriftStatus
 -> Maybe Int
 -> Maybe Text
 -> Int
 -> Text
 -> Text
 -> StackDriftDetectionStatus
 -> ISO8601
 -> DescribeStackDriftDetectionStatusResponse)
-> Either String (Maybe StackDriftStatus)
-> Either
     String
     (Maybe Int
      -> Maybe Text
      -> Int
      -> Text
      -> Text
      -> StackDriftDetectionStatus
      -> ISO8601
      -> DescribeStackDriftDetectionStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe StackDriftStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StackDriftStatus")
              Either
  String
  (Maybe Int
   -> Maybe Text
   -> Int
   -> Text
   -> Text
   -> StackDriftDetectionStatus
   -> ISO8601
   -> DescribeStackDriftDetectionStatusResponse)
-> Either String (Maybe Int)
-> Either
     String
     (Maybe Text
      -> Int
      -> Text
      -> Text
      -> StackDriftDetectionStatus
      -> ISO8601
      -> DescribeStackDriftDetectionStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Int)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"DriftedStackResourceCount")
              Either
  String
  (Maybe Text
   -> Int
   -> Text
   -> Text
   -> StackDriftDetectionStatus
   -> ISO8601
   -> DescribeStackDriftDetectionStatusResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int
      -> Text
      -> Text
      -> StackDriftDetectionStatus
      -> ISO8601
      -> DescribeStackDriftDetectionStatusResponse)
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
"DetectionStatusReason")
              Either
  String
  (Int
   -> Text
   -> Text
   -> StackDriftDetectionStatus
   -> ISO8601
   -> DescribeStackDriftDetectionStatusResponse)
-> Either String Int
-> Either
     String
     (Text
      -> Text
      -> StackDriftDetectionStatus
      -> ISO8601
      -> DescribeStackDriftDetectionStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
              Either
  String
  (Text
   -> Text
   -> StackDriftDetectionStatus
   -> ISO8601
   -> DescribeStackDriftDetectionStatusResponse)
-> Either String Text
-> Either
     String
     (Text
      -> StackDriftDetectionStatus
      -> ISO8601
      -> DescribeStackDriftDetectionStatusResponse)
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
   -> StackDriftDetectionStatus
   -> ISO8601
   -> DescribeStackDriftDetectionStatusResponse)
-> Either String Text
-> Either
     String
     (StackDriftDetectionStatus
      -> ISO8601 -> DescribeStackDriftDetectionStatusResponse)
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
"StackDriftDetectionId")
              Either
  String
  (StackDriftDetectionStatus
   -> ISO8601 -> DescribeStackDriftDetectionStatusResponse)
-> Either String StackDriftDetectionStatus
-> Either
     String (ISO8601 -> DescribeStackDriftDetectionStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String StackDriftDetectionStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"DetectionStatus")
              Either
  String (ISO8601 -> DescribeStackDriftDetectionStatusResponse)
-> Either String ISO8601
-> Either String DescribeStackDriftDetectionStatusResponse
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
    DescribeStackDriftDetectionStatus

instance
  Prelude.NFData
    DescribeStackDriftDetectionStatus

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

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

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

-- | /See:/ 'newDescribeStackDriftDetectionStatusResponse' smart constructor.
data DescribeStackDriftDetectionStatusResponse = 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 has not 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,
    -- | 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,
    -- | The reason the stack drift detection operation has its current status.
    DescribeStackDriftDetectionStatusResponse -> Maybe Text
detectionStatusReason :: Prelude.Maybe Prelude.Text,
    -- | 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 do not 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 :: Core.ISO8601
  }
  deriving (DescribeStackDriftDetectionStatusResponse
-> DescribeStackDriftDetectionStatusResponse -> Bool
(DescribeStackDriftDetectionStatusResponse
 -> DescribeStackDriftDetectionStatusResponse -> Bool)
-> (DescribeStackDriftDetectionStatusResponse
    -> DescribeStackDriftDetectionStatusResponse -> Bool)
-> Eq DescribeStackDriftDetectionStatusResponse
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]
(Int -> ReadS DescribeStackDriftDetectionStatusResponse)
-> ReadS [DescribeStackDriftDetectionStatusResponse]
-> ReadPrec DescribeStackDriftDetectionStatusResponse
-> ReadPrec [DescribeStackDriftDetectionStatusResponse]
-> Read 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
(Int -> DescribeStackDriftDetectionStatusResponse -> ShowS)
-> (DescribeStackDriftDetectionStatusResponse -> String)
-> ([DescribeStackDriftDetectionStatusResponse] -> ShowS)
-> Show DescribeStackDriftDetectionStatusResponse
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.
 DescribeStackDriftDetectionStatusResponse
 -> Rep DescribeStackDriftDetectionStatusResponse x)
-> (forall x.
    Rep DescribeStackDriftDetectionStatusResponse x
    -> DescribeStackDriftDetectionStatusResponse)
-> Generic DescribeStackDriftDetectionStatusResponse
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:
--
-- '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 has not 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.
--
-- '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@.
--
-- 'detectionStatusReason', 'describeStackDriftDetectionStatusResponse_detectionStatusReason' - The reason the stack drift detection operation has its current status.
--
-- '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 do not 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' :: Maybe StackDriftStatus
-> Maybe Int
-> Maybe Text
-> Int
-> Text
-> Text
-> StackDriftDetectionStatus
-> ISO8601
-> DescribeStackDriftDetectionStatusResponse
DescribeStackDriftDetectionStatusResponse'
      { $sel:stackDriftStatus:DescribeStackDriftDetectionStatusResponse' :: Maybe StackDriftStatus
stackDriftStatus =
          Maybe StackDriftStatus
forall a. Maybe a
Prelude.Nothing,
        $sel:driftedStackResourceCount:DescribeStackDriftDetectionStatusResponse' :: Maybe Int
driftedStackResourceCount =
          Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:detectionStatusReason:DescribeStackDriftDetectionStatusResponse' :: Maybe Text
detectionStatusReason =
          Maybe Text
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 =
          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_
      }

-- | 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 has not 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 :: (Maybe StackDriftStatus -> f (Maybe StackDriftStatus))
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_stackDriftStatus = (DescribeStackDriftDetectionStatusResponse
 -> Maybe StackDriftStatus)
-> (DescribeStackDriftDetectionStatusResponse
    -> Maybe StackDriftStatus
    -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     (Maybe StackDriftStatus)
     (Maybe 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)

-- | 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 :: (Maybe Int -> f (Maybe Int))
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_driftedStackResourceCount = (DescribeStackDriftDetectionStatusResponse -> Maybe Int)
-> (DescribeStackDriftDetectionStatusResponse
    -> Maybe Int -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     (Maybe Int)
     (Maybe Int)
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)

-- | The reason the stack drift detection operation has its current status.
describeStackDriftDetectionStatusResponse_detectionStatusReason :: Lens.Lens' DescribeStackDriftDetectionStatusResponse (Prelude.Maybe Prelude.Text)
describeStackDriftDetectionStatusResponse_detectionStatusReason :: (Maybe Text -> f (Maybe Text))
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_detectionStatusReason = (DescribeStackDriftDetectionStatusResponse -> Maybe Text)
-> (DescribeStackDriftDetectionStatusResponse
    -> Maybe Text -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     (Maybe Text)
     (Maybe Text)
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)

-- | The response's http status code.
describeStackDriftDetectionStatusResponse_httpStatus :: Lens.Lens' DescribeStackDriftDetectionStatusResponse Prelude.Int
describeStackDriftDetectionStatusResponse_httpStatus :: (Int -> f Int)
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_httpStatus = (DescribeStackDriftDetectionStatusResponse -> Int)
-> (DescribeStackDriftDetectionStatusResponse
    -> Int -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     Int
     Int
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 :: (Text -> f Text)
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_stackId = (DescribeStackDriftDetectionStatusResponse -> Text)
-> (DescribeStackDriftDetectionStatusResponse
    -> Text -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     Text
     Text
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 :: (Text -> f Text)
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_stackDriftDetectionId = (DescribeStackDriftDetectionStatusResponse -> Text)
-> (DescribeStackDriftDetectionStatusResponse
    -> Text -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     Text
     Text
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 do not 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 :: (StackDriftDetectionStatus -> f StackDriftDetectionStatus)
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_detectionStatus = (DescribeStackDriftDetectionStatusResponse
 -> StackDriftDetectionStatus)
-> (DescribeStackDriftDetectionStatusResponse
    -> StackDriftDetectionStatus
    -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     StackDriftDetectionStatus
     StackDriftDetectionStatus
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 :: (UTCTime -> f UTCTime)
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
describeStackDriftDetectionStatusResponse_timestamp = (DescribeStackDriftDetectionStatusResponse -> ISO8601)
-> (DescribeStackDriftDetectionStatusResponse
    -> ISO8601 -> DescribeStackDriftDetectionStatusResponse)
-> Lens
     DescribeStackDriftDetectionStatusResponse
     DescribeStackDriftDetectionStatusResponse
     ISO8601
     ISO8601
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) ((ISO8601 -> f ISO8601)
 -> DescribeStackDriftDetectionStatusResponse
 -> f DescribeStackDriftDetectionStatusResponse)
-> ((UTCTime -> f UTCTime) -> ISO8601 -> f ISO8601)
-> (UTCTime -> f UTCTime)
-> DescribeStackDriftDetectionStatusResponse
-> f DescribeStackDriftDetectionStatusResponse
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
  Prelude.NFData
    DescribeStackDriftDetectionStatusResponse