{-# 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.SSM.Types.CompliantSummary
-- 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.SSM.Types.CompliantSummary where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.SeveritySummary

-- | A summary of resources that are compliant. The summary is organized
-- according to the resource count for each compliance type.
--
-- /See:/ 'newCompliantSummary' smart constructor.
data CompliantSummary = CompliantSummary'
  { -- | The total number of resources that are compliant.
    CompliantSummary -> Maybe Int
compliantCount :: Prelude.Maybe Prelude.Int,
    -- | A summary of the compliance severity by compliance type.
    CompliantSummary -> Maybe SeveritySummary
severitySummary :: Prelude.Maybe SeveritySummary
  }
  deriving (CompliantSummary -> CompliantSummary -> Bool
(CompliantSummary -> CompliantSummary -> Bool)
-> (CompliantSummary -> CompliantSummary -> Bool)
-> Eq CompliantSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CompliantSummary -> CompliantSummary -> Bool
$c/= :: CompliantSummary -> CompliantSummary -> Bool
== :: CompliantSummary -> CompliantSummary -> Bool
$c== :: CompliantSummary -> CompliantSummary -> Bool
Prelude.Eq, ReadPrec [CompliantSummary]
ReadPrec CompliantSummary
Int -> ReadS CompliantSummary
ReadS [CompliantSummary]
(Int -> ReadS CompliantSummary)
-> ReadS [CompliantSummary]
-> ReadPrec CompliantSummary
-> ReadPrec [CompliantSummary]
-> Read CompliantSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CompliantSummary]
$creadListPrec :: ReadPrec [CompliantSummary]
readPrec :: ReadPrec CompliantSummary
$creadPrec :: ReadPrec CompliantSummary
readList :: ReadS [CompliantSummary]
$creadList :: ReadS [CompliantSummary]
readsPrec :: Int -> ReadS CompliantSummary
$creadsPrec :: Int -> ReadS CompliantSummary
Prelude.Read, Int -> CompliantSummary -> ShowS
[CompliantSummary] -> ShowS
CompliantSummary -> String
(Int -> CompliantSummary -> ShowS)
-> (CompliantSummary -> String)
-> ([CompliantSummary] -> ShowS)
-> Show CompliantSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CompliantSummary] -> ShowS
$cshowList :: [CompliantSummary] -> ShowS
show :: CompliantSummary -> String
$cshow :: CompliantSummary -> String
showsPrec :: Int -> CompliantSummary -> ShowS
$cshowsPrec :: Int -> CompliantSummary -> ShowS
Prelude.Show, (forall x. CompliantSummary -> Rep CompliantSummary x)
-> (forall x. Rep CompliantSummary x -> CompliantSummary)
-> Generic CompliantSummary
forall x. Rep CompliantSummary x -> CompliantSummary
forall x. CompliantSummary -> Rep CompliantSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CompliantSummary x -> CompliantSummary
$cfrom :: forall x. CompliantSummary -> Rep CompliantSummary x
Prelude.Generic)

-- |
-- Create a value of 'CompliantSummary' 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:
--
-- 'compliantCount', 'compliantSummary_compliantCount' - The total number of resources that are compliant.
--
-- 'severitySummary', 'compliantSummary_severitySummary' - A summary of the compliance severity by compliance type.
newCompliantSummary ::
  CompliantSummary
newCompliantSummary :: CompliantSummary
newCompliantSummary =
  CompliantSummary' :: Maybe Int -> Maybe SeveritySummary -> CompliantSummary
CompliantSummary'
    { $sel:compliantCount:CompliantSummary' :: Maybe Int
compliantCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:severitySummary:CompliantSummary' :: Maybe SeveritySummary
severitySummary = Maybe SeveritySummary
forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of resources that are compliant.
compliantSummary_compliantCount :: Lens.Lens' CompliantSummary (Prelude.Maybe Prelude.Int)
compliantSummary_compliantCount :: (Maybe Int -> f (Maybe Int))
-> CompliantSummary -> f CompliantSummary
compliantSummary_compliantCount = (CompliantSummary -> Maybe Int)
-> (CompliantSummary -> Maybe Int -> CompliantSummary)
-> Lens CompliantSummary CompliantSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompliantSummary' {Maybe Int
compliantCount :: Maybe Int
$sel:compliantCount:CompliantSummary' :: CompliantSummary -> Maybe Int
compliantCount} -> Maybe Int
compliantCount) (\s :: CompliantSummary
s@CompliantSummary' {} Maybe Int
a -> CompliantSummary
s {$sel:compliantCount:CompliantSummary' :: Maybe Int
compliantCount = Maybe Int
a} :: CompliantSummary)

-- | A summary of the compliance severity by compliance type.
compliantSummary_severitySummary :: Lens.Lens' CompliantSummary (Prelude.Maybe SeveritySummary)
compliantSummary_severitySummary :: (Maybe SeveritySummary -> f (Maybe SeveritySummary))
-> CompliantSummary -> f CompliantSummary
compliantSummary_severitySummary = (CompliantSummary -> Maybe SeveritySummary)
-> (CompliantSummary -> Maybe SeveritySummary -> CompliantSummary)
-> Lens
     CompliantSummary
     CompliantSummary
     (Maybe SeveritySummary)
     (Maybe SeveritySummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CompliantSummary' {Maybe SeveritySummary
severitySummary :: Maybe SeveritySummary
$sel:severitySummary:CompliantSummary' :: CompliantSummary -> Maybe SeveritySummary
severitySummary} -> Maybe SeveritySummary
severitySummary) (\s :: CompliantSummary
s@CompliantSummary' {} Maybe SeveritySummary
a -> CompliantSummary
s {$sel:severitySummary:CompliantSummary' :: Maybe SeveritySummary
severitySummary = Maybe SeveritySummary
a} :: CompliantSummary)

instance Core.FromJSON CompliantSummary where
  parseJSON :: Value -> Parser CompliantSummary
parseJSON =
    String
-> (Object -> Parser CompliantSummary)
-> Value
-> Parser CompliantSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CompliantSummary"
      ( \Object
x ->
          Maybe Int -> Maybe SeveritySummary -> CompliantSummary
CompliantSummary'
            (Maybe Int -> Maybe SeveritySummary -> CompliantSummary)
-> Parser (Maybe Int)
-> Parser (Maybe SeveritySummary -> CompliantSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CompliantCount")
            Parser (Maybe SeveritySummary -> CompliantSummary)
-> Parser (Maybe SeveritySummary) -> Parser CompliantSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe SeveritySummary)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SeveritySummary")
      )

instance Prelude.Hashable CompliantSummary

instance Prelude.NFData CompliantSummary