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

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

-- | 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
-- @RuleGroup@.
--
-- /See:/ 'newRuleGroupSummary' smart constructor.
data RuleGroupSummary = RuleGroupSummary'
  { -- | A unique identifier for a @RuleGroup@. You use @RuleGroupId@ to get more
    -- information about a @RuleGroup@ (see GetRuleGroup), update a @RuleGroup@
    -- (see UpdateRuleGroup), insert a @RuleGroup@ into a @WebACL@ or delete
    -- one from a @WebACL@ (see UpdateWebACL), or delete a @RuleGroup@ from AWS
    -- WAF (see DeleteRuleGroup).
    --
    -- @RuleGroupId@ is returned by CreateRuleGroup and by ListRuleGroups.
    RuleGroupSummary -> Text
ruleGroupId :: Prelude.Text,
    -- | A friendly name or description of the RuleGroup. You can\'t change the
    -- name of a @RuleGroup@ after you create it.
    RuleGroupSummary -> Text
name :: Prelude.Text
  }
  deriving (RuleGroupSummary -> RuleGroupSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RuleGroupSummary -> RuleGroupSummary -> Bool
$c/= :: RuleGroupSummary -> RuleGroupSummary -> Bool
== :: RuleGroupSummary -> RuleGroupSummary -> Bool
$c== :: RuleGroupSummary -> RuleGroupSummary -> Bool
Prelude.Eq, ReadPrec [RuleGroupSummary]
ReadPrec RuleGroupSummary
Int -> ReadS RuleGroupSummary
ReadS [RuleGroupSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RuleGroupSummary]
$creadListPrec :: ReadPrec [RuleGroupSummary]
readPrec :: ReadPrec RuleGroupSummary
$creadPrec :: ReadPrec RuleGroupSummary
readList :: ReadS [RuleGroupSummary]
$creadList :: ReadS [RuleGroupSummary]
readsPrec :: Int -> ReadS RuleGroupSummary
$creadsPrec :: Int -> ReadS RuleGroupSummary
Prelude.Read, Int -> RuleGroupSummary -> ShowS
[RuleGroupSummary] -> ShowS
RuleGroupSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RuleGroupSummary] -> ShowS
$cshowList :: [RuleGroupSummary] -> ShowS
show :: RuleGroupSummary -> String
$cshow :: RuleGroupSummary -> String
showsPrec :: Int -> RuleGroupSummary -> ShowS
$cshowsPrec :: Int -> RuleGroupSummary -> ShowS
Prelude.Show, forall x. Rep RuleGroupSummary x -> RuleGroupSummary
forall x. RuleGroupSummary -> Rep RuleGroupSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RuleGroupSummary x -> RuleGroupSummary
$cfrom :: forall x. RuleGroupSummary -> Rep RuleGroupSummary x
Prelude.Generic)

-- |
-- Create a value of 'RuleGroupSummary' 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:
--
-- 'ruleGroupId', 'ruleGroupSummary_ruleGroupId' - A unique identifier for a @RuleGroup@. You use @RuleGroupId@ to get more
-- information about a @RuleGroup@ (see GetRuleGroup), update a @RuleGroup@
-- (see UpdateRuleGroup), insert a @RuleGroup@ into a @WebACL@ or delete
-- one from a @WebACL@ (see UpdateWebACL), or delete a @RuleGroup@ from AWS
-- WAF (see DeleteRuleGroup).
--
-- @RuleGroupId@ is returned by CreateRuleGroup and by ListRuleGroups.
--
-- 'name', 'ruleGroupSummary_name' - A friendly name or description of the RuleGroup. You can\'t change the
-- name of a @RuleGroup@ after you create it.
newRuleGroupSummary ::
  -- | 'ruleGroupId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  RuleGroupSummary
newRuleGroupSummary :: Text -> Text -> RuleGroupSummary
newRuleGroupSummary Text
pRuleGroupId_ Text
pName_ =
  RuleGroupSummary'
    { $sel:ruleGroupId:RuleGroupSummary' :: Text
ruleGroupId = Text
pRuleGroupId_,
      $sel:name:RuleGroupSummary' :: Text
name = Text
pName_
    }

-- | A unique identifier for a @RuleGroup@. You use @RuleGroupId@ to get more
-- information about a @RuleGroup@ (see GetRuleGroup), update a @RuleGroup@
-- (see UpdateRuleGroup), insert a @RuleGroup@ into a @WebACL@ or delete
-- one from a @WebACL@ (see UpdateWebACL), or delete a @RuleGroup@ from AWS
-- WAF (see DeleteRuleGroup).
--
-- @RuleGroupId@ is returned by CreateRuleGroup and by ListRuleGroups.
ruleGroupSummary_ruleGroupId :: Lens.Lens' RuleGroupSummary Prelude.Text
ruleGroupSummary_ruleGroupId :: Lens' RuleGroupSummary Text
ruleGroupSummary_ruleGroupId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RuleGroupSummary' {Text
ruleGroupId :: Text
$sel:ruleGroupId:RuleGroupSummary' :: RuleGroupSummary -> Text
ruleGroupId} -> Text
ruleGroupId) (\s :: RuleGroupSummary
s@RuleGroupSummary' {} Text
a -> RuleGroupSummary
s {$sel:ruleGroupId:RuleGroupSummary' :: Text
ruleGroupId = Text
a} :: RuleGroupSummary)

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

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

instance Prelude.Hashable RuleGroupSummary where
  hashWithSalt :: Int -> RuleGroupSummary -> Int
hashWithSalt Int
_salt RuleGroupSummary' {Text
name :: Text
ruleGroupId :: Text
$sel:name:RuleGroupSummary' :: RuleGroupSummary -> Text
$sel:ruleGroupId:RuleGroupSummary' :: RuleGroupSummary -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
ruleGroupId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData RuleGroupSummary where
  rnf :: RuleGroupSummary -> ()
rnf RuleGroupSummary' {Text
name :: Text
ruleGroupId :: Text
$sel:name:RuleGroupSummary' :: RuleGroupSummary -> Text
$sel:ruleGroupId:RuleGroupSummary' :: RuleGroupSummary -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
ruleGroupId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name