{-# 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.Support.Types.TrustedAdvisorCheckSummary
-- 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.Support.Types.TrustedAdvisorCheckSummary where

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
import Amazonka.Support.Types.TrustedAdvisorCategorySpecificSummary
import Amazonka.Support.Types.TrustedAdvisorResourcesSummary

-- | A summary of a Trusted Advisor check result, including the alert status,
-- last refresh, and number of resources examined.
--
-- /See:/ 'newTrustedAdvisorCheckSummary' smart constructor.
data TrustedAdvisorCheckSummary = TrustedAdvisorCheckSummary'
  { -- | Specifies whether the Trusted Advisor check has flagged resources.
    TrustedAdvisorCheckSummary -> Maybe Bool
hasFlaggedResources :: Prelude.Maybe Prelude.Bool,
    -- | The unique identifier for the Trusted Advisor check.
    TrustedAdvisorCheckSummary -> Text
checkId :: Prelude.Text,
    -- | The time of the last refresh of the check.
    TrustedAdvisorCheckSummary -> Text
timestamp :: Prelude.Text,
    -- | The alert status of the check: \"ok\" (green), \"warning\" (yellow),
    -- \"error\" (red), or \"not_available\".
    TrustedAdvisorCheckSummary -> Text
status :: Prelude.Text,
    TrustedAdvisorCheckSummary -> TrustedAdvisorResourcesSummary
resourcesSummary :: TrustedAdvisorResourcesSummary,
    -- | Summary information that relates to the category of the check. Cost
    -- Optimizing is the only category that is currently supported.
    TrustedAdvisorCheckSummary -> TrustedAdvisorCategorySpecificSummary
categorySpecificSummary :: TrustedAdvisorCategorySpecificSummary
  }
  deriving (TrustedAdvisorCheckSummary -> TrustedAdvisorCheckSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrustedAdvisorCheckSummary -> TrustedAdvisorCheckSummary -> Bool
$c/= :: TrustedAdvisorCheckSummary -> TrustedAdvisorCheckSummary -> Bool
== :: TrustedAdvisorCheckSummary -> TrustedAdvisorCheckSummary -> Bool
$c== :: TrustedAdvisorCheckSummary -> TrustedAdvisorCheckSummary -> Bool
Prelude.Eq, ReadPrec [TrustedAdvisorCheckSummary]
ReadPrec TrustedAdvisorCheckSummary
Int -> ReadS TrustedAdvisorCheckSummary
ReadS [TrustedAdvisorCheckSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrustedAdvisorCheckSummary]
$creadListPrec :: ReadPrec [TrustedAdvisorCheckSummary]
readPrec :: ReadPrec TrustedAdvisorCheckSummary
$creadPrec :: ReadPrec TrustedAdvisorCheckSummary
readList :: ReadS [TrustedAdvisorCheckSummary]
$creadList :: ReadS [TrustedAdvisorCheckSummary]
readsPrec :: Int -> ReadS TrustedAdvisorCheckSummary
$creadsPrec :: Int -> ReadS TrustedAdvisorCheckSummary
Prelude.Read, Int -> TrustedAdvisorCheckSummary -> ShowS
[TrustedAdvisorCheckSummary] -> ShowS
TrustedAdvisorCheckSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrustedAdvisorCheckSummary] -> ShowS
$cshowList :: [TrustedAdvisorCheckSummary] -> ShowS
show :: TrustedAdvisorCheckSummary -> String
$cshow :: TrustedAdvisorCheckSummary -> String
showsPrec :: Int -> TrustedAdvisorCheckSummary -> ShowS
$cshowsPrec :: Int -> TrustedAdvisorCheckSummary -> ShowS
Prelude.Show, forall x.
Rep TrustedAdvisorCheckSummary x -> TrustedAdvisorCheckSummary
forall x.
TrustedAdvisorCheckSummary -> Rep TrustedAdvisorCheckSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TrustedAdvisorCheckSummary x -> TrustedAdvisorCheckSummary
$cfrom :: forall x.
TrustedAdvisorCheckSummary -> Rep TrustedAdvisorCheckSummary x
Prelude.Generic)

-- |
-- Create a value of 'TrustedAdvisorCheckSummary' 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:
--
-- 'hasFlaggedResources', 'trustedAdvisorCheckSummary_hasFlaggedResources' - Specifies whether the Trusted Advisor check has flagged resources.
--
-- 'checkId', 'trustedAdvisorCheckSummary_checkId' - The unique identifier for the Trusted Advisor check.
--
-- 'timestamp', 'trustedAdvisorCheckSummary_timestamp' - The time of the last refresh of the check.
--
-- 'status', 'trustedAdvisorCheckSummary_status' - The alert status of the check: \"ok\" (green), \"warning\" (yellow),
-- \"error\" (red), or \"not_available\".
--
-- 'resourcesSummary', 'trustedAdvisorCheckSummary_resourcesSummary' - Undocumented member.
--
-- 'categorySpecificSummary', 'trustedAdvisorCheckSummary_categorySpecificSummary' - Summary information that relates to the category of the check. Cost
-- Optimizing is the only category that is currently supported.
newTrustedAdvisorCheckSummary ::
  -- | 'checkId'
  Prelude.Text ->
  -- | 'timestamp'
  Prelude.Text ->
  -- | 'status'
  Prelude.Text ->
  -- | 'resourcesSummary'
  TrustedAdvisorResourcesSummary ->
  -- | 'categorySpecificSummary'
  TrustedAdvisorCategorySpecificSummary ->
  TrustedAdvisorCheckSummary
newTrustedAdvisorCheckSummary :: Text
-> Text
-> Text
-> TrustedAdvisorResourcesSummary
-> TrustedAdvisorCategorySpecificSummary
-> TrustedAdvisorCheckSummary
newTrustedAdvisorCheckSummary
  Text
pCheckId_
  Text
pTimestamp_
  Text
pStatus_
  TrustedAdvisorResourcesSummary
pResourcesSummary_
  TrustedAdvisorCategorySpecificSummary
pCategorySpecificSummary_ =
    TrustedAdvisorCheckSummary'
      { $sel:hasFlaggedResources:TrustedAdvisorCheckSummary' :: Maybe Bool
hasFlaggedResources =
          forall a. Maybe a
Prelude.Nothing,
        $sel:checkId:TrustedAdvisorCheckSummary' :: Text
checkId = Text
pCheckId_,
        $sel:timestamp:TrustedAdvisorCheckSummary' :: Text
timestamp = Text
pTimestamp_,
        $sel:status:TrustedAdvisorCheckSummary' :: Text
status = Text
pStatus_,
        $sel:resourcesSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorResourcesSummary
resourcesSummary = TrustedAdvisorResourcesSummary
pResourcesSummary_,
        $sel:categorySpecificSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCategorySpecificSummary
categorySpecificSummary =
          TrustedAdvisorCategorySpecificSummary
pCategorySpecificSummary_
      }

-- | Specifies whether the Trusted Advisor check has flagged resources.
trustedAdvisorCheckSummary_hasFlaggedResources :: Lens.Lens' TrustedAdvisorCheckSummary (Prelude.Maybe Prelude.Bool)
trustedAdvisorCheckSummary_hasFlaggedResources :: Lens' TrustedAdvisorCheckSummary (Maybe Bool)
trustedAdvisorCheckSummary_hasFlaggedResources = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustedAdvisorCheckSummary' {Maybe Bool
hasFlaggedResources :: Maybe Bool
$sel:hasFlaggedResources:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Maybe Bool
hasFlaggedResources} -> Maybe Bool
hasFlaggedResources) (\s :: TrustedAdvisorCheckSummary
s@TrustedAdvisorCheckSummary' {} Maybe Bool
a -> TrustedAdvisorCheckSummary
s {$sel:hasFlaggedResources:TrustedAdvisorCheckSummary' :: Maybe Bool
hasFlaggedResources = Maybe Bool
a} :: TrustedAdvisorCheckSummary)

-- | The unique identifier for the Trusted Advisor check.
trustedAdvisorCheckSummary_checkId :: Lens.Lens' TrustedAdvisorCheckSummary Prelude.Text
trustedAdvisorCheckSummary_checkId :: Lens' TrustedAdvisorCheckSummary Text
trustedAdvisorCheckSummary_checkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustedAdvisorCheckSummary' {Text
checkId :: Text
$sel:checkId:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
checkId} -> Text
checkId) (\s :: TrustedAdvisorCheckSummary
s@TrustedAdvisorCheckSummary' {} Text
a -> TrustedAdvisorCheckSummary
s {$sel:checkId:TrustedAdvisorCheckSummary' :: Text
checkId = Text
a} :: TrustedAdvisorCheckSummary)

-- | The time of the last refresh of the check.
trustedAdvisorCheckSummary_timestamp :: Lens.Lens' TrustedAdvisorCheckSummary Prelude.Text
trustedAdvisorCheckSummary_timestamp :: Lens' TrustedAdvisorCheckSummary Text
trustedAdvisorCheckSummary_timestamp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustedAdvisorCheckSummary' {Text
timestamp :: Text
$sel:timestamp:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
timestamp} -> Text
timestamp) (\s :: TrustedAdvisorCheckSummary
s@TrustedAdvisorCheckSummary' {} Text
a -> TrustedAdvisorCheckSummary
s {$sel:timestamp:TrustedAdvisorCheckSummary' :: Text
timestamp = Text
a} :: TrustedAdvisorCheckSummary)

-- | The alert status of the check: \"ok\" (green), \"warning\" (yellow),
-- \"error\" (red), or \"not_available\".
trustedAdvisorCheckSummary_status :: Lens.Lens' TrustedAdvisorCheckSummary Prelude.Text
trustedAdvisorCheckSummary_status :: Lens' TrustedAdvisorCheckSummary Text
trustedAdvisorCheckSummary_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustedAdvisorCheckSummary' {Text
status :: Text
$sel:status:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
status} -> Text
status) (\s :: TrustedAdvisorCheckSummary
s@TrustedAdvisorCheckSummary' {} Text
a -> TrustedAdvisorCheckSummary
s {$sel:status:TrustedAdvisorCheckSummary' :: Text
status = Text
a} :: TrustedAdvisorCheckSummary)

-- | Undocumented member.
trustedAdvisorCheckSummary_resourcesSummary :: Lens.Lens' TrustedAdvisorCheckSummary TrustedAdvisorResourcesSummary
trustedAdvisorCheckSummary_resourcesSummary :: Lens' TrustedAdvisorCheckSummary TrustedAdvisorResourcesSummary
trustedAdvisorCheckSummary_resourcesSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustedAdvisorCheckSummary' {TrustedAdvisorResourcesSummary
resourcesSummary :: TrustedAdvisorResourcesSummary
$sel:resourcesSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> TrustedAdvisorResourcesSummary
resourcesSummary} -> TrustedAdvisorResourcesSummary
resourcesSummary) (\s :: TrustedAdvisorCheckSummary
s@TrustedAdvisorCheckSummary' {} TrustedAdvisorResourcesSummary
a -> TrustedAdvisorCheckSummary
s {$sel:resourcesSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorResourcesSummary
resourcesSummary = TrustedAdvisorResourcesSummary
a} :: TrustedAdvisorCheckSummary)

-- | Summary information that relates to the category of the check. Cost
-- Optimizing is the only category that is currently supported.
trustedAdvisorCheckSummary_categorySpecificSummary :: Lens.Lens' TrustedAdvisorCheckSummary TrustedAdvisorCategorySpecificSummary
trustedAdvisorCheckSummary_categorySpecificSummary :: Lens'
  TrustedAdvisorCheckSummary TrustedAdvisorCategorySpecificSummary
trustedAdvisorCheckSummary_categorySpecificSummary = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrustedAdvisorCheckSummary' {TrustedAdvisorCategorySpecificSummary
categorySpecificSummary :: TrustedAdvisorCategorySpecificSummary
$sel:categorySpecificSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> TrustedAdvisorCategorySpecificSummary
categorySpecificSummary} -> TrustedAdvisorCategorySpecificSummary
categorySpecificSummary) (\s :: TrustedAdvisorCheckSummary
s@TrustedAdvisorCheckSummary' {} TrustedAdvisorCategorySpecificSummary
a -> TrustedAdvisorCheckSummary
s {$sel:categorySpecificSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCategorySpecificSummary
categorySpecificSummary = TrustedAdvisorCategorySpecificSummary
a} :: TrustedAdvisorCheckSummary)

instance Data.FromJSON TrustedAdvisorCheckSummary where
  parseJSON :: Value -> Parser TrustedAdvisorCheckSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TrustedAdvisorCheckSummary"
      ( \Object
x ->
          Maybe Bool
-> Text
-> Text
-> Text
-> TrustedAdvisorResourcesSummary
-> TrustedAdvisorCategorySpecificSummary
-> TrustedAdvisorCheckSummary
TrustedAdvisorCheckSummary'
            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
"hasFlaggedResources")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"checkId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"timestamp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"resourcesSummary")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"categorySpecificSummary")
      )

instance Prelude.Hashable TrustedAdvisorCheckSummary where
  hashWithSalt :: Int -> TrustedAdvisorCheckSummary -> Int
hashWithSalt Int
_salt TrustedAdvisorCheckSummary' {Maybe Bool
Text
TrustedAdvisorCategorySpecificSummary
TrustedAdvisorResourcesSummary
categorySpecificSummary :: TrustedAdvisorCategorySpecificSummary
resourcesSummary :: TrustedAdvisorResourcesSummary
status :: Text
timestamp :: Text
checkId :: Text
hasFlaggedResources :: Maybe Bool
$sel:categorySpecificSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> TrustedAdvisorCategorySpecificSummary
$sel:resourcesSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> TrustedAdvisorResourcesSummary
$sel:status:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
$sel:timestamp:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
$sel:checkId:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
$sel:hasFlaggedResources:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hasFlaggedResources
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
checkId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
timestamp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TrustedAdvisorResourcesSummary
resourcesSummary
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` TrustedAdvisorCategorySpecificSummary
categorySpecificSummary

instance Prelude.NFData TrustedAdvisorCheckSummary where
  rnf :: TrustedAdvisorCheckSummary -> ()
rnf TrustedAdvisorCheckSummary' {Maybe Bool
Text
TrustedAdvisorCategorySpecificSummary
TrustedAdvisorResourcesSummary
categorySpecificSummary :: TrustedAdvisorCategorySpecificSummary
resourcesSummary :: TrustedAdvisorResourcesSummary
status :: Text
timestamp :: Text
checkId :: Text
hasFlaggedResources :: Maybe Bool
$sel:categorySpecificSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> TrustedAdvisorCategorySpecificSummary
$sel:resourcesSummary:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> TrustedAdvisorResourcesSummary
$sel:status:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
$sel:timestamp:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
$sel:checkId:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Text
$sel:hasFlaggedResources:TrustedAdvisorCheckSummary' :: TrustedAdvisorCheckSummary -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hasFlaggedResources
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
checkId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
timestamp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TrustedAdvisorResourcesSummary
resourcesSummary
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf TrustedAdvisorCategorySpecificSummary
categorySpecificSummary