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

import Amazonka.Config.Types.ComplianceSummary
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 of a specific type that are
-- compliant or noncompliant, up to a maximum of 100 for each.
--
-- /See:/ 'newComplianceSummaryByResourceType' smart constructor.
data ComplianceSummaryByResourceType = ComplianceSummaryByResourceType'
  { -- | The type of Amazon Web Services resource.
    ComplianceSummaryByResourceType -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The number of Amazon Web Services resources that are compliant or
    -- noncompliant, up to a maximum of 100 for each.
    ComplianceSummaryByResourceType -> Maybe ComplianceSummary
complianceSummary :: Prelude.Maybe ComplianceSummary
  }
  deriving (ComplianceSummaryByResourceType
-> ComplianceSummaryByResourceType -> Bool
(ComplianceSummaryByResourceType
 -> ComplianceSummaryByResourceType -> Bool)
-> (ComplianceSummaryByResourceType
    -> ComplianceSummaryByResourceType -> Bool)
-> Eq ComplianceSummaryByResourceType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComplianceSummaryByResourceType
-> ComplianceSummaryByResourceType -> Bool
$c/= :: ComplianceSummaryByResourceType
-> ComplianceSummaryByResourceType -> Bool
== :: ComplianceSummaryByResourceType
-> ComplianceSummaryByResourceType -> Bool
$c== :: ComplianceSummaryByResourceType
-> ComplianceSummaryByResourceType -> Bool
Prelude.Eq, ReadPrec [ComplianceSummaryByResourceType]
ReadPrec ComplianceSummaryByResourceType
Int -> ReadS ComplianceSummaryByResourceType
ReadS [ComplianceSummaryByResourceType]
(Int -> ReadS ComplianceSummaryByResourceType)
-> ReadS [ComplianceSummaryByResourceType]
-> ReadPrec ComplianceSummaryByResourceType
-> ReadPrec [ComplianceSummaryByResourceType]
-> Read ComplianceSummaryByResourceType
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComplianceSummaryByResourceType]
$creadListPrec :: ReadPrec [ComplianceSummaryByResourceType]
readPrec :: ReadPrec ComplianceSummaryByResourceType
$creadPrec :: ReadPrec ComplianceSummaryByResourceType
readList :: ReadS [ComplianceSummaryByResourceType]
$creadList :: ReadS [ComplianceSummaryByResourceType]
readsPrec :: Int -> ReadS ComplianceSummaryByResourceType
$creadsPrec :: Int -> ReadS ComplianceSummaryByResourceType
Prelude.Read, Int -> ComplianceSummaryByResourceType -> ShowS
[ComplianceSummaryByResourceType] -> ShowS
ComplianceSummaryByResourceType -> String
(Int -> ComplianceSummaryByResourceType -> ShowS)
-> (ComplianceSummaryByResourceType -> String)
-> ([ComplianceSummaryByResourceType] -> ShowS)
-> Show ComplianceSummaryByResourceType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComplianceSummaryByResourceType] -> ShowS
$cshowList :: [ComplianceSummaryByResourceType] -> ShowS
show :: ComplianceSummaryByResourceType -> String
$cshow :: ComplianceSummaryByResourceType -> String
showsPrec :: Int -> ComplianceSummaryByResourceType -> ShowS
$cshowsPrec :: Int -> ComplianceSummaryByResourceType -> ShowS
Prelude.Show, (forall x.
 ComplianceSummaryByResourceType
 -> Rep ComplianceSummaryByResourceType x)
-> (forall x.
    Rep ComplianceSummaryByResourceType x
    -> ComplianceSummaryByResourceType)
-> Generic ComplianceSummaryByResourceType
forall x.
Rep ComplianceSummaryByResourceType x
-> ComplianceSummaryByResourceType
forall x.
ComplianceSummaryByResourceType
-> Rep ComplianceSummaryByResourceType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ComplianceSummaryByResourceType x
-> ComplianceSummaryByResourceType
$cfrom :: forall x.
ComplianceSummaryByResourceType
-> Rep ComplianceSummaryByResourceType x
Prelude.Generic)

-- |
-- Create a value of 'ComplianceSummaryByResourceType' 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:
--
-- 'resourceType', 'complianceSummaryByResourceType_resourceType' - The type of Amazon Web Services resource.
--
-- 'complianceSummary', 'complianceSummaryByResourceType_complianceSummary' - The number of Amazon Web Services resources that are compliant or
-- noncompliant, up to a maximum of 100 for each.
newComplianceSummaryByResourceType ::
  ComplianceSummaryByResourceType
newComplianceSummaryByResourceType :: ComplianceSummaryByResourceType
newComplianceSummaryByResourceType =
  ComplianceSummaryByResourceType' :: Maybe Text
-> Maybe ComplianceSummary -> ComplianceSummaryByResourceType
ComplianceSummaryByResourceType'
    { $sel:resourceType:ComplianceSummaryByResourceType' :: Maybe Text
resourceType =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceSummary:ComplianceSummaryByResourceType' :: Maybe ComplianceSummary
complianceSummary = Maybe ComplianceSummary
forall a. Maybe a
Prelude.Nothing
    }

-- | The type of Amazon Web Services resource.
complianceSummaryByResourceType_resourceType :: Lens.Lens' ComplianceSummaryByResourceType (Prelude.Maybe Prelude.Text)
complianceSummaryByResourceType_resourceType :: (Maybe Text -> f (Maybe Text))
-> ComplianceSummaryByResourceType
-> f ComplianceSummaryByResourceType
complianceSummaryByResourceType_resourceType = (ComplianceSummaryByResourceType -> Maybe Text)
-> (ComplianceSummaryByResourceType
    -> Maybe Text -> ComplianceSummaryByResourceType)
-> Lens
     ComplianceSummaryByResourceType
     ComplianceSummaryByResourceType
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummaryByResourceType' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ComplianceSummaryByResourceType' :: ComplianceSummaryByResourceType -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ComplianceSummaryByResourceType
s@ComplianceSummaryByResourceType' {} Maybe Text
a -> ComplianceSummaryByResourceType
s {$sel:resourceType:ComplianceSummaryByResourceType' :: Maybe Text
resourceType = Maybe Text
a} :: ComplianceSummaryByResourceType)

-- | The number of Amazon Web Services resources that are compliant or
-- noncompliant, up to a maximum of 100 for each.
complianceSummaryByResourceType_complianceSummary :: Lens.Lens' ComplianceSummaryByResourceType (Prelude.Maybe ComplianceSummary)
complianceSummaryByResourceType_complianceSummary :: (Maybe ComplianceSummary -> f (Maybe ComplianceSummary))
-> ComplianceSummaryByResourceType
-> f ComplianceSummaryByResourceType
complianceSummaryByResourceType_complianceSummary = (ComplianceSummaryByResourceType -> Maybe ComplianceSummary)
-> (ComplianceSummaryByResourceType
    -> Maybe ComplianceSummary -> ComplianceSummaryByResourceType)
-> Lens
     ComplianceSummaryByResourceType
     ComplianceSummaryByResourceType
     (Maybe ComplianceSummary)
     (Maybe ComplianceSummary)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComplianceSummaryByResourceType' {Maybe ComplianceSummary
complianceSummary :: Maybe ComplianceSummary
$sel:complianceSummary:ComplianceSummaryByResourceType' :: ComplianceSummaryByResourceType -> Maybe ComplianceSummary
complianceSummary} -> Maybe ComplianceSummary
complianceSummary) (\s :: ComplianceSummaryByResourceType
s@ComplianceSummaryByResourceType' {} Maybe ComplianceSummary
a -> ComplianceSummaryByResourceType
s {$sel:complianceSummary:ComplianceSummaryByResourceType' :: Maybe ComplianceSummary
complianceSummary = Maybe ComplianceSummary
a} :: ComplianceSummaryByResourceType)

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

instance
  Prelude.Hashable
    ComplianceSummaryByResourceType

instance
  Prelude.NFData
    ComplianceSummaryByResourceType