{-# 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.AccountHealth
-- 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.AccountHealth 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.AccountInsightHealth
import qualified Amazonka.Prelude as Prelude

-- | Returns the number of open reactive insights, the number of open
-- proactive insights, and the number of metrics analyzed in your Amazon
-- Web Services account. Use these numbers to gauge the health of
-- operations in your Amazon Web Services account.
--
-- /See:/ 'newAccountHealth' smart constructor.
data AccountHealth = AccountHealth'
  { -- | The ID of the Amazon Web Services account.
    AccountHealth -> Maybe Text
accountId :: Prelude.Maybe Prelude.Text,
    -- | Information about the health of the Amazon Web Services resources in
    -- your account, including the number of open proactive, open reactive
    -- insights, and the Mean Time to Recover (MTTR) of closed insights.
    AccountHealth -> Maybe AccountInsightHealth
insight :: Prelude.Maybe AccountInsightHealth
  }
  deriving (AccountHealth -> AccountHealth -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccountHealth -> AccountHealth -> Bool
$c/= :: AccountHealth -> AccountHealth -> Bool
== :: AccountHealth -> AccountHealth -> Bool
$c== :: AccountHealth -> AccountHealth -> Bool
Prelude.Eq, ReadPrec [AccountHealth]
ReadPrec AccountHealth
Int -> ReadS AccountHealth
ReadS [AccountHealth]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AccountHealth]
$creadListPrec :: ReadPrec [AccountHealth]
readPrec :: ReadPrec AccountHealth
$creadPrec :: ReadPrec AccountHealth
readList :: ReadS [AccountHealth]
$creadList :: ReadS [AccountHealth]
readsPrec :: Int -> ReadS AccountHealth
$creadsPrec :: Int -> ReadS AccountHealth
Prelude.Read, Int -> AccountHealth -> ShowS
[AccountHealth] -> ShowS
AccountHealth -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AccountHealth] -> ShowS
$cshowList :: [AccountHealth] -> ShowS
show :: AccountHealth -> String
$cshow :: AccountHealth -> String
showsPrec :: Int -> AccountHealth -> ShowS
$cshowsPrec :: Int -> AccountHealth -> ShowS
Prelude.Show, forall x. Rep AccountHealth x -> AccountHealth
forall x. AccountHealth -> Rep AccountHealth x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AccountHealth x -> AccountHealth
$cfrom :: forall x. AccountHealth -> Rep AccountHealth x
Prelude.Generic)

-- |
-- Create a value of 'AccountHealth' 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:
--
-- 'accountId', 'accountHealth_accountId' - The ID of the Amazon Web Services account.
--
-- 'insight', 'accountHealth_insight' - Information about the health of the Amazon Web Services resources in
-- your account, including the number of open proactive, open reactive
-- insights, and the Mean Time to Recover (MTTR) of closed insights.
newAccountHealth ::
  AccountHealth
newAccountHealth :: AccountHealth
newAccountHealth =
  AccountHealth'
    { $sel:accountId:AccountHealth' :: Maybe Text
accountId = forall a. Maybe a
Prelude.Nothing,
      $sel:insight:AccountHealth' :: Maybe AccountInsightHealth
insight = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the Amazon Web Services account.
accountHealth_accountId :: Lens.Lens' AccountHealth (Prelude.Maybe Prelude.Text)
accountHealth_accountId :: Lens' AccountHealth (Maybe Text)
accountHealth_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountHealth' {Maybe Text
accountId :: Maybe Text
$sel:accountId:AccountHealth' :: AccountHealth -> Maybe Text
accountId} -> Maybe Text
accountId) (\s :: AccountHealth
s@AccountHealth' {} Maybe Text
a -> AccountHealth
s {$sel:accountId:AccountHealth' :: Maybe Text
accountId = Maybe Text
a} :: AccountHealth)

-- | Information about the health of the Amazon Web Services resources in
-- your account, including the number of open proactive, open reactive
-- insights, and the Mean Time to Recover (MTTR) of closed insights.
accountHealth_insight :: Lens.Lens' AccountHealth (Prelude.Maybe AccountInsightHealth)
accountHealth_insight :: Lens' AccountHealth (Maybe AccountInsightHealth)
accountHealth_insight = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AccountHealth' {Maybe AccountInsightHealth
insight :: Maybe AccountInsightHealth
$sel:insight:AccountHealth' :: AccountHealth -> Maybe AccountInsightHealth
insight} -> Maybe AccountInsightHealth
insight) (\s :: AccountHealth
s@AccountHealth' {} Maybe AccountInsightHealth
a -> AccountHealth
s {$sel:insight:AccountHealth' :: Maybe AccountInsightHealth
insight = Maybe AccountInsightHealth
a} :: AccountHealth)

instance Data.FromJSON AccountHealth where
  parseJSON :: Value -> Parser AccountHealth
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AccountHealth"
      ( \Object
x ->
          Maybe Text -> Maybe AccountInsightHealth -> AccountHealth
AccountHealth'
            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
"AccountId")
            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")
      )

instance Prelude.Hashable AccountHealth where
  hashWithSalt :: Int -> AccountHealth -> Int
hashWithSalt Int
_salt AccountHealth' {Maybe Text
Maybe AccountInsightHealth
insight :: Maybe AccountInsightHealth
accountId :: Maybe Text
$sel:insight:AccountHealth' :: AccountHealth -> Maybe AccountInsightHealth
$sel:accountId:AccountHealth' :: AccountHealth -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
accountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AccountInsightHealth
insight

instance Prelude.NFData AccountHealth where
  rnf :: AccountHealth -> ()
rnf AccountHealth' {Maybe Text
Maybe AccountInsightHealth
insight :: Maybe AccountInsightHealth
accountId :: Maybe Text
$sel:insight:AccountHealth' :: AccountHealth -> Maybe AccountInsightHealth
$sel:accountId:AccountHealth' :: AccountHealth -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
accountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AccountInsightHealth
insight