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

import Amazonka.Config.Types.ConfigRuleState
import Amazonka.Config.Types.EvaluationModeConfiguration
import Amazonka.Config.Types.MaximumExecutionFrequency
import Amazonka.Config.Types.Scope
import Amazonka.Config.Types.Source
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

-- | Config rules evaluate the configuration settings of your Amazon Web
-- Services resources. A rule can run when Config detects a configuration
-- change to an Amazon Web Services resource or at a periodic frequency
-- that you choose (for example, every 24 hours). There are two types of
-- rules: Config Managed Rules and Config Custom Rules. Managed rules are
-- predefined, customizable rules created by Config. For a list of managed
-- rules, see
-- <https://docs.aws.amazon.com/config/latest/developerguide/managed-rules-by-aws-config.html List of Config Managed Rules>.
--
-- Custom rules are rules that you can create using either Guard or Lambda
-- functions. Guard
-- (<https://github.com/aws-cloudformation/cloudformation-guard Guard GitHub Repository>)
-- is a policy-as-code language that allows you to write policies that are
-- enforced by Config Custom Policy rules. Lambda uses custom code that you
-- upload to evaluate a custom rule. It is invoked by events that are
-- published to it by an event source, which Config invokes when the custom
-- rule is initiated.
--
-- For more information about developing and using Config rules, see
-- <https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config.html Evaluating Amazon Web Services resource Configurations with Config>
-- in the /Config Developer Guide/.
--
-- You can use the Amazon Web Services CLI and Amazon Web Services SDKs if
-- you want to create a rule that triggers evaluations for your resources
-- when Config delivers the configuration snapshot. For more information,
-- see ConfigSnapshotDeliveryProperties.
--
-- /See:/ 'newConfigRule' smart constructor.
data ConfigRule = ConfigRule'
  { -- | The Amazon Resource Name (ARN) of the Config rule.
    ConfigRule -> Maybe Text
configRuleArn :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Config rule.
    ConfigRule -> Maybe Text
configRuleId :: Prelude.Maybe Prelude.Text,
    -- | The name that you assign to the Config rule. The name is required if you
    -- are adding a new rule.
    ConfigRule -> Maybe Text
configRuleName :: Prelude.Maybe Prelude.Text,
    -- | Indicates whether the Config rule is active or is currently being
    -- deleted by Config. It can also indicate the evaluation status for the
    -- Config rule.
    --
    -- Config sets the state of the rule to @EVALUATING@ temporarily after you
    -- use the @StartConfigRulesEvaluation@ request to evaluate your resources
    -- against the Config rule.
    --
    -- Config sets the state of the rule to @DELETING_RESULTS@ temporarily
    -- after you use the @DeleteEvaluationResults@ request to delete the
    -- current evaluation results for the Config rule.
    --
    -- Config temporarily sets the state of a rule to @DELETING@ after you use
    -- the @DeleteConfigRule@ request to delete the rule. After Config deletes
    -- the rule, the rule and all of its evaluations are erased and are no
    -- longer available.
    ConfigRule -> Maybe ConfigRuleState
configRuleState :: Prelude.Maybe ConfigRuleState,
    -- | Service principal name of the service that created the rule.
    --
    -- The field is populated only if the service-linked rule is created by a
    -- service. The field is empty if you create your own rule.
    ConfigRule -> Maybe Text
createdBy :: Prelude.Maybe Prelude.Text,
    -- | The description that you provide for the Config rule.
    ConfigRule -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The modes the Config rule can be evaluated in. The valid values are
    -- distinct objects. By default, the value is Detective evaluation mode
    -- only.
    ConfigRule -> Maybe [EvaluationModeConfiguration]
evaluationModes :: Prelude.Maybe [EvaluationModeConfiguration],
    -- | A string, in JSON format, that is passed to the Config rule Lambda
    -- function.
    ConfigRule -> Maybe Text
inputParameters :: Prelude.Maybe Prelude.Text,
    -- | The maximum frequency with which Config runs evaluations for a rule. You
    -- can specify a value for @MaximumExecutionFrequency@ when:
    --
    -- -   This is for an Config managed rule that is triggered at a periodic
    --     frequency.
    --
    -- -   Your custom rule is triggered when Config delivers the configuration
    --     snapshot. For more information, see
    --     ConfigSnapshotDeliveryProperties.
    --
    -- By default, rules with a periodic trigger are evaluated every 24 hours.
    -- To change the frequency, specify a valid value for the
    -- @MaximumExecutionFrequency@ parameter.
    ConfigRule -> Maybe MaximumExecutionFrequency
maximumExecutionFrequency :: Prelude.Maybe MaximumExecutionFrequency,
    -- | Defines which resources can trigger an evaluation for the rule. The
    -- scope can include one or more resource types, a combination of one
    -- resource type and one resource ID, or a combination of a tag key and
    -- value. Specify a scope to constrain the resources that can trigger an
    -- evaluation for the rule. If you do not specify a scope, evaluations are
    -- triggered when any resource in the recording group changes.
    --
    -- The scope can be empty.
    ConfigRule -> Maybe Scope
scope :: Prelude.Maybe Scope,
    -- | Provides the rule owner (@Amazon Web Services@ for managed rules,
    -- @CUSTOM_POLICY@ for Custom Policy rules, and @CUSTOM_LAMBDA@ for Custom
    -- Lambda rules), the rule identifier, and the notifications that cause the
    -- function to evaluate your Amazon Web Services resources.
    ConfigRule -> Source
source :: Source
  }
  deriving (ConfigRule -> ConfigRule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConfigRule -> ConfigRule -> Bool
$c/= :: ConfigRule -> ConfigRule -> Bool
== :: ConfigRule -> ConfigRule -> Bool
$c== :: ConfigRule -> ConfigRule -> Bool
Prelude.Eq, ReadPrec [ConfigRule]
ReadPrec ConfigRule
Int -> ReadS ConfigRule
ReadS [ConfigRule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConfigRule]
$creadListPrec :: ReadPrec [ConfigRule]
readPrec :: ReadPrec ConfigRule
$creadPrec :: ReadPrec ConfigRule
readList :: ReadS [ConfigRule]
$creadList :: ReadS [ConfigRule]
readsPrec :: Int -> ReadS ConfigRule
$creadsPrec :: Int -> ReadS ConfigRule
Prelude.Read, Int -> ConfigRule -> ShowS
[ConfigRule] -> ShowS
ConfigRule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConfigRule] -> ShowS
$cshowList :: [ConfigRule] -> ShowS
show :: ConfigRule -> String
$cshow :: ConfigRule -> String
showsPrec :: Int -> ConfigRule -> ShowS
$cshowsPrec :: Int -> ConfigRule -> ShowS
Prelude.Show, forall x. Rep ConfigRule x -> ConfigRule
forall x. ConfigRule -> Rep ConfigRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ConfigRule x -> ConfigRule
$cfrom :: forall x. ConfigRule -> Rep ConfigRule x
Prelude.Generic)

-- |
-- Create a value of 'ConfigRule' 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:
--
-- 'configRuleArn', 'configRule_configRuleArn' - The Amazon Resource Name (ARN) of the Config rule.
--
-- 'configRuleId', 'configRule_configRuleId' - The ID of the Config rule.
--
-- 'configRuleName', 'configRule_configRuleName' - The name that you assign to the Config rule. The name is required if you
-- are adding a new rule.
--
-- 'configRuleState', 'configRule_configRuleState' - Indicates whether the Config rule is active or is currently being
-- deleted by Config. It can also indicate the evaluation status for the
-- Config rule.
--
-- Config sets the state of the rule to @EVALUATING@ temporarily after you
-- use the @StartConfigRulesEvaluation@ request to evaluate your resources
-- against the Config rule.
--
-- Config sets the state of the rule to @DELETING_RESULTS@ temporarily
-- after you use the @DeleteEvaluationResults@ request to delete the
-- current evaluation results for the Config rule.
--
-- Config temporarily sets the state of a rule to @DELETING@ after you use
-- the @DeleteConfigRule@ request to delete the rule. After Config deletes
-- the rule, the rule and all of its evaluations are erased and are no
-- longer available.
--
-- 'createdBy', 'configRule_createdBy' - Service principal name of the service that created the rule.
--
-- The field is populated only if the service-linked rule is created by a
-- service. The field is empty if you create your own rule.
--
-- 'description', 'configRule_description' - The description that you provide for the Config rule.
--
-- 'evaluationModes', 'configRule_evaluationModes' - The modes the Config rule can be evaluated in. The valid values are
-- distinct objects. By default, the value is Detective evaluation mode
-- only.
--
-- 'inputParameters', 'configRule_inputParameters' - A string, in JSON format, that is passed to the Config rule Lambda
-- function.
--
-- 'maximumExecutionFrequency', 'configRule_maximumExecutionFrequency' - The maximum frequency with which Config runs evaluations for a rule. You
-- can specify a value for @MaximumExecutionFrequency@ when:
--
-- -   This is for an Config managed rule that is triggered at a periodic
--     frequency.
--
-- -   Your custom rule is triggered when Config delivers the configuration
--     snapshot. For more information, see
--     ConfigSnapshotDeliveryProperties.
--
-- By default, rules with a periodic trigger are evaluated every 24 hours.
-- To change the frequency, specify a valid value for the
-- @MaximumExecutionFrequency@ parameter.
--
-- 'scope', 'configRule_scope' - Defines which resources can trigger an evaluation for the rule. The
-- scope can include one or more resource types, a combination of one
-- resource type and one resource ID, or a combination of a tag key and
-- value. Specify a scope to constrain the resources that can trigger an
-- evaluation for the rule. If you do not specify a scope, evaluations are
-- triggered when any resource in the recording group changes.
--
-- The scope can be empty.
--
-- 'source', 'configRule_source' - Provides the rule owner (@Amazon Web Services@ for managed rules,
-- @CUSTOM_POLICY@ for Custom Policy rules, and @CUSTOM_LAMBDA@ for Custom
-- Lambda rules), the rule identifier, and the notifications that cause the
-- function to evaluate your Amazon Web Services resources.
newConfigRule ::
  -- | 'source'
  Source ->
  ConfigRule
newConfigRule :: Source -> ConfigRule
newConfigRule Source
pSource_ =
  ConfigRule'
    { $sel:configRuleArn:ConfigRule' :: Maybe Text
configRuleArn = forall a. Maybe a
Prelude.Nothing,
      $sel:configRuleId:ConfigRule' :: Maybe Text
configRuleId = forall a. Maybe a
Prelude.Nothing,
      $sel:configRuleName:ConfigRule' :: Maybe Text
configRuleName = forall a. Maybe a
Prelude.Nothing,
      $sel:configRuleState:ConfigRule' :: Maybe ConfigRuleState
configRuleState = forall a. Maybe a
Prelude.Nothing,
      $sel:createdBy:ConfigRule' :: Maybe Text
createdBy = forall a. Maybe a
Prelude.Nothing,
      $sel:description:ConfigRule' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:evaluationModes:ConfigRule' :: Maybe [EvaluationModeConfiguration]
evaluationModes = forall a. Maybe a
Prelude.Nothing,
      $sel:inputParameters:ConfigRule' :: Maybe Text
inputParameters = forall a. Maybe a
Prelude.Nothing,
      $sel:maximumExecutionFrequency:ConfigRule' :: Maybe MaximumExecutionFrequency
maximumExecutionFrequency = forall a. Maybe a
Prelude.Nothing,
      $sel:scope:ConfigRule' :: Maybe Scope
scope = forall a. Maybe a
Prelude.Nothing,
      $sel:source:ConfigRule' :: Source
source = Source
pSource_
    }

-- | The Amazon Resource Name (ARN) of the Config rule.
configRule_configRuleArn :: Lens.Lens' ConfigRule (Prelude.Maybe Prelude.Text)
configRule_configRuleArn :: Lens' ConfigRule (Maybe Text)
configRule_configRuleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe Text
configRuleArn :: Maybe Text
$sel:configRuleArn:ConfigRule' :: ConfigRule -> Maybe Text
configRuleArn} -> Maybe Text
configRuleArn) (\s :: ConfigRule
s@ConfigRule' {} Maybe Text
a -> ConfigRule
s {$sel:configRuleArn:ConfigRule' :: Maybe Text
configRuleArn = Maybe Text
a} :: ConfigRule)

-- | The ID of the Config rule.
configRule_configRuleId :: Lens.Lens' ConfigRule (Prelude.Maybe Prelude.Text)
configRule_configRuleId :: Lens' ConfigRule (Maybe Text)
configRule_configRuleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe Text
configRuleId :: Maybe Text
$sel:configRuleId:ConfigRule' :: ConfigRule -> Maybe Text
configRuleId} -> Maybe Text
configRuleId) (\s :: ConfigRule
s@ConfigRule' {} Maybe Text
a -> ConfigRule
s {$sel:configRuleId:ConfigRule' :: Maybe Text
configRuleId = Maybe Text
a} :: ConfigRule)

-- | The name that you assign to the Config rule. The name is required if you
-- are adding a new rule.
configRule_configRuleName :: Lens.Lens' ConfigRule (Prelude.Maybe Prelude.Text)
configRule_configRuleName :: Lens' ConfigRule (Maybe Text)
configRule_configRuleName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe Text
configRuleName :: Maybe Text
$sel:configRuleName:ConfigRule' :: ConfigRule -> Maybe Text
configRuleName} -> Maybe Text
configRuleName) (\s :: ConfigRule
s@ConfigRule' {} Maybe Text
a -> ConfigRule
s {$sel:configRuleName:ConfigRule' :: Maybe Text
configRuleName = Maybe Text
a} :: ConfigRule)

-- | Indicates whether the Config rule is active or is currently being
-- deleted by Config. It can also indicate the evaluation status for the
-- Config rule.
--
-- Config sets the state of the rule to @EVALUATING@ temporarily after you
-- use the @StartConfigRulesEvaluation@ request to evaluate your resources
-- against the Config rule.
--
-- Config sets the state of the rule to @DELETING_RESULTS@ temporarily
-- after you use the @DeleteEvaluationResults@ request to delete the
-- current evaluation results for the Config rule.
--
-- Config temporarily sets the state of a rule to @DELETING@ after you use
-- the @DeleteConfigRule@ request to delete the rule. After Config deletes
-- the rule, the rule and all of its evaluations are erased and are no
-- longer available.
configRule_configRuleState :: Lens.Lens' ConfigRule (Prelude.Maybe ConfigRuleState)
configRule_configRuleState :: Lens' ConfigRule (Maybe ConfigRuleState)
configRule_configRuleState = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe ConfigRuleState
configRuleState :: Maybe ConfigRuleState
$sel:configRuleState:ConfigRule' :: ConfigRule -> Maybe ConfigRuleState
configRuleState} -> Maybe ConfigRuleState
configRuleState) (\s :: ConfigRule
s@ConfigRule' {} Maybe ConfigRuleState
a -> ConfigRule
s {$sel:configRuleState:ConfigRule' :: Maybe ConfigRuleState
configRuleState = Maybe ConfigRuleState
a} :: ConfigRule)

-- | Service principal name of the service that created the rule.
--
-- The field is populated only if the service-linked rule is created by a
-- service. The field is empty if you create your own rule.
configRule_createdBy :: Lens.Lens' ConfigRule (Prelude.Maybe Prelude.Text)
configRule_createdBy :: Lens' ConfigRule (Maybe Text)
configRule_createdBy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe Text
createdBy :: Maybe Text
$sel:createdBy:ConfigRule' :: ConfigRule -> Maybe Text
createdBy} -> Maybe Text
createdBy) (\s :: ConfigRule
s@ConfigRule' {} Maybe Text
a -> ConfigRule
s {$sel:createdBy:ConfigRule' :: Maybe Text
createdBy = Maybe Text
a} :: ConfigRule)

-- | The description that you provide for the Config rule.
configRule_description :: Lens.Lens' ConfigRule (Prelude.Maybe Prelude.Text)
configRule_description :: Lens' ConfigRule (Maybe Text)
configRule_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe Text
description :: Maybe Text
$sel:description:ConfigRule' :: ConfigRule -> Maybe Text
description} -> Maybe Text
description) (\s :: ConfigRule
s@ConfigRule' {} Maybe Text
a -> ConfigRule
s {$sel:description:ConfigRule' :: Maybe Text
description = Maybe Text
a} :: ConfigRule)

-- | The modes the Config rule can be evaluated in. The valid values are
-- distinct objects. By default, the value is Detective evaluation mode
-- only.
configRule_evaluationModes :: Lens.Lens' ConfigRule (Prelude.Maybe [EvaluationModeConfiguration])
configRule_evaluationModes :: Lens' ConfigRule (Maybe [EvaluationModeConfiguration])
configRule_evaluationModes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe [EvaluationModeConfiguration]
evaluationModes :: Maybe [EvaluationModeConfiguration]
$sel:evaluationModes:ConfigRule' :: ConfigRule -> Maybe [EvaluationModeConfiguration]
evaluationModes} -> Maybe [EvaluationModeConfiguration]
evaluationModes) (\s :: ConfigRule
s@ConfigRule' {} Maybe [EvaluationModeConfiguration]
a -> ConfigRule
s {$sel:evaluationModes:ConfigRule' :: Maybe [EvaluationModeConfiguration]
evaluationModes = Maybe [EvaluationModeConfiguration]
a} :: ConfigRule) 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

-- | A string, in JSON format, that is passed to the Config rule Lambda
-- function.
configRule_inputParameters :: Lens.Lens' ConfigRule (Prelude.Maybe Prelude.Text)
configRule_inputParameters :: Lens' ConfigRule (Maybe Text)
configRule_inputParameters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe Text
inputParameters :: Maybe Text
$sel:inputParameters:ConfigRule' :: ConfigRule -> Maybe Text
inputParameters} -> Maybe Text
inputParameters) (\s :: ConfigRule
s@ConfigRule' {} Maybe Text
a -> ConfigRule
s {$sel:inputParameters:ConfigRule' :: Maybe Text
inputParameters = Maybe Text
a} :: ConfigRule)

-- | The maximum frequency with which Config runs evaluations for a rule. You
-- can specify a value for @MaximumExecutionFrequency@ when:
--
-- -   This is for an Config managed rule that is triggered at a periodic
--     frequency.
--
-- -   Your custom rule is triggered when Config delivers the configuration
--     snapshot. For more information, see
--     ConfigSnapshotDeliveryProperties.
--
-- By default, rules with a periodic trigger are evaluated every 24 hours.
-- To change the frequency, specify a valid value for the
-- @MaximumExecutionFrequency@ parameter.
configRule_maximumExecutionFrequency :: Lens.Lens' ConfigRule (Prelude.Maybe MaximumExecutionFrequency)
configRule_maximumExecutionFrequency :: Lens' ConfigRule (Maybe MaximumExecutionFrequency)
configRule_maximumExecutionFrequency = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe MaximumExecutionFrequency
maximumExecutionFrequency :: Maybe MaximumExecutionFrequency
$sel:maximumExecutionFrequency:ConfigRule' :: ConfigRule -> Maybe MaximumExecutionFrequency
maximumExecutionFrequency} -> Maybe MaximumExecutionFrequency
maximumExecutionFrequency) (\s :: ConfigRule
s@ConfigRule' {} Maybe MaximumExecutionFrequency
a -> ConfigRule
s {$sel:maximumExecutionFrequency:ConfigRule' :: Maybe MaximumExecutionFrequency
maximumExecutionFrequency = Maybe MaximumExecutionFrequency
a} :: ConfigRule)

-- | Defines which resources can trigger an evaluation for the rule. The
-- scope can include one or more resource types, a combination of one
-- resource type and one resource ID, or a combination of a tag key and
-- value. Specify a scope to constrain the resources that can trigger an
-- evaluation for the rule. If you do not specify a scope, evaluations are
-- triggered when any resource in the recording group changes.
--
-- The scope can be empty.
configRule_scope :: Lens.Lens' ConfigRule (Prelude.Maybe Scope)
configRule_scope :: Lens' ConfigRule (Maybe Scope)
configRule_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Maybe Scope
scope :: Maybe Scope
$sel:scope:ConfigRule' :: ConfigRule -> Maybe Scope
scope} -> Maybe Scope
scope) (\s :: ConfigRule
s@ConfigRule' {} Maybe Scope
a -> ConfigRule
s {$sel:scope:ConfigRule' :: Maybe Scope
scope = Maybe Scope
a} :: ConfigRule)

-- | Provides the rule owner (@Amazon Web Services@ for managed rules,
-- @CUSTOM_POLICY@ for Custom Policy rules, and @CUSTOM_LAMBDA@ for Custom
-- Lambda rules), the rule identifier, and the notifications that cause the
-- function to evaluate your Amazon Web Services resources.
configRule_source :: Lens.Lens' ConfigRule Source
configRule_source :: Lens' ConfigRule Source
configRule_source = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConfigRule' {Source
source :: Source
$sel:source:ConfigRule' :: ConfigRule -> Source
source} -> Source
source) (\s :: ConfigRule
s@ConfigRule' {} Source
a -> ConfigRule
s {$sel:source:ConfigRule' :: Source
source = Source
a} :: ConfigRule)

instance Data.FromJSON ConfigRule where
  parseJSON :: Value -> Parser ConfigRule
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ConfigRule"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe ConfigRuleState
-> Maybe Text
-> Maybe Text
-> Maybe [EvaluationModeConfiguration]
-> Maybe Text
-> Maybe MaximumExecutionFrequency
-> Maybe Scope
-> Source
-> ConfigRule
ConfigRule'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ConfigRuleArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ConfigRuleId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ConfigRuleName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ConfigRuleState")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"CreatedBy")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"EvaluationModes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"InputParameters")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"MaximumExecutionFrequency")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Scope")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"Source")
      )

instance Prelude.Hashable ConfigRule where
  hashWithSalt :: Int -> ConfigRule -> Int
hashWithSalt Int
_salt ConfigRule' {Maybe [EvaluationModeConfiguration]
Maybe Text
Maybe ConfigRuleState
Maybe MaximumExecutionFrequency
Maybe Scope
Source
source :: Source
scope :: Maybe Scope
maximumExecutionFrequency :: Maybe MaximumExecutionFrequency
inputParameters :: Maybe Text
evaluationModes :: Maybe [EvaluationModeConfiguration]
description :: Maybe Text
createdBy :: Maybe Text
configRuleState :: Maybe ConfigRuleState
configRuleName :: Maybe Text
configRuleId :: Maybe Text
configRuleArn :: Maybe Text
$sel:source:ConfigRule' :: ConfigRule -> Source
$sel:scope:ConfigRule' :: ConfigRule -> Maybe Scope
$sel:maximumExecutionFrequency:ConfigRule' :: ConfigRule -> Maybe MaximumExecutionFrequency
$sel:inputParameters:ConfigRule' :: ConfigRule -> Maybe Text
$sel:evaluationModes:ConfigRule' :: ConfigRule -> Maybe [EvaluationModeConfiguration]
$sel:description:ConfigRule' :: ConfigRule -> Maybe Text
$sel:createdBy:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleState:ConfigRule' :: ConfigRule -> Maybe ConfigRuleState
$sel:configRuleName:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleId:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleArn:ConfigRule' :: ConfigRule -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configRuleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configRuleId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
configRuleName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ConfigRuleState
configRuleState
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
createdBy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EvaluationModeConfiguration]
evaluationModes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
inputParameters
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe MaximumExecutionFrequency
maximumExecutionFrequency
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Scope
scope
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Source
source

instance Prelude.NFData ConfigRule where
  rnf :: ConfigRule -> ()
rnf ConfigRule' {Maybe [EvaluationModeConfiguration]
Maybe Text
Maybe ConfigRuleState
Maybe MaximumExecutionFrequency
Maybe Scope
Source
source :: Source
scope :: Maybe Scope
maximumExecutionFrequency :: Maybe MaximumExecutionFrequency
inputParameters :: Maybe Text
evaluationModes :: Maybe [EvaluationModeConfiguration]
description :: Maybe Text
createdBy :: Maybe Text
configRuleState :: Maybe ConfigRuleState
configRuleName :: Maybe Text
configRuleId :: Maybe Text
configRuleArn :: Maybe Text
$sel:source:ConfigRule' :: ConfigRule -> Source
$sel:scope:ConfigRule' :: ConfigRule -> Maybe Scope
$sel:maximumExecutionFrequency:ConfigRule' :: ConfigRule -> Maybe MaximumExecutionFrequency
$sel:inputParameters:ConfigRule' :: ConfigRule -> Maybe Text
$sel:evaluationModes:ConfigRule' :: ConfigRule -> Maybe [EvaluationModeConfiguration]
$sel:description:ConfigRule' :: ConfigRule -> Maybe Text
$sel:createdBy:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleState:ConfigRule' :: ConfigRule -> Maybe ConfigRuleState
$sel:configRuleName:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleId:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleArn:ConfigRule' :: ConfigRule -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configRuleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configRuleId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
configRuleName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ConfigRuleState
configRuleState
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
createdBy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [EvaluationModeConfiguration]
evaluationModes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
inputParameters
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe MaximumExecutionFrequency
maximumExecutionFrequency
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Scope
scope
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Source
source

instance Data.ToJSON ConfigRule where
  toJSON :: ConfigRule -> Value
toJSON ConfigRule' {Maybe [EvaluationModeConfiguration]
Maybe Text
Maybe ConfigRuleState
Maybe MaximumExecutionFrequency
Maybe Scope
Source
source :: Source
scope :: Maybe Scope
maximumExecutionFrequency :: Maybe MaximumExecutionFrequency
inputParameters :: Maybe Text
evaluationModes :: Maybe [EvaluationModeConfiguration]
description :: Maybe Text
createdBy :: Maybe Text
configRuleState :: Maybe ConfigRuleState
configRuleName :: Maybe Text
configRuleId :: Maybe Text
configRuleArn :: Maybe Text
$sel:source:ConfigRule' :: ConfigRule -> Source
$sel:scope:ConfigRule' :: ConfigRule -> Maybe Scope
$sel:maximumExecutionFrequency:ConfigRule' :: ConfigRule -> Maybe MaximumExecutionFrequency
$sel:inputParameters:ConfigRule' :: ConfigRule -> Maybe Text
$sel:evaluationModes:ConfigRule' :: ConfigRule -> Maybe [EvaluationModeConfiguration]
$sel:description:ConfigRule' :: ConfigRule -> Maybe Text
$sel:createdBy:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleState:ConfigRule' :: ConfigRule -> Maybe ConfigRuleState
$sel:configRuleName:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleId:ConfigRule' :: ConfigRule -> Maybe Text
$sel:configRuleArn:ConfigRule' :: ConfigRule -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ConfigRuleArn" 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
configRuleArn,
            (Key
"ConfigRuleId" 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
configRuleId,
            (Key
"ConfigRuleName" 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
configRuleName,
            (Key
"ConfigRuleState" 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 ConfigRuleState
configRuleState,
            (Key
"CreatedBy" 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
createdBy,
            (Key
"Description" 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
description,
            (Key
"EvaluationModes" 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 [EvaluationModeConfiguration]
evaluationModes,
            (Key
"InputParameters" 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
inputParameters,
            (Key
"MaximumExecutionFrequency" 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 MaximumExecutionFrequency
maximumExecutionFrequency,
            (Key
"Scope" 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 Scope
scope,
            forall a. a -> Maybe a
Prelude.Just (Key
"Source" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Source
source)
          ]
      )