{-# 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.NonCompliantSummary
-- 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.NonCompliantSummary 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 aren\'t compliant. The summary is organized
-- according to resource type.
--
-- /See:/ 'newNonCompliantSummary' smart constructor.
data NonCompliantSummary = NonCompliantSummary'
  { -- | The total number of compliance items that aren\'t compliant.
    NonCompliantSummary -> Maybe Int
nonCompliantCount :: Prelude.Maybe Prelude.Int,
    -- | A summary of the non-compliance severity by compliance type
    NonCompliantSummary -> Maybe SeveritySummary
severitySummary :: Prelude.Maybe SeveritySummary
  }
  deriving (NonCompliantSummary -> NonCompliantSummary -> Bool
(NonCompliantSummary -> NonCompliantSummary -> Bool)
-> (NonCompliantSummary -> NonCompliantSummary -> Bool)
-> Eq NonCompliantSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: NonCompliantSummary -> NonCompliantSummary -> Bool
$c/= :: NonCompliantSummary -> NonCompliantSummary -> Bool
== :: NonCompliantSummary -> NonCompliantSummary -> Bool
$c== :: NonCompliantSummary -> NonCompliantSummary -> Bool
Prelude.Eq, ReadPrec [NonCompliantSummary]
ReadPrec NonCompliantSummary
Int -> ReadS NonCompliantSummary
ReadS [NonCompliantSummary]
(Int -> ReadS NonCompliantSummary)
-> ReadS [NonCompliantSummary]
-> ReadPrec NonCompliantSummary
-> ReadPrec [NonCompliantSummary]
-> Read NonCompliantSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [NonCompliantSummary]
$creadListPrec :: ReadPrec [NonCompliantSummary]
readPrec :: ReadPrec NonCompliantSummary
$creadPrec :: ReadPrec NonCompliantSummary
readList :: ReadS [NonCompliantSummary]
$creadList :: ReadS [NonCompliantSummary]
readsPrec :: Int -> ReadS NonCompliantSummary
$creadsPrec :: Int -> ReadS NonCompliantSummary
Prelude.Read, Int -> NonCompliantSummary -> ShowS
[NonCompliantSummary] -> ShowS
NonCompliantSummary -> String
(Int -> NonCompliantSummary -> ShowS)
-> (NonCompliantSummary -> String)
-> ([NonCompliantSummary] -> ShowS)
-> Show NonCompliantSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [NonCompliantSummary] -> ShowS
$cshowList :: [NonCompliantSummary] -> ShowS
show :: NonCompliantSummary -> String
$cshow :: NonCompliantSummary -> String
showsPrec :: Int -> NonCompliantSummary -> ShowS
$cshowsPrec :: Int -> NonCompliantSummary -> ShowS
Prelude.Show, (forall x. NonCompliantSummary -> Rep NonCompliantSummary x)
-> (forall x. Rep NonCompliantSummary x -> NonCompliantSummary)
-> Generic NonCompliantSummary
forall x. Rep NonCompliantSummary x -> NonCompliantSummary
forall x. NonCompliantSummary -> Rep NonCompliantSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep NonCompliantSummary x -> NonCompliantSummary
$cfrom :: forall x. NonCompliantSummary -> Rep NonCompliantSummary x
Prelude.Generic)

-- |
-- Create a value of 'NonCompliantSummary' 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:
--
-- 'nonCompliantCount', 'nonCompliantSummary_nonCompliantCount' - The total number of compliance items that aren\'t compliant.
--
-- 'severitySummary', 'nonCompliantSummary_severitySummary' - A summary of the non-compliance severity by compliance type
newNonCompliantSummary ::
  NonCompliantSummary
newNonCompliantSummary :: NonCompliantSummary
newNonCompliantSummary =
  NonCompliantSummary' :: Maybe Int -> Maybe SeveritySummary -> NonCompliantSummary
NonCompliantSummary'
    { $sel:nonCompliantCount:NonCompliantSummary' :: Maybe Int
nonCompliantCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:severitySummary:NonCompliantSummary' :: Maybe SeveritySummary
severitySummary = Maybe SeveritySummary
forall a. Maybe a
Prelude.Nothing
    }

-- | The total number of compliance items that aren\'t compliant.
nonCompliantSummary_nonCompliantCount :: Lens.Lens' NonCompliantSummary (Prelude.Maybe Prelude.Int)
nonCompliantSummary_nonCompliantCount :: (Maybe Int -> f (Maybe Int))
-> NonCompliantSummary -> f NonCompliantSummary
nonCompliantSummary_nonCompliantCount = (NonCompliantSummary -> Maybe Int)
-> (NonCompliantSummary -> Maybe Int -> NonCompliantSummary)
-> Lens
     NonCompliantSummary NonCompliantSummary (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\NonCompliantSummary' {Maybe Int
nonCompliantCount :: Maybe Int
$sel:nonCompliantCount:NonCompliantSummary' :: NonCompliantSummary -> Maybe Int
nonCompliantCount} -> Maybe Int
nonCompliantCount) (\s :: NonCompliantSummary
s@NonCompliantSummary' {} Maybe Int
a -> NonCompliantSummary
s {$sel:nonCompliantCount:NonCompliantSummary' :: Maybe Int
nonCompliantCount = Maybe Int
a} :: NonCompliantSummary)

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

instance Core.FromJSON NonCompliantSummary where
  parseJSON :: Value -> Parser NonCompliantSummary
parseJSON =
    String
-> (Object -> Parser NonCompliantSummary)
-> Value
-> Parser NonCompliantSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"NonCompliantSummary"
      ( \Object
x ->
          Maybe Int -> Maybe SeveritySummary -> NonCompliantSummary
NonCompliantSummary'
            (Maybe Int -> Maybe SeveritySummary -> NonCompliantSummary)
-> Parser (Maybe Int)
-> Parser (Maybe SeveritySummary -> NonCompliantSummary)
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
"NonCompliantCount")
            Parser (Maybe SeveritySummary -> NonCompliantSummary)
-> Parser (Maybe SeveritySummary) -> Parser NonCompliantSummary
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 NonCompliantSummary

instance Prelude.NFData NonCompliantSummary