{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.DevOpsGuru.Types.CloudFormationHealth where

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

-- | Information about the health of AWS resources in your account that are
-- specified by an AWS CloudFormation stack.
--
-- /See:/ 'newCloudFormationHealth' smart constructor.
data CloudFormationHealth = CloudFormationHealth'
  { -- | Information about the health of the AWS resources in your account that
    -- are specified by an AWS 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
(CloudFormationHealth -> CloudFormationHealth -> Bool)
-> (CloudFormationHealth -> CloudFormationHealth -> Bool)
-> Eq CloudFormationHealth
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]
(Int -> ReadS CloudFormationHealth)
-> ReadS [CloudFormationHealth]
-> ReadPrec CloudFormationHealth
-> ReadPrec [CloudFormationHealth]
-> Read 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
(Int -> CloudFormationHealth -> ShowS)
-> (CloudFormationHealth -> String)
-> ([CloudFormationHealth] -> ShowS)
-> Show CloudFormationHealth
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. CloudFormationHealth -> Rep CloudFormationHealth x)
-> (forall x. Rep CloudFormationHealth x -> CloudFormationHealth)
-> Generic CloudFormationHealth
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:
--
-- 'insight', 'cloudFormationHealth_insight' - Information about the health of the AWS resources in your account that
-- are specified by an AWS 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' :: Maybe InsightHealth -> Maybe Text -> CloudFormationHealth
CloudFormationHealth'
    { $sel:insight:CloudFormationHealth' :: Maybe InsightHealth
insight = Maybe InsightHealth
forall a. Maybe a
Prelude.Nothing,
      $sel:stackName:CloudFormationHealth' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the health of the AWS resources in your account that
-- are specified by an AWS 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 :: (Maybe InsightHealth -> f (Maybe InsightHealth))
-> CloudFormationHealth -> f CloudFormationHealth
cloudFormationHealth_insight = (CloudFormationHealth -> Maybe InsightHealth)
-> (CloudFormationHealth
    -> Maybe InsightHealth -> CloudFormationHealth)
-> Lens
     CloudFormationHealth
     CloudFormationHealth
     (Maybe InsightHealth)
     (Maybe InsightHealth)
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 :: (Maybe Text -> f (Maybe Text))
-> CloudFormationHealth -> f CloudFormationHealth
cloudFormationHealth_stackName = (CloudFormationHealth -> Maybe Text)
-> (CloudFormationHealth -> Maybe Text -> CloudFormationHealth)
-> Lens
     CloudFormationHealth CloudFormationHealth (Maybe Text) (Maybe Text)
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 Core.FromJSON CloudFormationHealth where
  parseJSON :: Value -> Parser CloudFormationHealth
parseJSON =
    String
-> (Object -> Parser CloudFormationHealth)
-> Value
-> Parser CloudFormationHealth
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CloudFormationHealth"
      ( \Object
x ->
          Maybe InsightHealth -> Maybe Text -> CloudFormationHealth
CloudFormationHealth'
            (Maybe InsightHealth -> Maybe Text -> CloudFormationHealth)
-> Parser (Maybe InsightHealth)
-> Parser (Maybe Text -> CloudFormationHealth)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe InsightHealth)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Insight")
            Parser (Maybe Text -> CloudFormationHealth)
-> Parser (Maybe Text) -> Parser CloudFormationHealth
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StackName")
      )

instance Prelude.Hashable CloudFormationHealth

instance Prelude.NFData CloudFormationHealth