{-# 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.ComplianceContributorCount
-- 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.ComplianceContributorCount where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The number of Amazon Web Services resources or Config rules responsible
-- for the current compliance of the item, up to a maximum number.
--
-- /See:/ 'newComplianceContributorCount' smart constructor.
data ComplianceContributorCount = ComplianceContributorCount'
  { -- | The number of Amazon Web Services resources or Config rules responsible
    -- for the current compliance of the item.
    ComplianceContributorCount -> Maybe Int
cappedCount :: Prelude.Maybe Prelude.Int,
    -- | Indicates whether the maximum count is reached.
    ComplianceContributorCount -> Maybe Bool
capExceeded :: Prelude.Maybe Prelude.Bool
  }
  deriving (ComplianceContributorCount -> ComplianceContributorCount -> Bool
(ComplianceContributorCount -> ComplianceContributorCount -> Bool)
-> (ComplianceContributorCount
    -> ComplianceContributorCount -> Bool)
-> Eq ComplianceContributorCount
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComplianceContributorCount -> ComplianceContributorCount -> Bool
$c/= :: ComplianceContributorCount -> ComplianceContributorCount -> Bool
== :: ComplianceContributorCount -> ComplianceContributorCount -> Bool
$c== :: ComplianceContributorCount -> ComplianceContributorCount -> Bool
Prelude.Eq, ReadPrec [ComplianceContributorCount]
ReadPrec ComplianceContributorCount
Int -> ReadS ComplianceContributorCount
ReadS [ComplianceContributorCount]
(Int -> ReadS ComplianceContributorCount)
-> ReadS [ComplianceContributorCount]
-> ReadPrec ComplianceContributorCount
-> ReadPrec [ComplianceContributorCount]
-> Read ComplianceContributorCount
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComplianceContributorCount]
$creadListPrec :: ReadPrec [ComplianceContributorCount]
readPrec :: ReadPrec ComplianceContributorCount
$creadPrec :: ReadPrec ComplianceContributorCount
readList :: ReadS [ComplianceContributorCount]
$creadList :: ReadS [ComplianceContributorCount]
readsPrec :: Int -> ReadS ComplianceContributorCount
$creadsPrec :: Int -> ReadS ComplianceContributorCount
Prelude.Read, Int -> ComplianceContributorCount -> ShowS
[ComplianceContributorCount] -> ShowS
ComplianceContributorCount -> String
(Int -> ComplianceContributorCount -> ShowS)
-> (ComplianceContributorCount -> String)
-> ([ComplianceContributorCount] -> ShowS)
-> Show ComplianceContributorCount
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComplianceContributorCount] -> ShowS
$cshowList :: [ComplianceContributorCount] -> ShowS
show :: ComplianceContributorCount -> String
$cshow :: ComplianceContributorCount -> String
showsPrec :: Int -> ComplianceContributorCount -> ShowS
$cshowsPrec :: Int -> ComplianceContributorCount -> ShowS
Prelude.Show, (forall x.
 ComplianceContributorCount -> Rep ComplianceContributorCount x)
-> (forall x.
    Rep ComplianceContributorCount x -> ComplianceContributorCount)
-> Generic ComplianceContributorCount
forall x.
Rep ComplianceContributorCount x -> ComplianceContributorCount
forall x.
ComplianceContributorCount -> Rep ComplianceContributorCount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ComplianceContributorCount x -> ComplianceContributorCount
$cfrom :: forall x.
ComplianceContributorCount -> Rep ComplianceContributorCount x
Prelude.Generic)

-- |
-- Create a value of 'ComplianceContributorCount' 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:
--
-- 'cappedCount', 'complianceContributorCount_cappedCount' - The number of Amazon Web Services resources or Config rules responsible
-- for the current compliance of the item.
--
-- 'capExceeded', 'complianceContributorCount_capExceeded' - Indicates whether the maximum count is reached.
newComplianceContributorCount ::
  ComplianceContributorCount
newComplianceContributorCount :: ComplianceContributorCount
newComplianceContributorCount =
  ComplianceContributorCount' :: Maybe Int -> Maybe Bool -> ComplianceContributorCount
ComplianceContributorCount'
    { $sel:cappedCount:ComplianceContributorCount' :: Maybe Int
cappedCount =
        Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:capExceeded:ComplianceContributorCount' :: Maybe Bool
capExceeded = Maybe Bool
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of Amazon Web Services resources or Config rules responsible
-- for the current compliance of the item.
complianceContributorCount_cappedCount :: Lens.Lens' ComplianceContributorCount (Prelude.Maybe Prelude.Int)
complianceContributorCount_cappedCount :: (Maybe Int -> f (Maybe Int))
-> ComplianceContributorCount -> f ComplianceContributorCount
complianceContributorCount_cappedCount = (ComplianceContributorCount -> Maybe Int)
-> (ComplianceContributorCount
    -> Maybe Int -> ComplianceContributorCount)
-> Lens
     ComplianceContributorCount
     ComplianceContributorCount
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceContributorCount' {Maybe Int
cappedCount :: Maybe Int
$sel:cappedCount:ComplianceContributorCount' :: ComplianceContributorCount -> Maybe Int
cappedCount} -> Maybe Int
cappedCount) (\s :: ComplianceContributorCount
s@ComplianceContributorCount' {} Maybe Int
a -> ComplianceContributorCount
s {$sel:cappedCount:ComplianceContributorCount' :: Maybe Int
cappedCount = Maybe Int
a} :: ComplianceContributorCount)

-- | Indicates whether the maximum count is reached.
complianceContributorCount_capExceeded :: Lens.Lens' ComplianceContributorCount (Prelude.Maybe Prelude.Bool)
complianceContributorCount_capExceeded :: (Maybe Bool -> f (Maybe Bool))
-> ComplianceContributorCount -> f ComplianceContributorCount
complianceContributorCount_capExceeded = (ComplianceContributorCount -> Maybe Bool)
-> (ComplianceContributorCount
    -> Maybe Bool -> ComplianceContributorCount)
-> Lens
     ComplianceContributorCount
     ComplianceContributorCount
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceContributorCount' {Maybe Bool
capExceeded :: Maybe Bool
$sel:capExceeded:ComplianceContributorCount' :: ComplianceContributorCount -> Maybe Bool
capExceeded} -> Maybe Bool
capExceeded) (\s :: ComplianceContributorCount
s@ComplianceContributorCount' {} Maybe Bool
a -> ComplianceContributorCount
s {$sel:capExceeded:ComplianceContributorCount' :: Maybe Bool
capExceeded = Maybe Bool
a} :: ComplianceContributorCount)

instance Core.FromJSON ComplianceContributorCount where
  parseJSON :: Value -> Parser ComplianceContributorCount
parseJSON =
    String
-> (Object -> Parser ComplianceContributorCount)
-> Value
-> Parser ComplianceContributorCount
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ComplianceContributorCount"
      ( \Object
x ->
          Maybe Int -> Maybe Bool -> ComplianceContributorCount
ComplianceContributorCount'
            (Maybe Int -> Maybe Bool -> ComplianceContributorCount)
-> Parser (Maybe Int)
-> Parser (Maybe Bool -> ComplianceContributorCount)
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
"CappedCount")
            Parser (Maybe Bool -> ComplianceContributorCount)
-> Parser (Maybe Bool) -> Parser ComplianceContributorCount
forall (f :: * -> *) a b. Applicative f => 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
"CapExceeded")
      )

instance Prelude.Hashable ComplianceContributorCount

instance Prelude.NFData ComplianceContributorCount