{-# 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.WAF.Types.RuleSummary
-- 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.WAF.Types.RuleSummary where

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

-- | This is __AWS WAF Classic__ documentation. For more information, see
-- <https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html AWS WAF Classic>
-- in the developer guide.
--
-- __For the latest version of AWS WAF__, use the AWS WAFV2 API and see the
-- <https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html AWS WAF Developer Guide>.
-- With the latest version, AWS WAF has a single set of endpoints for
-- regional and global use.
--
-- Contains the identifier and the friendly name or description of the
-- @Rule@.
--
-- /See:/ 'newRuleSummary' smart constructor.
data RuleSummary = RuleSummary'
  { -- | A unique identifier for a @Rule@. You use @RuleId@ to get more
    -- information about a @Rule@ (see GetRule), update a @Rule@ (see
    -- UpdateRule), insert a @Rule@ into a @WebACL@ or delete one from a
    -- @WebACL@ (see UpdateWebACL), or delete a @Rule@ from AWS WAF (see
    -- DeleteRule).
    --
    -- @RuleId@ is returned by CreateRule and by ListRules.
    RuleSummary -> Text
ruleId :: Prelude.Text,
    -- | A friendly name or description of the Rule. You can\'t change the name
    -- of a @Rule@ after you create it.
    RuleSummary -> Text
name :: Prelude.Text
  }
  deriving (RuleSummary -> RuleSummary -> Bool
(RuleSummary -> RuleSummary -> Bool)
-> (RuleSummary -> RuleSummary -> Bool) -> Eq RuleSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleSummary -> RuleSummary -> Bool
$c/= :: RuleSummary -> RuleSummary -> Bool
== :: RuleSummary -> RuleSummary -> Bool
$c== :: RuleSummary -> RuleSummary -> Bool
Prelude.Eq, ReadPrec [RuleSummary]
ReadPrec RuleSummary
Int -> ReadS RuleSummary
ReadS [RuleSummary]
(Int -> ReadS RuleSummary)
-> ReadS [RuleSummary]
-> ReadPrec RuleSummary
-> ReadPrec [RuleSummary]
-> Read RuleSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleSummary]
$creadListPrec :: ReadPrec [RuleSummary]
readPrec :: ReadPrec RuleSummary
$creadPrec :: ReadPrec RuleSummary
readList :: ReadS [RuleSummary]
$creadList :: ReadS [RuleSummary]
readsPrec :: Int -> ReadS RuleSummary
$creadsPrec :: Int -> ReadS RuleSummary
Prelude.Read, Int -> RuleSummary -> ShowS
[RuleSummary] -> ShowS
RuleSummary -> String
(Int -> RuleSummary -> ShowS)
-> (RuleSummary -> String)
-> ([RuleSummary] -> ShowS)
-> Show RuleSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleSummary] -> ShowS
$cshowList :: [RuleSummary] -> ShowS
show :: RuleSummary -> String
$cshow :: RuleSummary -> String
showsPrec :: Int -> RuleSummary -> ShowS
$cshowsPrec :: Int -> RuleSummary -> ShowS
Prelude.Show, (forall x. RuleSummary -> Rep RuleSummary x)
-> (forall x. Rep RuleSummary x -> RuleSummary)
-> Generic RuleSummary
forall x. Rep RuleSummary x -> RuleSummary
forall x. RuleSummary -> Rep RuleSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RuleSummary x -> RuleSummary
$cfrom :: forall x. RuleSummary -> Rep RuleSummary x
Prelude.Generic)

-- |
-- Create a value of 'RuleSummary' 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:
--
-- 'ruleId', 'ruleSummary_ruleId' - A unique identifier for a @Rule@. You use @RuleId@ to get more
-- information about a @Rule@ (see GetRule), update a @Rule@ (see
-- UpdateRule), insert a @Rule@ into a @WebACL@ or delete one from a
-- @WebACL@ (see UpdateWebACL), or delete a @Rule@ from AWS WAF (see
-- DeleteRule).
--
-- @RuleId@ is returned by CreateRule and by ListRules.
--
-- 'name', 'ruleSummary_name' - A friendly name or description of the Rule. You can\'t change the name
-- of a @Rule@ after you create it.
newRuleSummary ::
  -- | 'ruleId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  RuleSummary
newRuleSummary :: Text -> Text -> RuleSummary
newRuleSummary Text
pRuleId_ Text
pName_ =
  RuleSummary' :: Text -> Text -> RuleSummary
RuleSummary' {$sel:ruleId:RuleSummary' :: Text
ruleId = Text
pRuleId_, $sel:name:RuleSummary' :: Text
name = Text
pName_}

-- | A unique identifier for a @Rule@. You use @RuleId@ to get more
-- information about a @Rule@ (see GetRule), update a @Rule@ (see
-- UpdateRule), insert a @Rule@ into a @WebACL@ or delete one from a
-- @WebACL@ (see UpdateWebACL), or delete a @Rule@ from AWS WAF (see
-- DeleteRule).
--
-- @RuleId@ is returned by CreateRule and by ListRules.
ruleSummary_ruleId :: Lens.Lens' RuleSummary Prelude.Text
ruleSummary_ruleId :: (Text -> f Text) -> RuleSummary -> f RuleSummary
ruleSummary_ruleId = (RuleSummary -> Text)
-> (RuleSummary -> Text -> RuleSummary)
-> Lens RuleSummary RuleSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleSummary' {Text
ruleId :: Text
$sel:ruleId:RuleSummary' :: RuleSummary -> Text
ruleId} -> Text
ruleId) (\s :: RuleSummary
s@RuleSummary' {} Text
a -> RuleSummary
s {$sel:ruleId:RuleSummary' :: Text
ruleId = Text
a} :: RuleSummary)

-- | A friendly name or description of the Rule. You can\'t change the name
-- of a @Rule@ after you create it.
ruleSummary_name :: Lens.Lens' RuleSummary Prelude.Text
ruleSummary_name :: (Text -> f Text) -> RuleSummary -> f RuleSummary
ruleSummary_name = (RuleSummary -> Text)
-> (RuleSummary -> Text -> RuleSummary)
-> Lens RuleSummary RuleSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleSummary' {Text
name :: Text
$sel:name:RuleSummary' :: RuleSummary -> Text
name} -> Text
name) (\s :: RuleSummary
s@RuleSummary' {} Text
a -> RuleSummary
s {$sel:name:RuleSummary' :: Text
name = Text
a} :: RuleSummary)

instance Core.FromJSON RuleSummary where
  parseJSON :: Value -> Parser RuleSummary
parseJSON =
    String
-> (Object -> Parser RuleSummary) -> Value -> Parser RuleSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RuleSummary"
      ( \Object
x ->
          Text -> Text -> RuleSummary
RuleSummary'
            (Text -> Text -> RuleSummary)
-> Parser Text -> Parser (Text -> RuleSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"RuleId") Parser (Text -> RuleSummary) -> Parser Text -> Parser RuleSummary
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
"Name")
      )

instance Prelude.Hashable RuleSummary

instance Prelude.NFData RuleSummary