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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(TrustedAdvisorCheckSummary -> TrustedAdvisorCheckSummary -> Bool)
-> (TrustedAdvisorCheckSummary
    -> TrustedAdvisorCheckSummary -> Bool)
-> Eq TrustedAdvisorCheckSummary
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]
(Int -> ReadS TrustedAdvisorCheckSummary)
-> ReadS [TrustedAdvisorCheckSummary]
-> ReadPrec TrustedAdvisorCheckSummary
-> ReadPrec [TrustedAdvisorCheckSummary]
-> Read 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
(Int -> TrustedAdvisorCheckSummary -> ShowS)
-> (TrustedAdvisorCheckSummary -> String)
-> ([TrustedAdvisorCheckSummary] -> ShowS)
-> Show TrustedAdvisorCheckSummary
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.
 TrustedAdvisorCheckSummary -> Rep TrustedAdvisorCheckSummary x)
-> (forall x.
    Rep TrustedAdvisorCheckSummary x -> TrustedAdvisorCheckSummary)
-> Generic TrustedAdvisorCheckSummary
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' :: Maybe Bool
-> Text
-> Text
-> Text
-> TrustedAdvisorResourcesSummary
-> TrustedAdvisorCategorySpecificSummary
-> TrustedAdvisorCheckSummary
TrustedAdvisorCheckSummary'
      { $sel:hasFlaggedResources:TrustedAdvisorCheckSummary' :: Maybe Bool
hasFlaggedResources =
          Maybe Bool
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 :: (Maybe Bool -> f (Maybe Bool))
-> TrustedAdvisorCheckSummary -> f TrustedAdvisorCheckSummary
trustedAdvisorCheckSummary_hasFlaggedResources = (TrustedAdvisorCheckSummary -> Maybe Bool)
-> (TrustedAdvisorCheckSummary
    -> Maybe Bool -> TrustedAdvisorCheckSummary)
-> Lens
     TrustedAdvisorCheckSummary
     TrustedAdvisorCheckSummary
     (Maybe Bool)
     (Maybe Bool)
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 :: (Text -> f Text)
-> TrustedAdvisorCheckSummary -> f TrustedAdvisorCheckSummary
trustedAdvisorCheckSummary_checkId = (TrustedAdvisorCheckSummary -> Text)
-> (TrustedAdvisorCheckSummary
    -> Text -> TrustedAdvisorCheckSummary)
-> Lens
     TrustedAdvisorCheckSummary TrustedAdvisorCheckSummary Text Text
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 :: (Text -> f Text)
-> TrustedAdvisorCheckSummary -> f TrustedAdvisorCheckSummary
trustedAdvisorCheckSummary_timestamp = (TrustedAdvisorCheckSummary -> Text)
-> (TrustedAdvisorCheckSummary
    -> Text -> TrustedAdvisorCheckSummary)
-> Lens
     TrustedAdvisorCheckSummary TrustedAdvisorCheckSummary Text Text
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 :: (Text -> f Text)
-> TrustedAdvisorCheckSummary -> f TrustedAdvisorCheckSummary
trustedAdvisorCheckSummary_status = (TrustedAdvisorCheckSummary -> Text)
-> (TrustedAdvisorCheckSummary
    -> Text -> TrustedAdvisorCheckSummary)
-> Lens
     TrustedAdvisorCheckSummary TrustedAdvisorCheckSummary Text Text
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 :: (TrustedAdvisorResourcesSummary
 -> f TrustedAdvisorResourcesSummary)
-> TrustedAdvisorCheckSummary -> f TrustedAdvisorCheckSummary
trustedAdvisorCheckSummary_resourcesSummary = (TrustedAdvisorCheckSummary -> TrustedAdvisorResourcesSummary)
-> (TrustedAdvisorCheckSummary
    -> TrustedAdvisorResourcesSummary -> TrustedAdvisorCheckSummary)
-> Lens
     TrustedAdvisorCheckSummary
     TrustedAdvisorCheckSummary
     TrustedAdvisorResourcesSummary
     TrustedAdvisorResourcesSummary
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 :: (TrustedAdvisorCategorySpecificSummary
 -> f TrustedAdvisorCategorySpecificSummary)
-> TrustedAdvisorCheckSummary -> f TrustedAdvisorCheckSummary
trustedAdvisorCheckSummary_categorySpecificSummary = (TrustedAdvisorCheckSummary
 -> TrustedAdvisorCategorySpecificSummary)
-> (TrustedAdvisorCheckSummary
    -> TrustedAdvisorCategorySpecificSummary
    -> TrustedAdvisorCheckSummary)
-> Lens
     TrustedAdvisorCheckSummary
     TrustedAdvisorCheckSummary
     TrustedAdvisorCategorySpecificSummary
     TrustedAdvisorCategorySpecificSummary
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 Core.FromJSON TrustedAdvisorCheckSummary where
  parseJSON :: Value -> Parser TrustedAdvisorCheckSummary
parseJSON =
    String
-> (Object -> Parser TrustedAdvisorCheckSummary)
-> Value
-> Parser TrustedAdvisorCheckSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TrustedAdvisorCheckSummary"
      ( \Object
x ->
          Maybe Bool
-> Text
-> Text
-> Text
-> TrustedAdvisorResourcesSummary
-> TrustedAdvisorCategorySpecificSummary
-> TrustedAdvisorCheckSummary
TrustedAdvisorCheckSummary'
            (Maybe Bool
 -> Text
 -> Text
 -> Text
 -> TrustedAdvisorResourcesSummary
 -> TrustedAdvisorCategorySpecificSummary
 -> TrustedAdvisorCheckSummary)
-> Parser (Maybe Bool)
-> Parser
     (Text
      -> Text
      -> Text
      -> TrustedAdvisorResourcesSummary
      -> TrustedAdvisorCategorySpecificSummary
      -> TrustedAdvisorCheckSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"hasFlaggedResources")
            Parser
  (Text
   -> Text
   -> Text
   -> TrustedAdvisorResourcesSummary
   -> TrustedAdvisorCategorySpecificSummary
   -> TrustedAdvisorCheckSummary)
-> Parser Text
-> Parser
     (Text
      -> Text
      -> TrustedAdvisorResourcesSummary
      -> TrustedAdvisorCategorySpecificSummary
      -> TrustedAdvisorCheckSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"checkId")
            Parser
  (Text
   -> Text
   -> TrustedAdvisorResourcesSummary
   -> TrustedAdvisorCategorySpecificSummary
   -> TrustedAdvisorCheckSummary)
-> Parser Text
-> Parser
     (Text
      -> TrustedAdvisorResourcesSummary
      -> TrustedAdvisorCategorySpecificSummary
      -> TrustedAdvisorCheckSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timestamp")
            Parser
  (Text
   -> TrustedAdvisorResourcesSummary
   -> TrustedAdvisorCategorySpecificSummary
   -> TrustedAdvisorCheckSummary)
-> Parser Text
-> Parser
     (TrustedAdvisorResourcesSummary
      -> TrustedAdvisorCategorySpecificSummary
      -> TrustedAdvisorCheckSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
            Parser
  (TrustedAdvisorResourcesSummary
   -> TrustedAdvisorCategorySpecificSummary
   -> TrustedAdvisorCheckSummary)
-> Parser TrustedAdvisorResourcesSummary
-> Parser
     (TrustedAdvisorCategorySpecificSummary
      -> TrustedAdvisorCheckSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TrustedAdvisorResourcesSummary
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"resourcesSummary")
            Parser
  (TrustedAdvisorCategorySpecificSummary
   -> TrustedAdvisorCheckSummary)
-> Parser TrustedAdvisorCategorySpecificSummary
-> Parser TrustedAdvisorCheckSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser TrustedAdvisorCategorySpecificSummary
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"categorySpecificSummary")
      )

instance Prelude.Hashable TrustedAdvisorCheckSummary

instance Prelude.NFData TrustedAdvisorCheckSummary