{-# 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.SubscribedRuleGroupSummary
-- 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.SubscribedRuleGroupSummary 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.
--
-- A summary of the rule groups you are subscribed to.
--
-- /See:/ 'newSubscribedRuleGroupSummary' smart constructor.
data SubscribedRuleGroupSummary = SubscribedRuleGroupSummary'
  { -- | A unique identifier for a @RuleGroup@.
    SubscribedRuleGroupSummary -> 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.
    SubscribedRuleGroupSummary -> Text
name :: Prelude.Text,
    -- | A friendly name or description for the metrics for this @RuleGroup@. The
    -- name can contain only alphanumeric characters (A-Z, a-z, 0-9), with
    -- maximum length 128 and minimum length one. It can\'t contain whitespace
    -- or metric names reserved for AWS WAF, including \"All\" and
    -- \"Default_Action.\" You can\'t change the name of the metric after you
    -- create the @RuleGroup@.
    SubscribedRuleGroupSummary -> Text
metricName :: Prelude.Text
  }
  deriving (SubscribedRuleGroupSummary -> SubscribedRuleGroupSummary -> Bool
(SubscribedRuleGroupSummary -> SubscribedRuleGroupSummary -> Bool)
-> (SubscribedRuleGroupSummary
    -> SubscribedRuleGroupSummary -> Bool)
-> Eq SubscribedRuleGroupSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SubscribedRuleGroupSummary -> SubscribedRuleGroupSummary -> Bool
$c/= :: SubscribedRuleGroupSummary -> SubscribedRuleGroupSummary -> Bool
== :: SubscribedRuleGroupSummary -> SubscribedRuleGroupSummary -> Bool
$c== :: SubscribedRuleGroupSummary -> SubscribedRuleGroupSummary -> Bool
Prelude.Eq, ReadPrec [SubscribedRuleGroupSummary]
ReadPrec SubscribedRuleGroupSummary
Int -> ReadS SubscribedRuleGroupSummary
ReadS [SubscribedRuleGroupSummary]
(Int -> ReadS SubscribedRuleGroupSummary)
-> ReadS [SubscribedRuleGroupSummary]
-> ReadPrec SubscribedRuleGroupSummary
-> ReadPrec [SubscribedRuleGroupSummary]
-> Read SubscribedRuleGroupSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SubscribedRuleGroupSummary]
$creadListPrec :: ReadPrec [SubscribedRuleGroupSummary]
readPrec :: ReadPrec SubscribedRuleGroupSummary
$creadPrec :: ReadPrec SubscribedRuleGroupSummary
readList :: ReadS [SubscribedRuleGroupSummary]
$creadList :: ReadS [SubscribedRuleGroupSummary]
readsPrec :: Int -> ReadS SubscribedRuleGroupSummary
$creadsPrec :: Int -> ReadS SubscribedRuleGroupSummary
Prelude.Read, Int -> SubscribedRuleGroupSummary -> ShowS
[SubscribedRuleGroupSummary] -> ShowS
SubscribedRuleGroupSummary -> String
(Int -> SubscribedRuleGroupSummary -> ShowS)
-> (SubscribedRuleGroupSummary -> String)
-> ([SubscribedRuleGroupSummary] -> ShowS)
-> Show SubscribedRuleGroupSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SubscribedRuleGroupSummary] -> ShowS
$cshowList :: [SubscribedRuleGroupSummary] -> ShowS
show :: SubscribedRuleGroupSummary -> String
$cshow :: SubscribedRuleGroupSummary -> String
showsPrec :: Int -> SubscribedRuleGroupSummary -> ShowS
$cshowsPrec :: Int -> SubscribedRuleGroupSummary -> ShowS
Prelude.Show, (forall x.
 SubscribedRuleGroupSummary -> Rep SubscribedRuleGroupSummary x)
-> (forall x.
    Rep SubscribedRuleGroupSummary x -> SubscribedRuleGroupSummary)
-> Generic SubscribedRuleGroupSummary
forall x.
Rep SubscribedRuleGroupSummary x -> SubscribedRuleGroupSummary
forall x.
SubscribedRuleGroupSummary -> Rep SubscribedRuleGroupSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SubscribedRuleGroupSummary x -> SubscribedRuleGroupSummary
$cfrom :: forall x.
SubscribedRuleGroupSummary -> Rep SubscribedRuleGroupSummary x
Prelude.Generic)

-- |
-- Create a value of 'SubscribedRuleGroupSummary' 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', 'subscribedRuleGroupSummary_ruleGroupId' - A unique identifier for a @RuleGroup@.
--
-- 'name', 'subscribedRuleGroupSummary_name' - A friendly name or description of the @RuleGroup@. You can\'t change the
-- name of a @RuleGroup@ after you create it.
--
-- 'metricName', 'subscribedRuleGroupSummary_metricName' - A friendly name or description for the metrics for this @RuleGroup@. The
-- name can contain only alphanumeric characters (A-Z, a-z, 0-9), with
-- maximum length 128 and minimum length one. It can\'t contain whitespace
-- or metric names reserved for AWS WAF, including \"All\" and
-- \"Default_Action.\" You can\'t change the name of the metric after you
-- create the @RuleGroup@.
newSubscribedRuleGroupSummary ::
  -- | 'ruleGroupId'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'metricName'
  Prelude.Text ->
  SubscribedRuleGroupSummary
newSubscribedRuleGroupSummary :: Text -> Text -> Text -> SubscribedRuleGroupSummary
newSubscribedRuleGroupSummary
  Text
pRuleGroupId_
  Text
pName_
  Text
pMetricName_ =
    SubscribedRuleGroupSummary' :: Text -> Text -> Text -> SubscribedRuleGroupSummary
SubscribedRuleGroupSummary'
      { $sel:ruleGroupId:SubscribedRuleGroupSummary' :: Text
ruleGroupId =
          Text
pRuleGroupId_,
        $sel:name:SubscribedRuleGroupSummary' :: Text
name = Text
pName_,
        $sel:metricName:SubscribedRuleGroupSummary' :: Text
metricName = Text
pMetricName_
      }

-- | A unique identifier for a @RuleGroup@.
subscribedRuleGroupSummary_ruleGroupId :: Lens.Lens' SubscribedRuleGroupSummary Prelude.Text
subscribedRuleGroupSummary_ruleGroupId :: (Text -> f Text)
-> SubscribedRuleGroupSummary -> f SubscribedRuleGroupSummary
subscribedRuleGroupSummary_ruleGroupId = (SubscribedRuleGroupSummary -> Text)
-> (SubscribedRuleGroupSummary
    -> Text -> SubscribedRuleGroupSummary)
-> Lens
     SubscribedRuleGroupSummary SubscribedRuleGroupSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribedRuleGroupSummary' {Text
ruleGroupId :: Text
$sel:ruleGroupId:SubscribedRuleGroupSummary' :: SubscribedRuleGroupSummary -> Text
ruleGroupId} -> Text
ruleGroupId) (\s :: SubscribedRuleGroupSummary
s@SubscribedRuleGroupSummary' {} Text
a -> SubscribedRuleGroupSummary
s {$sel:ruleGroupId:SubscribedRuleGroupSummary' :: Text
ruleGroupId = Text
a} :: SubscribedRuleGroupSummary)

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

-- | A friendly name or description for the metrics for this @RuleGroup@. The
-- name can contain only alphanumeric characters (A-Z, a-z, 0-9), with
-- maximum length 128 and minimum length one. It can\'t contain whitespace
-- or metric names reserved for AWS WAF, including \"All\" and
-- \"Default_Action.\" You can\'t change the name of the metric after you
-- create the @RuleGroup@.
subscribedRuleGroupSummary_metricName :: Lens.Lens' SubscribedRuleGroupSummary Prelude.Text
subscribedRuleGroupSummary_metricName :: (Text -> f Text)
-> SubscribedRuleGroupSummary -> f SubscribedRuleGroupSummary
subscribedRuleGroupSummary_metricName = (SubscribedRuleGroupSummary -> Text)
-> (SubscribedRuleGroupSummary
    -> Text -> SubscribedRuleGroupSummary)
-> Lens
     SubscribedRuleGroupSummary SubscribedRuleGroupSummary Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SubscribedRuleGroupSummary' {Text
metricName :: Text
$sel:metricName:SubscribedRuleGroupSummary' :: SubscribedRuleGroupSummary -> Text
metricName} -> Text
metricName) (\s :: SubscribedRuleGroupSummary
s@SubscribedRuleGroupSummary' {} Text
a -> SubscribedRuleGroupSummary
s {$sel:metricName:SubscribedRuleGroupSummary' :: Text
metricName = Text
a} :: SubscribedRuleGroupSummary)

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

instance Prelude.Hashable SubscribedRuleGroupSummary

instance Prelude.NFData SubscribedRuleGroupSummary