{-# 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.ConformancePackEvaluationFilters
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Config.Types.ConformancePackEvaluationFilters where

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

-- | Filters a conformance pack by Config rule names, compliance types,
-- Amazon Web Services resource types, and resource IDs.
--
-- /See:/ 'newConformancePackEvaluationFilters' smart constructor.
data ConformancePackEvaluationFilters = ConformancePackEvaluationFilters'
  { -- | Filters the results by compliance.
    --
    -- The allowed values are @COMPLIANT@ and @NON_COMPLIANT@.
    -- @INSUFFICIENT_DATA@ is not supported.
    ConformancePackEvaluationFilters
-> Maybe ConformancePackComplianceType
complianceType :: Prelude.Maybe ConformancePackComplianceType,
    -- | Filters the results by Config rule names.
    ConformancePackEvaluationFilters -> Maybe [Text]
configRuleNames :: Prelude.Maybe [Prelude.Text],
    -- | Filters the results by resource IDs.
    --
    -- This is valid only when you provide resource type. If there is no
    -- resource type, you will see an error.
    ConformancePackEvaluationFilters -> Maybe [Text]
resourceIds :: Prelude.Maybe [Prelude.Text],
    -- | Filters the results by the resource type (for example,
    -- @\"AWS::EC2::Instance\"@).
    ConformancePackEvaluationFilters -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (ConformancePackEvaluationFilters
-> ConformancePackEvaluationFilters -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConformancePackEvaluationFilters
-> ConformancePackEvaluationFilters -> Bool
$c/= :: ConformancePackEvaluationFilters
-> ConformancePackEvaluationFilters -> Bool
== :: ConformancePackEvaluationFilters
-> ConformancePackEvaluationFilters -> Bool
$c== :: ConformancePackEvaluationFilters
-> ConformancePackEvaluationFilters -> Bool
Prelude.Eq, ReadPrec [ConformancePackEvaluationFilters]
ReadPrec ConformancePackEvaluationFilters
Int -> ReadS ConformancePackEvaluationFilters
ReadS [ConformancePackEvaluationFilters]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConformancePackEvaluationFilters]
$creadListPrec :: ReadPrec [ConformancePackEvaluationFilters]
readPrec :: ReadPrec ConformancePackEvaluationFilters
$creadPrec :: ReadPrec ConformancePackEvaluationFilters
readList :: ReadS [ConformancePackEvaluationFilters]
$creadList :: ReadS [ConformancePackEvaluationFilters]
readsPrec :: Int -> ReadS ConformancePackEvaluationFilters
$creadsPrec :: Int -> ReadS ConformancePackEvaluationFilters
Prelude.Read, Int -> ConformancePackEvaluationFilters -> ShowS
[ConformancePackEvaluationFilters] -> ShowS
ConformancePackEvaluationFilters -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConformancePackEvaluationFilters] -> ShowS
$cshowList :: [ConformancePackEvaluationFilters] -> ShowS
show :: ConformancePackEvaluationFilters -> String
$cshow :: ConformancePackEvaluationFilters -> String
showsPrec :: Int -> ConformancePackEvaluationFilters -> ShowS
$cshowsPrec :: Int -> ConformancePackEvaluationFilters -> ShowS
Prelude.Show, forall x.
Rep ConformancePackEvaluationFilters x
-> ConformancePackEvaluationFilters
forall x.
ConformancePackEvaluationFilters
-> Rep ConformancePackEvaluationFilters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConformancePackEvaluationFilters x
-> ConformancePackEvaluationFilters
$cfrom :: forall x.
ConformancePackEvaluationFilters
-> Rep ConformancePackEvaluationFilters x
Prelude.Generic)

-- |
-- Create a value of 'ConformancePackEvaluationFilters' 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:
--
-- 'complianceType', 'conformancePackEvaluationFilters_complianceType' - Filters the results by compliance.
--
-- The allowed values are @COMPLIANT@ and @NON_COMPLIANT@.
-- @INSUFFICIENT_DATA@ is not supported.
--
-- 'configRuleNames', 'conformancePackEvaluationFilters_configRuleNames' - Filters the results by Config rule names.
--
-- 'resourceIds', 'conformancePackEvaluationFilters_resourceIds' - Filters the results by resource IDs.
--
-- This is valid only when you provide resource type. If there is no
-- resource type, you will see an error.
--
-- 'resourceType', 'conformancePackEvaluationFilters_resourceType' - Filters the results by the resource type (for example,
-- @\"AWS::EC2::Instance\"@).
newConformancePackEvaluationFilters ::
  ConformancePackEvaluationFilters
newConformancePackEvaluationFilters :: ConformancePackEvaluationFilters
newConformancePackEvaluationFilters =
  ConformancePackEvaluationFilters'
    { $sel:complianceType:ConformancePackEvaluationFilters' :: Maybe ConformancePackComplianceType
complianceType =
        forall a. Maybe a
Prelude.Nothing,
      $sel:configRuleNames:ConformancePackEvaluationFilters' :: Maybe [Text]
configRuleNames = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIds:ConformancePackEvaluationFilters' :: Maybe [Text]
resourceIds = forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:ConformancePackEvaluationFilters' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing
    }

-- | Filters the results by compliance.
--
-- The allowed values are @COMPLIANT@ and @NON_COMPLIANT@.
-- @INSUFFICIENT_DATA@ is not supported.
conformancePackEvaluationFilters_complianceType :: Lens.Lens' ConformancePackEvaluationFilters (Prelude.Maybe ConformancePackComplianceType)
conformancePackEvaluationFilters_complianceType :: Lens'
  ConformancePackEvaluationFilters
  (Maybe ConformancePackComplianceType)
conformancePackEvaluationFilters_complianceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationFilters' {Maybe ConformancePackComplianceType
complianceType :: Maybe ConformancePackComplianceType
$sel:complianceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters
-> Maybe ConformancePackComplianceType
complianceType} -> Maybe ConformancePackComplianceType
complianceType) (\s :: ConformancePackEvaluationFilters
s@ConformancePackEvaluationFilters' {} Maybe ConformancePackComplianceType
a -> ConformancePackEvaluationFilters
s {$sel:complianceType:ConformancePackEvaluationFilters' :: Maybe ConformancePackComplianceType
complianceType = Maybe ConformancePackComplianceType
a} :: ConformancePackEvaluationFilters)

-- | Filters the results by Config rule names.
conformancePackEvaluationFilters_configRuleNames :: Lens.Lens' ConformancePackEvaluationFilters (Prelude.Maybe [Prelude.Text])
conformancePackEvaluationFilters_configRuleNames :: Lens' ConformancePackEvaluationFilters (Maybe [Text])
conformancePackEvaluationFilters_configRuleNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationFilters' {Maybe [Text]
configRuleNames :: Maybe [Text]
$sel:configRuleNames:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
configRuleNames} -> Maybe [Text]
configRuleNames) (\s :: ConformancePackEvaluationFilters
s@ConformancePackEvaluationFilters' {} Maybe [Text]
a -> ConformancePackEvaluationFilters
s {$sel:configRuleNames:ConformancePackEvaluationFilters' :: Maybe [Text]
configRuleNames = Maybe [Text]
a} :: ConformancePackEvaluationFilters) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Filters the results by resource IDs.
--
-- This is valid only when you provide resource type. If there is no
-- resource type, you will see an error.
conformancePackEvaluationFilters_resourceIds :: Lens.Lens' ConformancePackEvaluationFilters (Prelude.Maybe [Prelude.Text])
conformancePackEvaluationFilters_resourceIds :: Lens' ConformancePackEvaluationFilters (Maybe [Text])
conformancePackEvaluationFilters_resourceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationFilters' {Maybe [Text]
resourceIds :: Maybe [Text]
$sel:resourceIds:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
resourceIds} -> Maybe [Text]
resourceIds) (\s :: ConformancePackEvaluationFilters
s@ConformancePackEvaluationFilters' {} Maybe [Text]
a -> ConformancePackEvaluationFilters
s {$sel:resourceIds:ConformancePackEvaluationFilters' :: Maybe [Text]
resourceIds = Maybe [Text]
a} :: ConformancePackEvaluationFilters) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Filters the results by the resource type (for example,
-- @\"AWS::EC2::Instance\"@).
conformancePackEvaluationFilters_resourceType :: Lens.Lens' ConformancePackEvaluationFilters (Prelude.Maybe Prelude.Text)
conformancePackEvaluationFilters_resourceType :: Lens' ConformancePackEvaluationFilters (Maybe Text)
conformancePackEvaluationFilters_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConformancePackEvaluationFilters' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: ConformancePackEvaluationFilters
s@ConformancePackEvaluationFilters' {} Maybe Text
a -> ConformancePackEvaluationFilters
s {$sel:resourceType:ConformancePackEvaluationFilters' :: Maybe Text
resourceType = Maybe Text
a} :: ConformancePackEvaluationFilters)

instance
  Prelude.Hashable
    ConformancePackEvaluationFilters
  where
  hashWithSalt :: Int -> ConformancePackEvaluationFilters -> Int
hashWithSalt
    Int
_salt
    ConformancePackEvaluationFilters' {Maybe [Text]
Maybe Text
Maybe ConformancePackComplianceType
resourceType :: Maybe Text
resourceIds :: Maybe [Text]
configRuleNames :: Maybe [Text]
complianceType :: Maybe ConformancePackComplianceType
$sel:resourceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe Text
$sel:resourceIds:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
$sel:configRuleNames:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
$sel:complianceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters
-> Maybe ConformancePackComplianceType
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConformancePackComplianceType
complianceType
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
configRuleNames
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
resourceIds
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
resourceType

instance
  Prelude.NFData
    ConformancePackEvaluationFilters
  where
  rnf :: ConformancePackEvaluationFilters -> ()
rnf ConformancePackEvaluationFilters' {Maybe [Text]
Maybe Text
Maybe ConformancePackComplianceType
resourceType :: Maybe Text
resourceIds :: Maybe [Text]
configRuleNames :: Maybe [Text]
complianceType :: Maybe ConformancePackComplianceType
$sel:resourceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe Text
$sel:resourceIds:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
$sel:configRuleNames:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
$sel:complianceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters
-> Maybe ConformancePackComplianceType
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe ConformancePackComplianceType
complianceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
configRuleNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
resourceIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType

instance Data.ToJSON ConformancePackEvaluationFilters where
  toJSON :: ConformancePackEvaluationFilters -> Value
toJSON ConformancePackEvaluationFilters' {Maybe [Text]
Maybe Text
Maybe ConformancePackComplianceType
resourceType :: Maybe Text
resourceIds :: Maybe [Text]
configRuleNames :: Maybe [Text]
complianceType :: Maybe ConformancePackComplianceType
$sel:resourceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe Text
$sel:resourceIds:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
$sel:configRuleNames:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters -> Maybe [Text]
$sel:complianceType:ConformancePackEvaluationFilters' :: ConformancePackEvaluationFilters
-> Maybe ConformancePackComplianceType
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ComplianceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConformancePackComplianceType
complianceType,
            (Key
"ConfigRuleNames" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
configRuleNames,
            (Key
"ResourceIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
resourceIds,
            (Key
"ResourceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceType
          ]
      )