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

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

-- | Compliance information of one or more Config rules within a conformance
-- pack. You can filter using Config rule names and compliance types.
--
-- /See:/ 'newConformancePackRuleCompliance' smart constructor.
data ConformancePackRuleCompliance = ConformancePackRuleCompliance'
  { -- | Controls for the conformance pack. A control is a process to prevent or
    -- detect problems while meeting objectives. A control can align with a
    -- specific compliance regime or map to internal controls defined by an
    -- organization.
    ConformancePackRuleCompliance -> Maybe [Text]
controls :: Prelude.Maybe [Prelude.Text],
    -- | Name of the config rule.
    ConformancePackRuleCompliance -> Maybe Text
configRuleName :: Prelude.Maybe Prelude.Text,
    -- | Compliance of the Config rule.
    --
    -- The allowed values are @COMPLIANT@, @NON_COMPLIANT@, and
    -- @INSUFFICIENT_DATA@.
    ConformancePackRuleCompliance
-> Maybe ConformancePackComplianceType
complianceType :: Prelude.Maybe ConformancePackComplianceType
  }
  deriving (ConformancePackRuleCompliance
-> ConformancePackRuleCompliance -> Bool
(ConformancePackRuleCompliance
 -> ConformancePackRuleCompliance -> Bool)
-> (ConformancePackRuleCompliance
    -> ConformancePackRuleCompliance -> Bool)
-> Eq ConformancePackRuleCompliance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConformancePackRuleCompliance
-> ConformancePackRuleCompliance -> Bool
$c/= :: ConformancePackRuleCompliance
-> ConformancePackRuleCompliance -> Bool
== :: ConformancePackRuleCompliance
-> ConformancePackRuleCompliance -> Bool
$c== :: ConformancePackRuleCompliance
-> ConformancePackRuleCompliance -> Bool
Prelude.Eq, ReadPrec [ConformancePackRuleCompliance]
ReadPrec ConformancePackRuleCompliance
Int -> ReadS ConformancePackRuleCompliance
ReadS [ConformancePackRuleCompliance]
(Int -> ReadS ConformancePackRuleCompliance)
-> ReadS [ConformancePackRuleCompliance]
-> ReadPrec ConformancePackRuleCompliance
-> ReadPrec [ConformancePackRuleCompliance]
-> Read ConformancePackRuleCompliance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConformancePackRuleCompliance]
$creadListPrec :: ReadPrec [ConformancePackRuleCompliance]
readPrec :: ReadPrec ConformancePackRuleCompliance
$creadPrec :: ReadPrec ConformancePackRuleCompliance
readList :: ReadS [ConformancePackRuleCompliance]
$creadList :: ReadS [ConformancePackRuleCompliance]
readsPrec :: Int -> ReadS ConformancePackRuleCompliance
$creadsPrec :: Int -> ReadS ConformancePackRuleCompliance
Prelude.Read, Int -> ConformancePackRuleCompliance -> ShowS
[ConformancePackRuleCompliance] -> ShowS
ConformancePackRuleCompliance -> String
(Int -> ConformancePackRuleCompliance -> ShowS)
-> (ConformancePackRuleCompliance -> String)
-> ([ConformancePackRuleCompliance] -> ShowS)
-> Show ConformancePackRuleCompliance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConformancePackRuleCompliance] -> ShowS
$cshowList :: [ConformancePackRuleCompliance] -> ShowS
show :: ConformancePackRuleCompliance -> String
$cshow :: ConformancePackRuleCompliance -> String
showsPrec :: Int -> ConformancePackRuleCompliance -> ShowS
$cshowsPrec :: Int -> ConformancePackRuleCompliance -> ShowS
Prelude.Show, (forall x.
 ConformancePackRuleCompliance
 -> Rep ConformancePackRuleCompliance x)
-> (forall x.
    Rep ConformancePackRuleCompliance x
    -> ConformancePackRuleCompliance)
-> Generic ConformancePackRuleCompliance
forall x.
Rep ConformancePackRuleCompliance x
-> ConformancePackRuleCompliance
forall x.
ConformancePackRuleCompliance
-> Rep ConformancePackRuleCompliance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConformancePackRuleCompliance x
-> ConformancePackRuleCompliance
$cfrom :: forall x.
ConformancePackRuleCompliance
-> Rep ConformancePackRuleCompliance x
Prelude.Generic)

-- |
-- Create a value of 'ConformancePackRuleCompliance' 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:
--
-- 'controls', 'conformancePackRuleCompliance_controls' - Controls for the conformance pack. A control is a process to prevent or
-- detect problems while meeting objectives. A control can align with a
-- specific compliance regime or map to internal controls defined by an
-- organization.
--
-- 'configRuleName', 'conformancePackRuleCompliance_configRuleName' - Name of the config rule.
--
-- 'complianceType', 'conformancePackRuleCompliance_complianceType' - Compliance of the Config rule.
--
-- The allowed values are @COMPLIANT@, @NON_COMPLIANT@, and
-- @INSUFFICIENT_DATA@.
newConformancePackRuleCompliance ::
  ConformancePackRuleCompliance
newConformancePackRuleCompliance :: ConformancePackRuleCompliance
newConformancePackRuleCompliance =
  ConformancePackRuleCompliance' :: Maybe [Text]
-> Maybe Text
-> Maybe ConformancePackComplianceType
-> ConformancePackRuleCompliance
ConformancePackRuleCompliance'
    { $sel:controls:ConformancePackRuleCompliance' :: Maybe [Text]
controls =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:configRuleName:ConformancePackRuleCompliance' :: Maybe Text
configRuleName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:complianceType:ConformancePackRuleCompliance' :: Maybe ConformancePackComplianceType
complianceType = Maybe ConformancePackComplianceType
forall a. Maybe a
Prelude.Nothing
    }

-- | Controls for the conformance pack. A control is a process to prevent or
-- detect problems while meeting objectives. A control can align with a
-- specific compliance regime or map to internal controls defined by an
-- organization.
conformancePackRuleCompliance_controls :: Lens.Lens' ConformancePackRuleCompliance (Prelude.Maybe [Prelude.Text])
conformancePackRuleCompliance_controls :: (Maybe [Text] -> f (Maybe [Text]))
-> ConformancePackRuleCompliance -> f ConformancePackRuleCompliance
conformancePackRuleCompliance_controls = (ConformancePackRuleCompliance -> Maybe [Text])
-> (ConformancePackRuleCompliance
    -> Maybe [Text] -> ConformancePackRuleCompliance)
-> Lens
     ConformancePackRuleCompliance
     ConformancePackRuleCompliance
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackRuleCompliance' {Maybe [Text]
controls :: Maybe [Text]
$sel:controls:ConformancePackRuleCompliance' :: ConformancePackRuleCompliance -> Maybe [Text]
controls} -> Maybe [Text]
controls) (\s :: ConformancePackRuleCompliance
s@ConformancePackRuleCompliance' {} Maybe [Text]
a -> ConformancePackRuleCompliance
s {$sel:controls:ConformancePackRuleCompliance' :: Maybe [Text]
controls = Maybe [Text]
a} :: ConformancePackRuleCompliance) ((Maybe [Text] -> f (Maybe [Text]))
 -> ConformancePackRuleCompliance
 -> f ConformancePackRuleCompliance)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> ConformancePackRuleCompliance
-> f ConformancePackRuleCompliance
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Name of the config rule.
conformancePackRuleCompliance_configRuleName :: Lens.Lens' ConformancePackRuleCompliance (Prelude.Maybe Prelude.Text)
conformancePackRuleCompliance_configRuleName :: (Maybe Text -> f (Maybe Text))
-> ConformancePackRuleCompliance -> f ConformancePackRuleCompliance
conformancePackRuleCompliance_configRuleName = (ConformancePackRuleCompliance -> Maybe Text)
-> (ConformancePackRuleCompliance
    -> Maybe Text -> ConformancePackRuleCompliance)
-> Lens
     ConformancePackRuleCompliance
     ConformancePackRuleCompliance
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackRuleCompliance' {Maybe Text
configRuleName :: Maybe Text
$sel:configRuleName:ConformancePackRuleCompliance' :: ConformancePackRuleCompliance -> Maybe Text
configRuleName} -> Maybe Text
configRuleName) (\s :: ConformancePackRuleCompliance
s@ConformancePackRuleCompliance' {} Maybe Text
a -> ConformancePackRuleCompliance
s {$sel:configRuleName:ConformancePackRuleCompliance' :: Maybe Text
configRuleName = Maybe Text
a} :: ConformancePackRuleCompliance)

-- | Compliance of the Config rule.
--
-- The allowed values are @COMPLIANT@, @NON_COMPLIANT@, and
-- @INSUFFICIENT_DATA@.
conformancePackRuleCompliance_complianceType :: Lens.Lens' ConformancePackRuleCompliance (Prelude.Maybe ConformancePackComplianceType)
conformancePackRuleCompliance_complianceType :: (Maybe ConformancePackComplianceType
 -> f (Maybe ConformancePackComplianceType))
-> ConformancePackRuleCompliance -> f ConformancePackRuleCompliance
conformancePackRuleCompliance_complianceType = (ConformancePackRuleCompliance
 -> Maybe ConformancePackComplianceType)
-> (ConformancePackRuleCompliance
    -> Maybe ConformancePackComplianceType
    -> ConformancePackRuleCompliance)
-> Lens
     ConformancePackRuleCompliance
     ConformancePackRuleCompliance
     (Maybe ConformancePackComplianceType)
     (Maybe ConformancePackComplianceType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackRuleCompliance' {Maybe ConformancePackComplianceType
complianceType :: Maybe ConformancePackComplianceType
$sel:complianceType:ConformancePackRuleCompliance' :: ConformancePackRuleCompliance
-> Maybe ConformancePackComplianceType
complianceType} -> Maybe ConformancePackComplianceType
complianceType) (\s :: ConformancePackRuleCompliance
s@ConformancePackRuleCompliance' {} Maybe ConformancePackComplianceType
a -> ConformancePackRuleCompliance
s {$sel:complianceType:ConformancePackRuleCompliance' :: Maybe ConformancePackComplianceType
complianceType = Maybe ConformancePackComplianceType
a} :: ConformancePackRuleCompliance)

instance Core.FromJSON ConformancePackRuleCompliance where
  parseJSON :: Value -> Parser ConformancePackRuleCompliance
parseJSON =
    String
-> (Object -> Parser ConformancePackRuleCompliance)
-> Value
-> Parser ConformancePackRuleCompliance
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ConformancePackRuleCompliance"
      ( \Object
x ->
          Maybe [Text]
-> Maybe Text
-> Maybe ConformancePackComplianceType
-> ConformancePackRuleCompliance
ConformancePackRuleCompliance'
            (Maybe [Text]
 -> Maybe Text
 -> Maybe ConformancePackComplianceType
 -> ConformancePackRuleCompliance)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe ConformancePackComplianceType
      -> ConformancePackRuleCompliance)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Controls" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe ConformancePackComplianceType
   -> ConformancePackRuleCompliance)
-> Parser (Maybe Text)
-> Parser
     (Maybe ConformancePackComplianceType
      -> ConformancePackRuleCompliance)
forall (f :: * -> *) a b. Applicative f => 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
"ConfigRuleName")
            Parser
  (Maybe ConformancePackComplianceType
   -> ConformancePackRuleCompliance)
-> Parser (Maybe ConformancePackComplianceType)
-> Parser ConformancePackRuleCompliance
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ConformancePackComplianceType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"ComplianceType")
      )

instance
  Prelude.Hashable
    ConformancePackRuleCompliance

instance Prelude.NFData ConformancePackRuleCompliance