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

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

-- | Identifies an Config rule that evaluated an Amazon Web Services
-- resource, and provides the type and ID of the resource that the rule
-- evaluated.
--
-- /See:/ 'newEvaluationResultQualifier' smart constructor.
data EvaluationResultQualifier = EvaluationResultQualifier'
  { -- | The ID of the evaluated Amazon Web Services resource.
    EvaluationResultQualifier -> Maybe Text
resourceId :: Prelude.Maybe Prelude.Text,
    -- | The type of Amazon Web Services resource that was evaluated.
    EvaluationResultQualifier -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
    -- | The name of the Config rule that was used in the evaluation.
    EvaluationResultQualifier -> Maybe Text
configRuleName :: Prelude.Maybe Prelude.Text
  }
  deriving (EvaluationResultQualifier -> EvaluationResultQualifier -> Bool
(EvaluationResultQualifier -> EvaluationResultQualifier -> Bool)
-> (EvaluationResultQualifier -> EvaluationResultQualifier -> Bool)
-> Eq EvaluationResultQualifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EvaluationResultQualifier -> EvaluationResultQualifier -> Bool
$c/= :: EvaluationResultQualifier -> EvaluationResultQualifier -> Bool
== :: EvaluationResultQualifier -> EvaluationResultQualifier -> Bool
$c== :: EvaluationResultQualifier -> EvaluationResultQualifier -> Bool
Prelude.Eq, ReadPrec [EvaluationResultQualifier]
ReadPrec EvaluationResultQualifier
Int -> ReadS EvaluationResultQualifier
ReadS [EvaluationResultQualifier]
(Int -> ReadS EvaluationResultQualifier)
-> ReadS [EvaluationResultQualifier]
-> ReadPrec EvaluationResultQualifier
-> ReadPrec [EvaluationResultQualifier]
-> Read EvaluationResultQualifier
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EvaluationResultQualifier]
$creadListPrec :: ReadPrec [EvaluationResultQualifier]
readPrec :: ReadPrec EvaluationResultQualifier
$creadPrec :: ReadPrec EvaluationResultQualifier
readList :: ReadS [EvaluationResultQualifier]
$creadList :: ReadS [EvaluationResultQualifier]
readsPrec :: Int -> ReadS EvaluationResultQualifier
$creadsPrec :: Int -> ReadS EvaluationResultQualifier
Prelude.Read, Int -> EvaluationResultQualifier -> ShowS
[EvaluationResultQualifier] -> ShowS
EvaluationResultQualifier -> String
(Int -> EvaluationResultQualifier -> ShowS)
-> (EvaluationResultQualifier -> String)
-> ([EvaluationResultQualifier] -> ShowS)
-> Show EvaluationResultQualifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EvaluationResultQualifier] -> ShowS
$cshowList :: [EvaluationResultQualifier] -> ShowS
show :: EvaluationResultQualifier -> String
$cshow :: EvaluationResultQualifier -> String
showsPrec :: Int -> EvaluationResultQualifier -> ShowS
$cshowsPrec :: Int -> EvaluationResultQualifier -> ShowS
Prelude.Show, (forall x.
 EvaluationResultQualifier -> Rep EvaluationResultQualifier x)
-> (forall x.
    Rep EvaluationResultQualifier x -> EvaluationResultQualifier)
-> Generic EvaluationResultQualifier
forall x.
Rep EvaluationResultQualifier x -> EvaluationResultQualifier
forall x.
EvaluationResultQualifier -> Rep EvaluationResultQualifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EvaluationResultQualifier x -> EvaluationResultQualifier
$cfrom :: forall x.
EvaluationResultQualifier -> Rep EvaluationResultQualifier x
Prelude.Generic)

-- |
-- Create a value of 'EvaluationResultQualifier' 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:
--
-- 'resourceId', 'evaluationResultQualifier_resourceId' - The ID of the evaluated Amazon Web Services resource.
--
-- 'resourceType', 'evaluationResultQualifier_resourceType' - The type of Amazon Web Services resource that was evaluated.
--
-- 'configRuleName', 'evaluationResultQualifier_configRuleName' - The name of the Config rule that was used in the evaluation.
newEvaluationResultQualifier ::
  EvaluationResultQualifier
newEvaluationResultQualifier :: EvaluationResultQualifier
newEvaluationResultQualifier =
  EvaluationResultQualifier' :: Maybe Text -> Maybe Text -> Maybe Text -> EvaluationResultQualifier
EvaluationResultQualifier'
    { $sel:resourceId:EvaluationResultQualifier' :: Maybe Text
resourceId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceType:EvaluationResultQualifier' :: Maybe Text
resourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:configRuleName:EvaluationResultQualifier' :: Maybe Text
configRuleName = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the evaluated Amazon Web Services resource.
evaluationResultQualifier_resourceId :: Lens.Lens' EvaluationResultQualifier (Prelude.Maybe Prelude.Text)
evaluationResultQualifier_resourceId :: (Maybe Text -> f (Maybe Text))
-> EvaluationResultQualifier -> f EvaluationResultQualifier
evaluationResultQualifier_resourceId = (EvaluationResultQualifier -> Maybe Text)
-> (EvaluationResultQualifier
    -> Maybe Text -> EvaluationResultQualifier)
-> Lens
     EvaluationResultQualifier
     EvaluationResultQualifier
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluationResultQualifier' {Maybe Text
resourceId :: Maybe Text
$sel:resourceId:EvaluationResultQualifier' :: EvaluationResultQualifier -> Maybe Text
resourceId} -> Maybe Text
resourceId) (\s :: EvaluationResultQualifier
s@EvaluationResultQualifier' {} Maybe Text
a -> EvaluationResultQualifier
s {$sel:resourceId:EvaluationResultQualifier' :: Maybe Text
resourceId = Maybe Text
a} :: EvaluationResultQualifier)

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

-- | The name of the Config rule that was used in the evaluation.
evaluationResultQualifier_configRuleName :: Lens.Lens' EvaluationResultQualifier (Prelude.Maybe Prelude.Text)
evaluationResultQualifier_configRuleName :: (Maybe Text -> f (Maybe Text))
-> EvaluationResultQualifier -> f EvaluationResultQualifier
evaluationResultQualifier_configRuleName = (EvaluationResultQualifier -> Maybe Text)
-> (EvaluationResultQualifier
    -> Maybe Text -> EvaluationResultQualifier)
-> Lens
     EvaluationResultQualifier
     EvaluationResultQualifier
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EvaluationResultQualifier' {Maybe Text
configRuleName :: Maybe Text
$sel:configRuleName:EvaluationResultQualifier' :: EvaluationResultQualifier -> Maybe Text
configRuleName} -> Maybe Text
configRuleName) (\s :: EvaluationResultQualifier
s@EvaluationResultQualifier' {} Maybe Text
a -> EvaluationResultQualifier
s {$sel:configRuleName:EvaluationResultQualifier' :: Maybe Text
configRuleName = Maybe Text
a} :: EvaluationResultQualifier)

instance Core.FromJSON EvaluationResultQualifier where
  parseJSON :: Value -> Parser EvaluationResultQualifier
parseJSON =
    String
-> (Object -> Parser EvaluationResultQualifier)
-> Value
-> Parser EvaluationResultQualifier
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EvaluationResultQualifier"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> EvaluationResultQualifier
EvaluationResultQualifier'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> EvaluationResultQualifier)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> EvaluationResultQualifier)
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
"ResourceId")
            Parser (Maybe Text -> Maybe Text -> EvaluationResultQualifier)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> EvaluationResultQualifier)
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
"ResourceType")
            Parser (Maybe Text -> EvaluationResultQualifier)
-> Parser (Maybe Text) -> Parser EvaluationResultQualifier
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")
      )

instance Prelude.Hashable EvaluationResultQualifier

instance Prelude.NFData EvaluationResultQualifier