{-# 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.Config.Types.ComplianceSummary
-- 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.Config.Types.ComplianceSummary where

import Amazonka.Config.Types.ComplianceContributorCount
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The number of Config rules or Amazon Web Services resources that are
-- compliant and noncompliant.
--
-- /See:/ 'newComplianceSummary' smart constructor.
data ComplianceSummary = ComplianceSummary'
  { -- | The time that Config created the compliance summary.
    ComplianceSummary -> Maybe POSIX
complianceSummaryTimestamp :: Prelude.Maybe Core.POSIX,
    -- | The number of Config rules or Amazon Web Services resources that are
    -- compliant, up to a maximum of 25 for rules and 100 for resources.
    ComplianceSummary -> Maybe ComplianceContributorCount
compliantResourceCount :: Prelude.Maybe ComplianceContributorCount,
    -- | The number of Config rules or Amazon Web Services resources that are
    -- noncompliant, up to a maximum of 25 for rules and 100 for resources.
    ComplianceSummary -> Maybe ComplianceContributorCount
nonCompliantResourceCount :: Prelude.Maybe ComplianceContributorCount
  }
  deriving (ComplianceSummary -> ComplianceSummary -> Bool
(ComplianceSummary -> ComplianceSummary -> Bool)
-> (ComplianceSummary -> ComplianceSummary -> Bool)
-> Eq ComplianceSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComplianceSummary -> ComplianceSummary -> Bool
$c/= :: ComplianceSummary -> ComplianceSummary -> Bool
== :: ComplianceSummary -> ComplianceSummary -> Bool
$c== :: ComplianceSummary -> ComplianceSummary -> Bool
Prelude.Eq, ReadPrec [ComplianceSummary]
ReadPrec ComplianceSummary
Int -> ReadS ComplianceSummary
ReadS [ComplianceSummary]
(Int -> ReadS ComplianceSummary)
-> ReadS [ComplianceSummary]
-> ReadPrec ComplianceSummary
-> ReadPrec [ComplianceSummary]
-> Read ComplianceSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComplianceSummary]
$creadListPrec :: ReadPrec [ComplianceSummary]
readPrec :: ReadPrec ComplianceSummary
$creadPrec :: ReadPrec ComplianceSummary
readList :: ReadS [ComplianceSummary]
$creadList :: ReadS [ComplianceSummary]
readsPrec :: Int -> ReadS ComplianceSummary
$creadsPrec :: Int -> ReadS ComplianceSummary
Prelude.Read, Int -> ComplianceSummary -> ShowS
[ComplianceSummary] -> ShowS
ComplianceSummary -> String
(Int -> ComplianceSummary -> ShowS)
-> (ComplianceSummary -> String)
-> ([ComplianceSummary] -> ShowS)
-> Show ComplianceSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComplianceSummary] -> ShowS
$cshowList :: [ComplianceSummary] -> ShowS
show :: ComplianceSummary -> String
$cshow :: ComplianceSummary -> String
showsPrec :: Int -> ComplianceSummary -> ShowS
$cshowsPrec :: Int -> ComplianceSummary -> ShowS
Prelude.Show, (forall x. ComplianceSummary -> Rep ComplianceSummary x)
-> (forall x. Rep ComplianceSummary x -> ComplianceSummary)
-> Generic ComplianceSummary
forall x. Rep ComplianceSummary x -> ComplianceSummary
forall x. ComplianceSummary -> Rep ComplianceSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComplianceSummary x -> ComplianceSummary
$cfrom :: forall x. ComplianceSummary -> Rep ComplianceSummary x
Prelude.Generic)

-- |
-- Create a value of 'ComplianceSummary' 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:
--
-- 'complianceSummaryTimestamp', 'complianceSummary_complianceSummaryTimestamp' - The time that Config created the compliance summary.
--
-- 'compliantResourceCount', 'complianceSummary_compliantResourceCount' - The number of Config rules or Amazon Web Services resources that are
-- compliant, up to a maximum of 25 for rules and 100 for resources.
--
-- 'nonCompliantResourceCount', 'complianceSummary_nonCompliantResourceCount' - The number of Config rules or Amazon Web Services resources that are
-- noncompliant, up to a maximum of 25 for rules and 100 for resources.
newComplianceSummary ::
  ComplianceSummary
newComplianceSummary :: ComplianceSummary
newComplianceSummary =
  ComplianceSummary' :: Maybe POSIX
-> Maybe ComplianceContributorCount
-> Maybe ComplianceContributorCount
-> ComplianceSummary
ComplianceSummary'
    { $sel:complianceSummaryTimestamp:ComplianceSummary' :: Maybe POSIX
complianceSummaryTimestamp =
        Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:compliantResourceCount:ComplianceSummary' :: Maybe ComplianceContributorCount
compliantResourceCount = Maybe ComplianceContributorCount
forall a. Maybe a
Prelude.Nothing,
      $sel:nonCompliantResourceCount:ComplianceSummary' :: Maybe ComplianceContributorCount
nonCompliantResourceCount = Maybe ComplianceContributorCount
forall a. Maybe a
Prelude.Nothing
    }

-- | The time that Config created the compliance summary.
complianceSummary_complianceSummaryTimestamp :: Lens.Lens' ComplianceSummary (Prelude.Maybe Prelude.UTCTime)
complianceSummary_complianceSummaryTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> ComplianceSummary -> f ComplianceSummary
complianceSummary_complianceSummaryTimestamp = (ComplianceSummary -> Maybe POSIX)
-> (ComplianceSummary -> Maybe POSIX -> ComplianceSummary)
-> Lens
     ComplianceSummary ComplianceSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummary' {Maybe POSIX
complianceSummaryTimestamp :: Maybe POSIX
$sel:complianceSummaryTimestamp:ComplianceSummary' :: ComplianceSummary -> Maybe POSIX
complianceSummaryTimestamp} -> Maybe POSIX
complianceSummaryTimestamp) (\s :: ComplianceSummary
s@ComplianceSummary' {} Maybe POSIX
a -> ComplianceSummary
s {$sel:complianceSummaryTimestamp:ComplianceSummary' :: Maybe POSIX
complianceSummaryTimestamp = Maybe POSIX
a} :: ComplianceSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> ComplianceSummary -> f ComplianceSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> ComplianceSummary
-> f ComplianceSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The number of Config rules or Amazon Web Services resources that are
-- compliant, up to a maximum of 25 for rules and 100 for resources.
complianceSummary_compliantResourceCount :: Lens.Lens' ComplianceSummary (Prelude.Maybe ComplianceContributorCount)
complianceSummary_compliantResourceCount :: (Maybe ComplianceContributorCount
 -> f (Maybe ComplianceContributorCount))
-> ComplianceSummary -> f ComplianceSummary
complianceSummary_compliantResourceCount = (ComplianceSummary -> Maybe ComplianceContributorCount)
-> (ComplianceSummary
    -> Maybe ComplianceContributorCount -> ComplianceSummary)
-> Lens
     ComplianceSummary
     ComplianceSummary
     (Maybe ComplianceContributorCount)
     (Maybe ComplianceContributorCount)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummary' {Maybe ComplianceContributorCount
compliantResourceCount :: Maybe ComplianceContributorCount
$sel:compliantResourceCount:ComplianceSummary' :: ComplianceSummary -> Maybe ComplianceContributorCount
compliantResourceCount} -> Maybe ComplianceContributorCount
compliantResourceCount) (\s :: ComplianceSummary
s@ComplianceSummary' {} Maybe ComplianceContributorCount
a -> ComplianceSummary
s {$sel:compliantResourceCount:ComplianceSummary' :: Maybe ComplianceContributorCount
compliantResourceCount = Maybe ComplianceContributorCount
a} :: ComplianceSummary)

-- | The number of Config rules or Amazon Web Services resources that are
-- noncompliant, up to a maximum of 25 for rules and 100 for resources.
complianceSummary_nonCompliantResourceCount :: Lens.Lens' ComplianceSummary (Prelude.Maybe ComplianceContributorCount)
complianceSummary_nonCompliantResourceCount :: (Maybe ComplianceContributorCount
 -> f (Maybe ComplianceContributorCount))
-> ComplianceSummary -> f ComplianceSummary
complianceSummary_nonCompliantResourceCount = (ComplianceSummary -> Maybe ComplianceContributorCount)
-> (ComplianceSummary
    -> Maybe ComplianceContributorCount -> ComplianceSummary)
-> Lens
     ComplianceSummary
     ComplianceSummary
     (Maybe ComplianceContributorCount)
     (Maybe ComplianceContributorCount)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummary' {Maybe ComplianceContributorCount
nonCompliantResourceCount :: Maybe ComplianceContributorCount
$sel:nonCompliantResourceCount:ComplianceSummary' :: ComplianceSummary -> Maybe ComplianceContributorCount
nonCompliantResourceCount} -> Maybe ComplianceContributorCount
nonCompliantResourceCount) (\s :: ComplianceSummary
s@ComplianceSummary' {} Maybe ComplianceContributorCount
a -> ComplianceSummary
s {$sel:nonCompliantResourceCount:ComplianceSummary' :: Maybe ComplianceContributorCount
nonCompliantResourceCount = Maybe ComplianceContributorCount
a} :: ComplianceSummary)

instance Core.FromJSON ComplianceSummary where
  parseJSON :: Value -> Parser ComplianceSummary
parseJSON =
    String
-> (Object -> Parser ComplianceSummary)
-> Value
-> Parser ComplianceSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComplianceSummary"
      ( \Object
x ->
          Maybe POSIX
-> Maybe ComplianceContributorCount
-> Maybe ComplianceContributorCount
-> ComplianceSummary
ComplianceSummary'
            (Maybe POSIX
 -> Maybe ComplianceContributorCount
 -> Maybe ComplianceContributorCount
 -> ComplianceSummary)
-> Parser (Maybe POSIX)
-> Parser
     (Maybe ComplianceContributorCount
      -> Maybe ComplianceContributorCount -> ComplianceSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceSummaryTimestamp")
            Parser
  (Maybe ComplianceContributorCount
   -> Maybe ComplianceContributorCount -> ComplianceSummary)
-> Parser (Maybe ComplianceContributorCount)
-> Parser (Maybe ComplianceContributorCount -> ComplianceSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ComplianceContributorCount)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"CompliantResourceCount")
            Parser (Maybe ComplianceContributorCount -> ComplianceSummary)
-> Parser (Maybe ComplianceContributorCount)
-> Parser ComplianceSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ComplianceContributorCount)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NonCompliantResourceCount")
      )

instance Prelude.Hashable ComplianceSummary

instance Prelude.NFData ComplianceSummary