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

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

-- | An object that specifies organization managed rule metadata such as
-- resource type and ID of Amazon Web Services resource along with the rule
-- identifier. It also provides the frequency with which you want Config to
-- run evaluations for the rule if the trigger type is periodic.
--
-- /See:/ 'newOrganizationManagedRuleMetadata' smart constructor.
data OrganizationManagedRuleMetadata = OrganizationManagedRuleMetadata'
  { -- | A string, in JSON format, that is passed to organization config rule
    -- Lambda function.
    OrganizationManagedRuleMetadata -> Maybe Text
inputParameters :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Amazon Web Services resource that was evaluated.
    OrganizationManagedRuleMetadata -> Maybe Text
resourceIdScope :: Prelude.Maybe Prelude.Text,
    -- | The optional part of a key-value pair that make up a tag. A value acts
    -- as a descriptor within a tag category (key).
    OrganizationManagedRuleMetadata -> Maybe Text
tagValueScope :: Prelude.Maybe Prelude.Text,
    -- | The maximum frequency with which Config runs evaluations for a rule. You
    -- are using an Config managed rule that is triggered at a periodic
    -- frequency.
    --
    -- By default, rules with a periodic trigger are evaluated every 24 hours.
    -- To change the frequency, specify a valid value for the
    -- @MaximumExecutionFrequency@ parameter.
    OrganizationManagedRuleMetadata -> Maybe MaximumExecutionFrequency
maximumExecutionFrequency :: Prelude.Maybe MaximumExecutionFrequency,
    -- | One part of a key-value pair that make up a tag. A key is a general
    -- label that acts like a category for more specific tag values.
    OrganizationManagedRuleMetadata -> Maybe Text
tagKeyScope :: Prelude.Maybe Prelude.Text,
    -- | The type of the Amazon Web Services resource that was evaluated.
    OrganizationManagedRuleMetadata -> Maybe [Text]
resourceTypesScope :: Prelude.Maybe [Prelude.Text],
    -- | The description that you provide for organization config rule.
    OrganizationManagedRuleMetadata -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | For organization config managed rules, a predefined identifier from a
    -- list. For example, @IAM_PASSWORD_POLICY@ is a managed rule. To reference
    -- a managed rule, see
    -- <https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html Using Config managed rules>.
    OrganizationManagedRuleMetadata -> Text
ruleIdentifier :: Prelude.Text
  }
  deriving (OrganizationManagedRuleMetadata
-> OrganizationManagedRuleMetadata -> Bool
(OrganizationManagedRuleMetadata
 -> OrganizationManagedRuleMetadata -> Bool)
-> (OrganizationManagedRuleMetadata
    -> OrganizationManagedRuleMetadata -> Bool)
-> Eq OrganizationManagedRuleMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OrganizationManagedRuleMetadata
-> OrganizationManagedRuleMetadata -> Bool
$c/= :: OrganizationManagedRuleMetadata
-> OrganizationManagedRuleMetadata -> Bool
== :: OrganizationManagedRuleMetadata
-> OrganizationManagedRuleMetadata -> Bool
$c== :: OrganizationManagedRuleMetadata
-> OrganizationManagedRuleMetadata -> Bool
Prelude.Eq, ReadPrec [OrganizationManagedRuleMetadata]
ReadPrec OrganizationManagedRuleMetadata
Int -> ReadS OrganizationManagedRuleMetadata
ReadS [OrganizationManagedRuleMetadata]
(Int -> ReadS OrganizationManagedRuleMetadata)
-> ReadS [OrganizationManagedRuleMetadata]
-> ReadPrec OrganizationManagedRuleMetadata
-> ReadPrec [OrganizationManagedRuleMetadata]
-> Read OrganizationManagedRuleMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OrganizationManagedRuleMetadata]
$creadListPrec :: ReadPrec [OrganizationManagedRuleMetadata]
readPrec :: ReadPrec OrganizationManagedRuleMetadata
$creadPrec :: ReadPrec OrganizationManagedRuleMetadata
readList :: ReadS [OrganizationManagedRuleMetadata]
$creadList :: ReadS [OrganizationManagedRuleMetadata]
readsPrec :: Int -> ReadS OrganizationManagedRuleMetadata
$creadsPrec :: Int -> ReadS OrganizationManagedRuleMetadata
Prelude.Read, Int -> OrganizationManagedRuleMetadata -> ShowS
[OrganizationManagedRuleMetadata] -> ShowS
OrganizationManagedRuleMetadata -> String
(Int -> OrganizationManagedRuleMetadata -> ShowS)
-> (OrganizationManagedRuleMetadata -> String)
-> ([OrganizationManagedRuleMetadata] -> ShowS)
-> Show OrganizationManagedRuleMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OrganizationManagedRuleMetadata] -> ShowS
$cshowList :: [OrganizationManagedRuleMetadata] -> ShowS
show :: OrganizationManagedRuleMetadata -> String
$cshow :: OrganizationManagedRuleMetadata -> String
showsPrec :: Int -> OrganizationManagedRuleMetadata -> ShowS
$cshowsPrec :: Int -> OrganizationManagedRuleMetadata -> ShowS
Prelude.Show, (forall x.
 OrganizationManagedRuleMetadata
 -> Rep OrganizationManagedRuleMetadata x)
-> (forall x.
    Rep OrganizationManagedRuleMetadata x
    -> OrganizationManagedRuleMetadata)
-> Generic OrganizationManagedRuleMetadata
forall x.
Rep OrganizationManagedRuleMetadata x
-> OrganizationManagedRuleMetadata
forall x.
OrganizationManagedRuleMetadata
-> Rep OrganizationManagedRuleMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep OrganizationManagedRuleMetadata x
-> OrganizationManagedRuleMetadata
$cfrom :: forall x.
OrganizationManagedRuleMetadata
-> Rep OrganizationManagedRuleMetadata x
Prelude.Generic)

-- |
-- Create a value of 'OrganizationManagedRuleMetadata' 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:
--
-- 'inputParameters', 'organizationManagedRuleMetadata_inputParameters' - A string, in JSON format, that is passed to organization config rule
-- Lambda function.
--
-- 'resourceIdScope', 'organizationManagedRuleMetadata_resourceIdScope' - The ID of the Amazon Web Services resource that was evaluated.
--
-- 'tagValueScope', 'organizationManagedRuleMetadata_tagValueScope' - The optional part of a key-value pair that make up a tag. A value acts
-- as a descriptor within a tag category (key).
--
-- 'maximumExecutionFrequency', 'organizationManagedRuleMetadata_maximumExecutionFrequency' - The maximum frequency with which Config runs evaluations for a rule. You
-- are using an Config managed rule that is triggered at a periodic
-- frequency.
--
-- By default, rules with a periodic trigger are evaluated every 24 hours.
-- To change the frequency, specify a valid value for the
-- @MaximumExecutionFrequency@ parameter.
--
-- 'tagKeyScope', 'organizationManagedRuleMetadata_tagKeyScope' - One part of a key-value pair that make up a tag. A key is a general
-- label that acts like a category for more specific tag values.
--
-- 'resourceTypesScope', 'organizationManagedRuleMetadata_resourceTypesScope' - The type of the Amazon Web Services resource that was evaluated.
--
-- 'description', 'organizationManagedRuleMetadata_description' - The description that you provide for organization config rule.
--
-- 'ruleIdentifier', 'organizationManagedRuleMetadata_ruleIdentifier' - For organization config managed rules, a predefined identifier from a
-- list. For example, @IAM_PASSWORD_POLICY@ is a managed rule. To reference
-- a managed rule, see
-- <https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html Using Config managed rules>.
newOrganizationManagedRuleMetadata ::
  -- | 'ruleIdentifier'
  Prelude.Text ->
  OrganizationManagedRuleMetadata
newOrganizationManagedRuleMetadata :: Text -> OrganizationManagedRuleMetadata
newOrganizationManagedRuleMetadata Text
pRuleIdentifier_ =
  OrganizationManagedRuleMetadata' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MaximumExecutionFrequency
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Text
-> OrganizationManagedRuleMetadata
OrganizationManagedRuleMetadata'
    { $sel:inputParameters:OrganizationManagedRuleMetadata' :: Maybe Text
inputParameters =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceIdScope:OrganizationManagedRuleMetadata' :: Maybe Text
resourceIdScope = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tagValueScope:OrganizationManagedRuleMetadata' :: Maybe Text
tagValueScope = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maximumExecutionFrequency:OrganizationManagedRuleMetadata' :: Maybe MaximumExecutionFrequency
maximumExecutionFrequency =
        Maybe MaximumExecutionFrequency
forall a. Maybe a
Prelude.Nothing,
      $sel:tagKeyScope:OrganizationManagedRuleMetadata' :: Maybe Text
tagKeyScope = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:resourceTypesScope:OrganizationManagedRuleMetadata' :: Maybe [Text]
resourceTypesScope = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:description:OrganizationManagedRuleMetadata' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:ruleIdentifier:OrganizationManagedRuleMetadata' :: Text
ruleIdentifier = Text
pRuleIdentifier_
    }

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

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

-- | The optional part of a key-value pair that make up a tag. A value acts
-- as a descriptor within a tag category (key).
organizationManagedRuleMetadata_tagValueScope :: Lens.Lens' OrganizationManagedRuleMetadata (Prelude.Maybe Prelude.Text)
organizationManagedRuleMetadata_tagValueScope :: (Maybe Text -> f (Maybe Text))
-> OrganizationManagedRuleMetadata
-> f OrganizationManagedRuleMetadata
organizationManagedRuleMetadata_tagValueScope = (OrganizationManagedRuleMetadata -> Maybe Text)
-> (OrganizationManagedRuleMetadata
    -> Maybe Text -> OrganizationManagedRuleMetadata)
-> Lens
     OrganizationManagedRuleMetadata
     OrganizationManagedRuleMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationManagedRuleMetadata' {Maybe Text
tagValueScope :: Maybe Text
$sel:tagValueScope:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
tagValueScope} -> Maybe Text
tagValueScope) (\s :: OrganizationManagedRuleMetadata
s@OrganizationManagedRuleMetadata' {} Maybe Text
a -> OrganizationManagedRuleMetadata
s {$sel:tagValueScope:OrganizationManagedRuleMetadata' :: Maybe Text
tagValueScope = Maybe Text
a} :: OrganizationManagedRuleMetadata)

-- | The maximum frequency with which Config runs evaluations for a rule. You
-- are using an Config managed rule that is triggered at a periodic
-- frequency.
--
-- By default, rules with a periodic trigger are evaluated every 24 hours.
-- To change the frequency, specify a valid value for the
-- @MaximumExecutionFrequency@ parameter.
organizationManagedRuleMetadata_maximumExecutionFrequency :: Lens.Lens' OrganizationManagedRuleMetadata (Prelude.Maybe MaximumExecutionFrequency)
organizationManagedRuleMetadata_maximumExecutionFrequency :: (Maybe MaximumExecutionFrequency
 -> f (Maybe MaximumExecutionFrequency))
-> OrganizationManagedRuleMetadata
-> f OrganizationManagedRuleMetadata
organizationManagedRuleMetadata_maximumExecutionFrequency = (OrganizationManagedRuleMetadata
 -> Maybe MaximumExecutionFrequency)
-> (OrganizationManagedRuleMetadata
    -> Maybe MaximumExecutionFrequency
    -> OrganizationManagedRuleMetadata)
-> Lens
     OrganizationManagedRuleMetadata
     OrganizationManagedRuleMetadata
     (Maybe MaximumExecutionFrequency)
     (Maybe MaximumExecutionFrequency)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationManagedRuleMetadata' {Maybe MaximumExecutionFrequency
maximumExecutionFrequency :: Maybe MaximumExecutionFrequency
$sel:maximumExecutionFrequency:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe MaximumExecutionFrequency
maximumExecutionFrequency} -> Maybe MaximumExecutionFrequency
maximumExecutionFrequency) (\s :: OrganizationManagedRuleMetadata
s@OrganizationManagedRuleMetadata' {} Maybe MaximumExecutionFrequency
a -> OrganizationManagedRuleMetadata
s {$sel:maximumExecutionFrequency:OrganizationManagedRuleMetadata' :: Maybe MaximumExecutionFrequency
maximumExecutionFrequency = Maybe MaximumExecutionFrequency
a} :: OrganizationManagedRuleMetadata)

-- | One part of a key-value pair that make up a tag. A key is a general
-- label that acts like a category for more specific tag values.
organizationManagedRuleMetadata_tagKeyScope :: Lens.Lens' OrganizationManagedRuleMetadata (Prelude.Maybe Prelude.Text)
organizationManagedRuleMetadata_tagKeyScope :: (Maybe Text -> f (Maybe Text))
-> OrganizationManagedRuleMetadata
-> f OrganizationManagedRuleMetadata
organizationManagedRuleMetadata_tagKeyScope = (OrganizationManagedRuleMetadata -> Maybe Text)
-> (OrganizationManagedRuleMetadata
    -> Maybe Text -> OrganizationManagedRuleMetadata)
-> Lens
     OrganizationManagedRuleMetadata
     OrganizationManagedRuleMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationManagedRuleMetadata' {Maybe Text
tagKeyScope :: Maybe Text
$sel:tagKeyScope:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
tagKeyScope} -> Maybe Text
tagKeyScope) (\s :: OrganizationManagedRuleMetadata
s@OrganizationManagedRuleMetadata' {} Maybe Text
a -> OrganizationManagedRuleMetadata
s {$sel:tagKeyScope:OrganizationManagedRuleMetadata' :: Maybe Text
tagKeyScope = Maybe Text
a} :: OrganizationManagedRuleMetadata)

-- | The type of the Amazon Web Services resource that was evaluated.
organizationManagedRuleMetadata_resourceTypesScope :: Lens.Lens' OrganizationManagedRuleMetadata (Prelude.Maybe [Prelude.Text])
organizationManagedRuleMetadata_resourceTypesScope :: (Maybe [Text] -> f (Maybe [Text]))
-> OrganizationManagedRuleMetadata
-> f OrganizationManagedRuleMetadata
organizationManagedRuleMetadata_resourceTypesScope = (OrganizationManagedRuleMetadata -> Maybe [Text])
-> (OrganizationManagedRuleMetadata
    -> Maybe [Text] -> OrganizationManagedRuleMetadata)
-> Lens
     OrganizationManagedRuleMetadata
     OrganizationManagedRuleMetadata
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationManagedRuleMetadata' {Maybe [Text]
resourceTypesScope :: Maybe [Text]
$sel:resourceTypesScope:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe [Text]
resourceTypesScope} -> Maybe [Text]
resourceTypesScope) (\s :: OrganizationManagedRuleMetadata
s@OrganizationManagedRuleMetadata' {} Maybe [Text]
a -> OrganizationManagedRuleMetadata
s {$sel:resourceTypesScope:OrganizationManagedRuleMetadata' :: Maybe [Text]
resourceTypesScope = Maybe [Text]
a} :: OrganizationManagedRuleMetadata) ((Maybe [Text] -> f (Maybe [Text]))
 -> OrganizationManagedRuleMetadata
 -> f OrganizationManagedRuleMetadata)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> OrganizationManagedRuleMetadata
-> f OrganizationManagedRuleMetadata
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

-- | The description that you provide for organization config rule.
organizationManagedRuleMetadata_description :: Lens.Lens' OrganizationManagedRuleMetadata (Prelude.Maybe Prelude.Text)
organizationManagedRuleMetadata_description :: (Maybe Text -> f (Maybe Text))
-> OrganizationManagedRuleMetadata
-> f OrganizationManagedRuleMetadata
organizationManagedRuleMetadata_description = (OrganizationManagedRuleMetadata -> Maybe Text)
-> (OrganizationManagedRuleMetadata
    -> Maybe Text -> OrganizationManagedRuleMetadata)
-> Lens
     OrganizationManagedRuleMetadata
     OrganizationManagedRuleMetadata
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationManagedRuleMetadata' {Maybe Text
description :: Maybe Text
$sel:description:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
description} -> Maybe Text
description) (\s :: OrganizationManagedRuleMetadata
s@OrganizationManagedRuleMetadata' {} Maybe Text
a -> OrganizationManagedRuleMetadata
s {$sel:description:OrganizationManagedRuleMetadata' :: Maybe Text
description = Maybe Text
a} :: OrganizationManagedRuleMetadata)

-- | For organization config managed rules, a predefined identifier from a
-- list. For example, @IAM_PASSWORD_POLICY@ is a managed rule. To reference
-- a managed rule, see
-- <https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html Using Config managed rules>.
organizationManagedRuleMetadata_ruleIdentifier :: Lens.Lens' OrganizationManagedRuleMetadata Prelude.Text
organizationManagedRuleMetadata_ruleIdentifier :: (Text -> f Text)
-> OrganizationManagedRuleMetadata
-> f OrganizationManagedRuleMetadata
organizationManagedRuleMetadata_ruleIdentifier = (OrganizationManagedRuleMetadata -> Text)
-> (OrganizationManagedRuleMetadata
    -> Text -> OrganizationManagedRuleMetadata)
-> Lens
     OrganizationManagedRuleMetadata
     OrganizationManagedRuleMetadata
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OrganizationManagedRuleMetadata' {Text
ruleIdentifier :: Text
$sel:ruleIdentifier:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Text
ruleIdentifier} -> Text
ruleIdentifier) (\s :: OrganizationManagedRuleMetadata
s@OrganizationManagedRuleMetadata' {} Text
a -> OrganizationManagedRuleMetadata
s {$sel:ruleIdentifier:OrganizationManagedRuleMetadata' :: Text
ruleIdentifier = Text
a} :: OrganizationManagedRuleMetadata)

instance
  Core.FromJSON
    OrganizationManagedRuleMetadata
  where
  parseJSON :: Value -> Parser OrganizationManagedRuleMetadata
parseJSON =
    String
-> (Object -> Parser OrganizationManagedRuleMetadata)
-> Value
-> Parser OrganizationManagedRuleMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OrganizationManagedRuleMetadata"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MaximumExecutionFrequency
-> Maybe Text
-> Maybe [Text]
-> Maybe Text
-> Text
-> OrganizationManagedRuleMetadata
OrganizationManagedRuleMetadata'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe MaximumExecutionFrequency
 -> Maybe Text
 -> Maybe [Text]
 -> Maybe Text
 -> Text
 -> OrganizationManagedRuleMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe MaximumExecutionFrequency
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> OrganizationManagedRuleMetadata)
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
"InputParameters")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe MaximumExecutionFrequency
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> OrganizationManagedRuleMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe MaximumExecutionFrequency
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> OrganizationManagedRuleMetadata)
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
"ResourceIdScope")
            Parser
  (Maybe Text
   -> Maybe MaximumExecutionFrequency
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> OrganizationManagedRuleMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe MaximumExecutionFrequency
      -> Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> OrganizationManagedRuleMetadata)
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
"TagValueScope")
            Parser
  (Maybe MaximumExecutionFrequency
   -> Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> OrganizationManagedRuleMetadata)
-> Parser (Maybe MaximumExecutionFrequency)
-> Parser
     (Maybe Text
      -> Maybe [Text]
      -> Maybe Text
      -> Text
      -> OrganizationManagedRuleMetadata)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MaximumExecutionFrequency)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MaximumExecutionFrequency")
            Parser
  (Maybe Text
   -> Maybe [Text]
   -> Maybe Text
   -> Text
   -> OrganizationManagedRuleMetadata)
-> Parser (Maybe Text)
-> Parser
     (Maybe [Text]
      -> Maybe Text -> Text -> OrganizationManagedRuleMetadata)
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
"TagKeyScope")
            Parser
  (Maybe [Text]
   -> Maybe Text -> Text -> OrganizationManagedRuleMetadata)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Text -> OrganizationManagedRuleMetadata)
forall (f :: * -> *) a b. Applicative f => 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
"ResourceTypesScope"
                            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 -> Text -> OrganizationManagedRuleMetadata)
-> Parser (Maybe Text)
-> Parser (Text -> OrganizationManagedRuleMetadata)
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
"Description")
            Parser (Text -> OrganizationManagedRuleMetadata)
-> Parser Text -> Parser OrganizationManagedRuleMetadata
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RuleIdentifier")
      )

instance
  Prelude.Hashable
    OrganizationManagedRuleMetadata

instance
  Prelude.NFData
    OrganizationManagedRuleMetadata

instance Core.ToJSON OrganizationManagedRuleMetadata where
  toJSON :: OrganizationManagedRuleMetadata -> Value
toJSON OrganizationManagedRuleMetadata' {Maybe [Text]
Maybe Text
Maybe MaximumExecutionFrequency
Text
ruleIdentifier :: Text
description :: Maybe Text
resourceTypesScope :: Maybe [Text]
tagKeyScope :: Maybe Text
maximumExecutionFrequency :: Maybe MaximumExecutionFrequency
tagValueScope :: Maybe Text
resourceIdScope :: Maybe Text
inputParameters :: Maybe Text
$sel:ruleIdentifier:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Text
$sel:description:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
$sel:resourceTypesScope:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe [Text]
$sel:tagKeyScope:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
$sel:maximumExecutionFrequency:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe MaximumExecutionFrequency
$sel:tagValueScope:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
$sel:resourceIdScope:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
$sel:inputParameters:OrganizationManagedRuleMetadata' :: OrganizationManagedRuleMetadata -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InputParameters" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
inputParameters,
            (Text
"ResourceIdScope" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceIdScope,
            (Text
"TagValueScope" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
tagValueScope,
            (Text
"MaximumExecutionFrequency" Text -> MaximumExecutionFrequency -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (MaximumExecutionFrequency -> Pair)
-> Maybe MaximumExecutionFrequency -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MaximumExecutionFrequency
maximumExecutionFrequency,
            (Text
"TagKeyScope" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
tagKeyScope,
            (Text
"ResourceTypesScope" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
resourceTypesScope,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"RuleIdentifier" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ruleIdentifier)
          ]
      )