{-# 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.DevOpsGuru.Types.CloudFormationHealth
-- 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.DevOpsGuru.Types.CloudFormationHealth where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DevOpsGuru.Types.InsightHealth
import qualified Amazonka.Prelude as Prelude

-- | Information about the health of Amazon Web Services resources in your
-- account that are specified by an Amazon Web Services CloudFormation
-- stack.
--
-- /See:/ 'newCloudFormationHealth' smart constructor.
data CloudFormationHealth = CloudFormationHealth'
  { -- | Number of resources that DevOps Guru is monitoring in your account that
    -- are specified by an Amazon Web Services CloudFormation stack.
    CloudFormationHealth -> Maybe Integer
analyzedResourceCount :: Prelude.Maybe Prelude.Integer,
    -- | Information about the health of the Amazon Web Services resources in
    -- your account that are specified by an Amazon Web Services CloudFormation
    -- stack, including the number of open proactive, open reactive insights,
    -- and the Mean Time to Recover (MTTR) of closed insights.
    CloudFormationHealth -> Maybe InsightHealth
insight :: Prelude.Maybe InsightHealth,
    -- | The name of the CloudFormation stack.
    CloudFormationHealth -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text
  }
  deriving (CloudFormationHealth -> CloudFormationHealth -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CloudFormationHealth -> CloudFormationHealth -> Bool
$c/= :: CloudFormationHealth -> CloudFormationHealth -> Bool
== :: CloudFormationHealth -> CloudFormationHealth -> Bool
$c== :: CloudFormationHealth -> CloudFormationHealth -> Bool
Prelude.Eq, ReadPrec [CloudFormationHealth]
ReadPrec CloudFormationHealth
Int -> ReadS CloudFormationHealth
ReadS [CloudFormationHealth]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CloudFormationHealth]
$creadListPrec :: ReadPrec [CloudFormationHealth]
readPrec :: ReadPrec CloudFormationHealth
$creadPrec :: ReadPrec CloudFormationHealth
readList :: ReadS [CloudFormationHealth]
$creadList :: ReadS [CloudFormationHealth]
readsPrec :: Int -> ReadS CloudFormationHealth
$creadsPrec :: Int -> ReadS CloudFormationHealth
Prelude.Read, Int -> CloudFormationHealth -> ShowS
[CloudFormationHealth] -> ShowS
CloudFormationHealth -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CloudFormationHealth] -> ShowS
$cshowList :: [CloudFormationHealth] -> ShowS
show :: CloudFormationHealth -> String
$cshow :: CloudFormationHealth -> String
showsPrec :: Int -> CloudFormationHealth -> ShowS
$cshowsPrec :: Int -> CloudFormationHealth -> ShowS
Prelude.Show, forall x. Rep CloudFormationHealth x -> CloudFormationHealth
forall x. CloudFormationHealth -> Rep CloudFormationHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CloudFormationHealth x -> CloudFormationHealth
$cfrom :: forall x. CloudFormationHealth -> Rep CloudFormationHealth x
Prelude.Generic)

-- |
-- Create a value of 'CloudFormationHealth' 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:
--
-- 'analyzedResourceCount', 'cloudFormationHealth_analyzedResourceCount' - Number of resources that DevOps Guru is monitoring in your account that
-- are specified by an Amazon Web Services CloudFormation stack.
--
-- 'insight', 'cloudFormationHealth_insight' - Information about the health of the Amazon Web Services resources in
-- your account that are specified by an Amazon Web Services CloudFormation
-- stack, including the number of open proactive, open reactive insights,
-- and the Mean Time to Recover (MTTR) of closed insights.
--
-- 'stackName', 'cloudFormationHealth_stackName' - The name of the CloudFormation stack.
newCloudFormationHealth ::
  CloudFormationHealth
newCloudFormationHealth :: CloudFormationHealth
newCloudFormationHealth =
  CloudFormationHealth'
    { $sel:analyzedResourceCount:CloudFormationHealth' :: Maybe Integer
analyzedResourceCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:insight:CloudFormationHealth' :: Maybe InsightHealth
insight = forall a. Maybe a
Prelude.Nothing,
      $sel:stackName:CloudFormationHealth' :: Maybe Text
stackName = forall a. Maybe a
Prelude.Nothing
    }

-- | Number of resources that DevOps Guru is monitoring in your account that
-- are specified by an Amazon Web Services CloudFormation stack.
cloudFormationHealth_analyzedResourceCount :: Lens.Lens' CloudFormationHealth (Prelude.Maybe Prelude.Integer)
cloudFormationHealth_analyzedResourceCount :: Lens' CloudFormationHealth (Maybe Integer)
cloudFormationHealth_analyzedResourceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationHealth' {Maybe Integer
analyzedResourceCount :: Maybe Integer
$sel:analyzedResourceCount:CloudFormationHealth' :: CloudFormationHealth -> Maybe Integer
analyzedResourceCount} -> Maybe Integer
analyzedResourceCount) (\s :: CloudFormationHealth
s@CloudFormationHealth' {} Maybe Integer
a -> CloudFormationHealth
s {$sel:analyzedResourceCount:CloudFormationHealth' :: Maybe Integer
analyzedResourceCount = Maybe Integer
a} :: CloudFormationHealth)

-- | Information about the health of the Amazon Web Services resources in
-- your account that are specified by an Amazon Web Services CloudFormation
-- stack, including the number of open proactive, open reactive insights,
-- and the Mean Time to Recover (MTTR) of closed insights.
cloudFormationHealth_insight :: Lens.Lens' CloudFormationHealth (Prelude.Maybe InsightHealth)
cloudFormationHealth_insight :: Lens' CloudFormationHealth (Maybe InsightHealth)
cloudFormationHealth_insight = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationHealth' {Maybe InsightHealth
insight :: Maybe InsightHealth
$sel:insight:CloudFormationHealth' :: CloudFormationHealth -> Maybe InsightHealth
insight} -> Maybe InsightHealth
insight) (\s :: CloudFormationHealth
s@CloudFormationHealth' {} Maybe InsightHealth
a -> CloudFormationHealth
s {$sel:insight:CloudFormationHealth' :: Maybe InsightHealth
insight = Maybe InsightHealth
a} :: CloudFormationHealth)

-- | The name of the CloudFormation stack.
cloudFormationHealth_stackName :: Lens.Lens' CloudFormationHealth (Prelude.Maybe Prelude.Text)
cloudFormationHealth_stackName :: Lens' CloudFormationHealth (Maybe Text)
cloudFormationHealth_stackName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CloudFormationHealth' {Maybe Text
stackName :: Maybe Text
$sel:stackName:CloudFormationHealth' :: CloudFormationHealth -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: CloudFormationHealth
s@CloudFormationHealth' {} Maybe Text
a -> CloudFormationHealth
s {$sel:stackName:CloudFormationHealth' :: Maybe Text
stackName = Maybe Text
a} :: CloudFormationHealth)

instance Data.FromJSON CloudFormationHealth where
  parseJSON :: Value -> Parser CloudFormationHealth
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"CloudFormationHealth"
      ( \Object
x ->
          Maybe Integer
-> Maybe InsightHealth -> Maybe Text -> CloudFormationHealth
CloudFormationHealth'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AnalyzedResourceCount")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Insight")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"StackName")
      )

instance Prelude.Hashable CloudFormationHealth where
  hashWithSalt :: Int -> CloudFormationHealth -> Int
hashWithSalt Int
_salt CloudFormationHealth' {Maybe Integer
Maybe Text
Maybe InsightHealth
stackName :: Maybe Text
insight :: Maybe InsightHealth
analyzedResourceCount :: Maybe Integer
$sel:stackName:CloudFormationHealth' :: CloudFormationHealth -> Maybe Text
$sel:insight:CloudFormationHealth' :: CloudFormationHealth -> Maybe InsightHealth
$sel:analyzedResourceCount:CloudFormationHealth' :: CloudFormationHealth -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
analyzedResourceCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InsightHealth
insight
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stackName

instance Prelude.NFData CloudFormationHealth where
  rnf :: CloudFormationHealth -> ()
rnf CloudFormationHealth' {Maybe Integer
Maybe Text
Maybe InsightHealth
stackName :: Maybe Text
insight :: Maybe InsightHealth
analyzedResourceCount :: Maybe Integer
$sel:stackName:CloudFormationHealth' :: CloudFormationHealth -> Maybe Text
$sel:insight:CloudFormationHealth' :: CloudFormationHealth -> Maybe InsightHealth
$sel:analyzedResourceCount:CloudFormationHealth' :: CloudFormationHealth -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
analyzedResourceCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InsightHealth
insight
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stackName