{-# 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.StackResourceSummary
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.CloudFormation.Types.StackResourceSummary where

import Amazonka.CloudFormation.Types.ModuleInfo
import Amazonka.CloudFormation.Types.ResourceStatus
import Amazonka.CloudFormation.Types.StackResourceDriftInformationSummary
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | Contains high-level information about the specified stack resource.
--
-- /See:/ 'newStackResourceSummary' smart constructor.
data StackResourceSummary = StackResourceSummary'
  { -- | Information about whether the resource\'s actual configuration differs,
    -- or has /drifted/, from its expected configuration, as defined in the
    -- stack template and any values specified as template parameters. For more
    -- information, see
    -- <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html Detecting Unregulated Configuration Changes to Stacks and Resources>.
    StackResourceSummary -> Maybe StackResourceDriftInformationSummary
driftInformation :: Prelude.Maybe StackResourceDriftInformationSummary,
    -- | Contains information about the module from which the resource was
    -- created, if the resource was created from a module included in the stack
    -- template.
    StackResourceSummary -> Maybe ModuleInfo
moduleInfo :: Prelude.Maybe ModuleInfo,
    -- | The name or unique identifier that corresponds to a physical instance ID
    -- of the resource.
    StackResourceSummary -> Maybe Text
physicalResourceId :: Prelude.Maybe Prelude.Text,
    -- | Success\/failure message associated with the resource.
    StackResourceSummary -> Maybe Text
resourceStatusReason :: Prelude.Maybe Prelude.Text,
    -- | The logical name of the resource specified in the template.
    StackResourceSummary -> Text
logicalResourceId :: Prelude.Text,
    -- | Type of resource. (For more information, go to
    -- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Amazon Web Services Resource Types Reference>
    -- in the CloudFormation User Guide.)
    StackResourceSummary -> Text
resourceType :: Prelude.Text,
    -- | Time the status was updated.
    StackResourceSummary -> ISO8601
lastUpdatedTimestamp :: Data.ISO8601,
    -- | Current status of the resource.
    StackResourceSummary -> ResourceStatus
resourceStatus :: ResourceStatus
  }
  deriving (StackResourceSummary -> StackResourceSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StackResourceSummary -> StackResourceSummary -> Bool
$c/= :: StackResourceSummary -> StackResourceSummary -> Bool
== :: StackResourceSummary -> StackResourceSummary -> Bool
$c== :: StackResourceSummary -> StackResourceSummary -> Bool
Prelude.Eq, ReadPrec [StackResourceSummary]
ReadPrec StackResourceSummary
Int -> ReadS StackResourceSummary
ReadS [StackResourceSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StackResourceSummary]
$creadListPrec :: ReadPrec [StackResourceSummary]
readPrec :: ReadPrec StackResourceSummary
$creadPrec :: ReadPrec StackResourceSummary
readList :: ReadS [StackResourceSummary]
$creadList :: ReadS [StackResourceSummary]
readsPrec :: Int -> ReadS StackResourceSummary
$creadsPrec :: Int -> ReadS StackResourceSummary
Prelude.Read, Int -> StackResourceSummary -> ShowS
[StackResourceSummary] -> ShowS
StackResourceSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StackResourceSummary] -> ShowS
$cshowList :: [StackResourceSummary] -> ShowS
show :: StackResourceSummary -> String
$cshow :: StackResourceSummary -> String
showsPrec :: Int -> StackResourceSummary -> ShowS
$cshowsPrec :: Int -> StackResourceSummary -> ShowS
Prelude.Show, forall x. Rep StackResourceSummary x -> StackResourceSummary
forall x. StackResourceSummary -> Rep StackResourceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StackResourceSummary x -> StackResourceSummary
$cfrom :: forall x. StackResourceSummary -> Rep StackResourceSummary x
Prelude.Generic)

-- |
-- Create a value of 'StackResourceSummary' 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:
--
-- 'driftInformation', 'stackResourceSummary_driftInformation' - Information about whether the resource\'s actual configuration differs,
-- or has /drifted/, from its expected configuration, as defined in the
-- stack template and any values specified as template parameters. For more
-- information, see
-- <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html Detecting Unregulated Configuration Changes to Stacks and Resources>.
--
-- 'moduleInfo', 'stackResourceSummary_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.
--
-- 'physicalResourceId', 'stackResourceSummary_physicalResourceId' - The name or unique identifier that corresponds to a physical instance ID
-- of the resource.
--
-- 'resourceStatusReason', 'stackResourceSummary_resourceStatusReason' - Success\/failure message associated with the resource.
--
-- 'logicalResourceId', 'stackResourceSummary_logicalResourceId' - The logical name of the resource specified in the template.
--
-- 'resourceType', 'stackResourceSummary_resourceType' - Type of resource. (For more information, go to
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Amazon Web Services Resource Types Reference>
-- in the CloudFormation User Guide.)
--
-- 'lastUpdatedTimestamp', 'stackResourceSummary_lastUpdatedTimestamp' - Time the status was updated.
--
-- 'resourceStatus', 'stackResourceSummary_resourceStatus' - Current status of the resource.
newStackResourceSummary ::
  -- | 'logicalResourceId'
  Prelude.Text ->
  -- | 'resourceType'
  Prelude.Text ->
  -- | 'lastUpdatedTimestamp'
  Prelude.UTCTime ->
  -- | 'resourceStatus'
  ResourceStatus ->
  StackResourceSummary
newStackResourceSummary :: Text -> Text -> UTCTime -> ResourceStatus -> StackResourceSummary
newStackResourceSummary
  Text
pLogicalResourceId_
  Text
pResourceType_
  UTCTime
pLastUpdatedTimestamp_
  ResourceStatus
pResourceStatus_ =
    StackResourceSummary'
      { $sel:driftInformation:StackResourceSummary' :: Maybe StackResourceDriftInformationSummary
driftInformation =
          forall a. Maybe a
Prelude.Nothing,
        $sel:moduleInfo:StackResourceSummary' :: Maybe ModuleInfo
moduleInfo = forall a. Maybe a
Prelude.Nothing,
        $sel:physicalResourceId:StackResourceSummary' :: Maybe Text
physicalResourceId = forall a. Maybe a
Prelude.Nothing,
        $sel:resourceStatusReason:StackResourceSummary' :: Maybe Text
resourceStatusReason = forall a. Maybe a
Prelude.Nothing,
        $sel:logicalResourceId:StackResourceSummary' :: Text
logicalResourceId = Text
pLogicalResourceId_,
        $sel:resourceType:StackResourceSummary' :: Text
resourceType = Text
pResourceType_,
        $sel:lastUpdatedTimestamp:StackResourceSummary' :: ISO8601
lastUpdatedTimestamp =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pLastUpdatedTimestamp_,
        $sel:resourceStatus:StackResourceSummary' :: ResourceStatus
resourceStatus = ResourceStatus
pResourceStatus_
      }

-- | Information about whether the resource\'s actual configuration differs,
-- or has /drifted/, from its expected configuration, as defined in the
-- stack template and any values specified as template parameters. For more
-- information, see
-- <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html Detecting Unregulated Configuration Changes to Stacks and Resources>.
stackResourceSummary_driftInformation :: Lens.Lens' StackResourceSummary (Prelude.Maybe StackResourceDriftInformationSummary)
stackResourceSummary_driftInformation :: Lens'
  StackResourceSummary (Maybe StackResourceDriftInformationSummary)
stackResourceSummary_driftInformation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceSummary' {Maybe StackResourceDriftInformationSummary
driftInformation :: Maybe StackResourceDriftInformationSummary
$sel:driftInformation:StackResourceSummary' :: StackResourceSummary -> Maybe StackResourceDriftInformationSummary
driftInformation} -> Maybe StackResourceDriftInformationSummary
driftInformation) (\s :: StackResourceSummary
s@StackResourceSummary' {} Maybe StackResourceDriftInformationSummary
a -> StackResourceSummary
s {$sel:driftInformation:StackResourceSummary' :: Maybe StackResourceDriftInformationSummary
driftInformation = Maybe StackResourceDriftInformationSummary
a} :: StackResourceSummary)

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

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

-- | Success\/failure message associated with the resource.
stackResourceSummary_resourceStatusReason :: Lens.Lens' StackResourceSummary (Prelude.Maybe Prelude.Text)
stackResourceSummary_resourceStatusReason :: Lens' StackResourceSummary (Maybe Text)
stackResourceSummary_resourceStatusReason = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceSummary' {Maybe Text
resourceStatusReason :: Maybe Text
$sel:resourceStatusReason:StackResourceSummary' :: StackResourceSummary -> Maybe Text
resourceStatusReason} -> Maybe Text
resourceStatusReason) (\s :: StackResourceSummary
s@StackResourceSummary' {} Maybe Text
a -> StackResourceSummary
s {$sel:resourceStatusReason:StackResourceSummary' :: Maybe Text
resourceStatusReason = Maybe Text
a} :: StackResourceSummary)

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

-- | Type of resource. (For more information, go to
-- <https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html Amazon Web Services Resource Types Reference>
-- in the CloudFormation User Guide.)
stackResourceSummary_resourceType :: Lens.Lens' StackResourceSummary Prelude.Text
stackResourceSummary_resourceType :: Lens' StackResourceSummary Text
stackResourceSummary_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceSummary' {Text
resourceType :: Text
$sel:resourceType:StackResourceSummary' :: StackResourceSummary -> Text
resourceType} -> Text
resourceType) (\s :: StackResourceSummary
s@StackResourceSummary' {} Text
a -> StackResourceSummary
s {$sel:resourceType:StackResourceSummary' :: Text
resourceType = Text
a} :: StackResourceSummary)

-- | Time the status was updated.
stackResourceSummary_lastUpdatedTimestamp :: Lens.Lens' StackResourceSummary Prelude.UTCTime
stackResourceSummary_lastUpdatedTimestamp :: Lens' StackResourceSummary UTCTime
stackResourceSummary_lastUpdatedTimestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceSummary' {ISO8601
lastUpdatedTimestamp :: ISO8601
$sel:lastUpdatedTimestamp:StackResourceSummary' :: StackResourceSummary -> ISO8601
lastUpdatedTimestamp} -> ISO8601
lastUpdatedTimestamp) (\s :: StackResourceSummary
s@StackResourceSummary' {} ISO8601
a -> StackResourceSummary
s {$sel:lastUpdatedTimestamp:StackResourceSummary' :: ISO8601
lastUpdatedTimestamp = ISO8601
a} :: StackResourceSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Current status of the resource.
stackResourceSummary_resourceStatus :: Lens.Lens' StackResourceSummary ResourceStatus
stackResourceSummary_resourceStatus :: Lens' StackResourceSummary ResourceStatus
stackResourceSummary_resourceStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StackResourceSummary' {ResourceStatus
resourceStatus :: ResourceStatus
$sel:resourceStatus:StackResourceSummary' :: StackResourceSummary -> ResourceStatus
resourceStatus} -> ResourceStatus
resourceStatus) (\s :: StackResourceSummary
s@StackResourceSummary' {} ResourceStatus
a -> StackResourceSummary
s {$sel:resourceStatus:StackResourceSummary' :: ResourceStatus
resourceStatus = ResourceStatus
a} :: StackResourceSummary)

instance Data.FromXML StackResourceSummary where
  parseXML :: [Node] -> Either String StackResourceSummary
parseXML [Node]
x =
    Maybe StackResourceDriftInformationSummary
-> Maybe ModuleInfo
-> Maybe Text
-> Maybe Text
-> Text
-> Text
-> ISO8601
-> ResourceStatus
-> StackResourceSummary
StackResourceSummary'
      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
"DriftInformation")
      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
"ModuleInfo")
      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
"PhysicalResourceId")
      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
"ResourceStatusReason")
      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
"LogicalResourceId")
      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
"ResourceType")
      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
"LastUpdatedTimestamp")
      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
"ResourceStatus")

instance Prelude.Hashable StackResourceSummary where
  hashWithSalt :: Int -> StackResourceSummary -> Int
hashWithSalt Int
_salt StackResourceSummary' {Maybe Text
Maybe ModuleInfo
Maybe StackResourceDriftInformationSummary
Text
ISO8601
ResourceStatus
resourceStatus :: ResourceStatus
lastUpdatedTimestamp :: ISO8601
resourceType :: Text
logicalResourceId :: Text
resourceStatusReason :: Maybe Text
physicalResourceId :: Maybe Text
moduleInfo :: Maybe ModuleInfo
driftInformation :: Maybe StackResourceDriftInformationSummary
$sel:resourceStatus:StackResourceSummary' :: StackResourceSummary -> ResourceStatus
$sel:lastUpdatedTimestamp:StackResourceSummary' :: StackResourceSummary -> ISO8601
$sel:resourceType:StackResourceSummary' :: StackResourceSummary -> Text
$sel:logicalResourceId:StackResourceSummary' :: StackResourceSummary -> Text
$sel:resourceStatusReason:StackResourceSummary' :: StackResourceSummary -> Maybe Text
$sel:physicalResourceId:StackResourceSummary' :: StackResourceSummary -> Maybe Text
$sel:moduleInfo:StackResourceSummary' :: StackResourceSummary -> Maybe ModuleInfo
$sel:driftInformation:StackResourceSummary' :: StackResourceSummary -> Maybe StackResourceDriftInformationSummary
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe StackResourceDriftInformationSummary
driftInformation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ModuleInfo
moduleInfo
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
physicalResourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceStatusReason
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logicalResourceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ISO8601
lastUpdatedTimestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceStatus
resourceStatus

instance Prelude.NFData StackResourceSummary where
  rnf :: StackResourceSummary -> ()
rnf StackResourceSummary' {Maybe Text
Maybe ModuleInfo
Maybe StackResourceDriftInformationSummary
Text
ISO8601
ResourceStatus
resourceStatus :: ResourceStatus
lastUpdatedTimestamp :: ISO8601
resourceType :: Text
logicalResourceId :: Text
resourceStatusReason :: Maybe Text
physicalResourceId :: Maybe Text
moduleInfo :: Maybe ModuleInfo
driftInformation :: Maybe StackResourceDriftInformationSummary
$sel:resourceStatus:StackResourceSummary' :: StackResourceSummary -> ResourceStatus
$sel:lastUpdatedTimestamp:StackResourceSummary' :: StackResourceSummary -> ISO8601
$sel:resourceType:StackResourceSummary' :: StackResourceSummary -> Text
$sel:logicalResourceId:StackResourceSummary' :: StackResourceSummary -> Text
$sel:resourceStatusReason:StackResourceSummary' :: StackResourceSummary -> Maybe Text
$sel:physicalResourceId:StackResourceSummary' :: StackResourceSummary -> Maybe Text
$sel:moduleInfo:StackResourceSummary' :: StackResourceSummary -> Maybe ModuleInfo
$sel:driftInformation:StackResourceSummary' :: StackResourceSummary -> Maybe StackResourceDriftInformationSummary
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe StackResourceDriftInformationSummary
driftInformation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ModuleInfo
moduleInfo
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
physicalResourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceStatusReason
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
logicalResourceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resourceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ISO8601
lastUpdatedTimestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceStatus
resourceStatus