{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.WAFV2.DescribeManagedRuleGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Provides high-level information for a managed rule group, including
-- descriptions of the rules.
module Amazonka.WAFV2.DescribeManagedRuleGroup
  ( -- * Creating a Request
    DescribeManagedRuleGroup (..),
    newDescribeManagedRuleGroup,

    -- * Request Lenses
    describeManagedRuleGroup_versionName,
    describeManagedRuleGroup_vendorName,
    describeManagedRuleGroup_name,
    describeManagedRuleGroup_scope,

    -- * Destructuring the Response
    DescribeManagedRuleGroupResponse (..),
    newDescribeManagedRuleGroupResponse,

    -- * Response Lenses
    describeManagedRuleGroupResponse_availableLabels,
    describeManagedRuleGroupResponse_capacity,
    describeManagedRuleGroupResponse_consumedLabels,
    describeManagedRuleGroupResponse_labelNamespace,
    describeManagedRuleGroupResponse_rules,
    describeManagedRuleGroupResponse_snsTopicArn,
    describeManagedRuleGroupResponse_versionName,
    describeManagedRuleGroupResponse_httpStatus,
  )
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
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAFV2.Types

-- | /See:/ 'newDescribeManagedRuleGroup' smart constructor.
data DescribeManagedRuleGroup = DescribeManagedRuleGroup'
  { -- | The version of the rule group. You can only use a version that is not
    -- scheduled for expiration. If you don\'t provide this, WAF uses the
    -- vendor\'s default version.
    DescribeManagedRuleGroup -> Maybe Text
versionName :: Prelude.Maybe Prelude.Text,
    -- | The name of the managed rule group vendor. You use this, along with the
    -- rule group name, to identify the rule group.
    DescribeManagedRuleGroup -> Text
vendorName :: Prelude.Text,
    -- | The name of the managed rule group. You use this, along with the vendor
    -- name, to identify the rule group.
    DescribeManagedRuleGroup -> Text
name :: Prelude.Text,
    -- | Specifies whether this is for an Amazon CloudFront distribution or for a
    -- regional application. A regional application can be an Application Load
    -- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API,
    -- or an Amazon Cognito user pool.
    --
    -- To work with CloudFront, you must also specify the Region US East (N.
    -- Virginia) as follows:
    --
    -- -   CLI - Specify the Region when you use the CloudFront scope:
    --     @--scope=CLOUDFRONT --region=us-east-1@.
    --
    -- -   API and SDKs - For all calls, use the Region endpoint us-east-1.
    DescribeManagedRuleGroup -> Scope
scope :: Scope
  }
  deriving (DescribeManagedRuleGroup -> DescribeManagedRuleGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeManagedRuleGroup -> DescribeManagedRuleGroup -> Bool
$c/= :: DescribeManagedRuleGroup -> DescribeManagedRuleGroup -> Bool
== :: DescribeManagedRuleGroup -> DescribeManagedRuleGroup -> Bool
$c== :: DescribeManagedRuleGroup -> DescribeManagedRuleGroup -> Bool
Prelude.Eq, ReadPrec [DescribeManagedRuleGroup]
ReadPrec DescribeManagedRuleGroup
Int -> ReadS DescribeManagedRuleGroup
ReadS [DescribeManagedRuleGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeManagedRuleGroup]
$creadListPrec :: ReadPrec [DescribeManagedRuleGroup]
readPrec :: ReadPrec DescribeManagedRuleGroup
$creadPrec :: ReadPrec DescribeManagedRuleGroup
readList :: ReadS [DescribeManagedRuleGroup]
$creadList :: ReadS [DescribeManagedRuleGroup]
readsPrec :: Int -> ReadS DescribeManagedRuleGroup
$creadsPrec :: Int -> ReadS DescribeManagedRuleGroup
Prelude.Read, Int -> DescribeManagedRuleGroup -> ShowS
[DescribeManagedRuleGroup] -> ShowS
DescribeManagedRuleGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeManagedRuleGroup] -> ShowS
$cshowList :: [DescribeManagedRuleGroup] -> ShowS
show :: DescribeManagedRuleGroup -> String
$cshow :: DescribeManagedRuleGroup -> String
showsPrec :: Int -> DescribeManagedRuleGroup -> ShowS
$cshowsPrec :: Int -> DescribeManagedRuleGroup -> ShowS
Prelude.Show, forall x.
Rep DescribeManagedRuleGroup x -> DescribeManagedRuleGroup
forall x.
DescribeManagedRuleGroup -> Rep DescribeManagedRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeManagedRuleGroup x -> DescribeManagedRuleGroup
$cfrom :: forall x.
DescribeManagedRuleGroup -> Rep DescribeManagedRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'DescribeManagedRuleGroup' 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:
--
-- 'versionName', 'describeManagedRuleGroup_versionName' - The version of the rule group. You can only use a version that is not
-- scheduled for expiration. If you don\'t provide this, WAF uses the
-- vendor\'s default version.
--
-- 'vendorName', 'describeManagedRuleGroup_vendorName' - The name of the managed rule group vendor. You use this, along with the
-- rule group name, to identify the rule group.
--
-- 'name', 'describeManagedRuleGroup_name' - The name of the managed rule group. You use this, along with the vendor
-- name, to identify the rule group.
--
-- 'scope', 'describeManagedRuleGroup_scope' - Specifies whether this is for an Amazon CloudFront distribution or for a
-- regional application. A regional application can be an Application Load
-- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API,
-- or an Amazon Cognito user pool.
--
-- To work with CloudFront, you must also specify the Region US East (N.
-- Virginia) as follows:
--
-- -   CLI - Specify the Region when you use the CloudFront scope:
--     @--scope=CLOUDFRONT --region=us-east-1@.
--
-- -   API and SDKs - For all calls, use the Region endpoint us-east-1.
newDescribeManagedRuleGroup ::
  -- | 'vendorName'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  -- | 'scope'
  Scope ->
  DescribeManagedRuleGroup
newDescribeManagedRuleGroup :: Text -> Text -> Scope -> DescribeManagedRuleGroup
newDescribeManagedRuleGroup
  Text
pVendorName_
  Text
pName_
  Scope
pScope_ =
    DescribeManagedRuleGroup'
      { $sel:versionName:DescribeManagedRuleGroup' :: Maybe Text
versionName =
          forall a. Maybe a
Prelude.Nothing,
        $sel:vendorName:DescribeManagedRuleGroup' :: Text
vendorName = Text
pVendorName_,
        $sel:name:DescribeManagedRuleGroup' :: Text
name = Text
pName_,
        $sel:scope:DescribeManagedRuleGroup' :: Scope
scope = Scope
pScope_
      }

-- | The version of the rule group. You can only use a version that is not
-- scheduled for expiration. If you don\'t provide this, WAF uses the
-- vendor\'s default version.
describeManagedRuleGroup_versionName :: Lens.Lens' DescribeManagedRuleGroup (Prelude.Maybe Prelude.Text)
describeManagedRuleGroup_versionName :: Lens' DescribeManagedRuleGroup (Maybe Text)
describeManagedRuleGroup_versionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroup' {Maybe Text
versionName :: Maybe Text
$sel:versionName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Maybe Text
versionName} -> Maybe Text
versionName) (\s :: DescribeManagedRuleGroup
s@DescribeManagedRuleGroup' {} Maybe Text
a -> DescribeManagedRuleGroup
s {$sel:versionName:DescribeManagedRuleGroup' :: Maybe Text
versionName = Maybe Text
a} :: DescribeManagedRuleGroup)

-- | The name of the managed rule group vendor. You use this, along with the
-- rule group name, to identify the rule group.
describeManagedRuleGroup_vendorName :: Lens.Lens' DescribeManagedRuleGroup Prelude.Text
describeManagedRuleGroup_vendorName :: Lens' DescribeManagedRuleGroup Text
describeManagedRuleGroup_vendorName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroup' {Text
vendorName :: Text
$sel:vendorName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
vendorName} -> Text
vendorName) (\s :: DescribeManagedRuleGroup
s@DescribeManagedRuleGroup' {} Text
a -> DescribeManagedRuleGroup
s {$sel:vendorName:DescribeManagedRuleGroup' :: Text
vendorName = Text
a} :: DescribeManagedRuleGroup)

-- | The name of the managed rule group. You use this, along with the vendor
-- name, to identify the rule group.
describeManagedRuleGroup_name :: Lens.Lens' DescribeManagedRuleGroup Prelude.Text
describeManagedRuleGroup_name :: Lens' DescribeManagedRuleGroup Text
describeManagedRuleGroup_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroup' {Text
name :: Text
$sel:name:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
name} -> Text
name) (\s :: DescribeManagedRuleGroup
s@DescribeManagedRuleGroup' {} Text
a -> DescribeManagedRuleGroup
s {$sel:name:DescribeManagedRuleGroup' :: Text
name = Text
a} :: DescribeManagedRuleGroup)

-- | Specifies whether this is for an Amazon CloudFront distribution or for a
-- regional application. A regional application can be an Application Load
-- Balancer (ALB), an Amazon API Gateway REST API, an AppSync GraphQL API,
-- or an Amazon Cognito user pool.
--
-- To work with CloudFront, you must also specify the Region US East (N.
-- Virginia) as follows:
--
-- -   CLI - Specify the Region when you use the CloudFront scope:
--     @--scope=CLOUDFRONT --region=us-east-1@.
--
-- -   API and SDKs - For all calls, use the Region endpoint us-east-1.
describeManagedRuleGroup_scope :: Lens.Lens' DescribeManagedRuleGroup Scope
describeManagedRuleGroup_scope :: Lens' DescribeManagedRuleGroup Scope
describeManagedRuleGroup_scope = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroup' {Scope
scope :: Scope
$sel:scope:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Scope
scope} -> Scope
scope) (\s :: DescribeManagedRuleGroup
s@DescribeManagedRuleGroup' {} Scope
a -> DescribeManagedRuleGroup
s {$sel:scope:DescribeManagedRuleGroup' :: Scope
scope = Scope
a} :: DescribeManagedRuleGroup)

instance Core.AWSRequest DescribeManagedRuleGroup where
  type
    AWSResponse DescribeManagedRuleGroup =
      DescribeManagedRuleGroupResponse
  request :: (Service -> Service)
-> DescribeManagedRuleGroup -> Request DescribeManagedRuleGroup
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeManagedRuleGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeManagedRuleGroup)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [LabelSummary]
-> Maybe Natural
-> Maybe [LabelSummary]
-> Maybe Text
-> Maybe [RuleSummary]
-> Maybe Text
-> Maybe Text
-> Int
-> DescribeManagedRuleGroupResponse
DescribeManagedRuleGroupResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"AvailableLabels"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ 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 -> Either String (Maybe a)
Data..?> Key
"Capacity")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ConsumedLabels" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ 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 -> Either String (Maybe a)
Data..?> Key
"LabelNamespace")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Rules" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ 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 -> Either String (Maybe a)
Data..?> Key
"SnsTopicArn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"VersionName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DescribeManagedRuleGroup where
  hashWithSalt :: Int -> DescribeManagedRuleGroup -> Int
hashWithSalt Int
_salt DescribeManagedRuleGroup' {Maybe Text
Text
Scope
scope :: Scope
name :: Text
vendorName :: Text
versionName :: Maybe Text
$sel:scope:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Scope
$sel:name:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
$sel:vendorName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
$sel:versionName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
versionName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vendorName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Scope
scope

instance Prelude.NFData DescribeManagedRuleGroup where
  rnf :: DescribeManagedRuleGroup -> ()
rnf DescribeManagedRuleGroup' {Maybe Text
Text
Scope
scope :: Scope
name :: Text
vendorName :: Text
versionName :: Maybe Text
$sel:scope:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Scope
$sel:name:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
$sel:vendorName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
$sel:versionName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
vendorName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Scope
scope

instance Data.ToHeaders DescribeManagedRuleGroup where
  toHeaders :: DescribeManagedRuleGroup -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSWAF_20190729.DescribeManagedRuleGroup" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON DescribeManagedRuleGroup where
  toJSON :: DescribeManagedRuleGroup -> Value
toJSON DescribeManagedRuleGroup' {Maybe Text
Text
Scope
scope :: Scope
name :: Text
vendorName :: Text
versionName :: Maybe Text
$sel:scope:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Scope
$sel:name:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
$sel:vendorName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Text
$sel:versionName:DescribeManagedRuleGroup' :: DescribeManagedRuleGroup -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"VersionName" 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
versionName,
            forall a. a -> Maybe a
Prelude.Just (Key
"VendorName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
vendorName),
            forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name),
            forall a. a -> Maybe a
Prelude.Just (Key
"Scope" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Scope
scope)
          ]
      )

instance Data.ToPath DescribeManagedRuleGroup where
  toPath :: DescribeManagedRuleGroup -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery DescribeManagedRuleGroup where
  toQuery :: DescribeManagedRuleGroup -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newDescribeManagedRuleGroupResponse' smart constructor.
data DescribeManagedRuleGroupResponse = DescribeManagedRuleGroupResponse'
  { -- | The labels that one or more rules in this rule group add to matching web
    -- requests. These labels are defined in the @RuleLabels@ for a Rule.
    DescribeManagedRuleGroupResponse -> Maybe [LabelSummary]
availableLabels :: Prelude.Maybe [LabelSummary],
    -- | The web ACL capacity units (WCUs) required for this rule group. WAF uses
    -- web ACL capacity units (WCU) to calculate and control the operating
    -- resources that are used to run your rules, rule groups, and web ACLs.
    -- WAF calculates capacity differently for each rule type, to reflect each
    -- rule\'s relative cost. Rule group capacity is fixed at creation, so
    -- users can plan their web ACL WCU usage when they use a rule group. The
    -- WCU limit for web ACLs is 1,500.
    DescribeManagedRuleGroupResponse -> Maybe Natural
capacity :: Prelude.Maybe Prelude.Natural,
    -- | The labels that one or more rules in this rule group match against in
    -- label match statements. These labels are defined in a
    -- @LabelMatchStatement@ specification, in the Statement definition of a
    -- rule.
    DescribeManagedRuleGroupResponse -> Maybe [LabelSummary]
consumedLabels :: Prelude.Maybe [LabelSummary],
    -- | The label namespace prefix for this rule group. All labels added by
    -- rules in this rule group have this prefix.
    --
    -- -   The syntax for the label namespace prefix for a managed rule group
    --     is the following:
    --
    --     @awswaf:managed:\<vendor>:\<rule group name>@:
    --
    -- -   When a rule with a label matches a web request, WAF adds the fully
    --     qualified label to the request. A fully qualified label is made up
    --     of the label namespace from the rule group or web ACL where the rule
    --     is defined and the label from the rule, separated by a colon:
    --
    --     @\<label namespace>:\<label from rule>@
    DescribeManagedRuleGroupResponse -> Maybe Text
labelNamespace :: Prelude.Maybe Prelude.Text,
    DescribeManagedRuleGroupResponse -> Maybe [RuleSummary]
rules :: Prelude.Maybe [RuleSummary],
    -- | The Amazon resource name (ARN) of the Amazon Simple Notification Service
    -- SNS topic that\'s used to record changes to the managed rule group. You
    -- can subscribe to the SNS topic to receive notifications when the managed
    -- rule group is modified, such as for new versions and for version
    -- expiration. For more information, see the
    -- <https://docs.aws.amazon.com/sns/latest/dg/welcome.html Amazon Simple Notification Service Developer Guide>.
    DescribeManagedRuleGroupResponse -> Maybe Text
snsTopicArn :: Prelude.Maybe Prelude.Text,
    -- | The managed rule group\'s version.
    DescribeManagedRuleGroupResponse -> Maybe Text
versionName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribeManagedRuleGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeManagedRuleGroupResponse
-> DescribeManagedRuleGroupResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeManagedRuleGroupResponse
-> DescribeManagedRuleGroupResponse -> Bool
$c/= :: DescribeManagedRuleGroupResponse
-> DescribeManagedRuleGroupResponse -> Bool
== :: DescribeManagedRuleGroupResponse
-> DescribeManagedRuleGroupResponse -> Bool
$c== :: DescribeManagedRuleGroupResponse
-> DescribeManagedRuleGroupResponse -> Bool
Prelude.Eq, ReadPrec [DescribeManagedRuleGroupResponse]
ReadPrec DescribeManagedRuleGroupResponse
Int -> ReadS DescribeManagedRuleGroupResponse
ReadS [DescribeManagedRuleGroupResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeManagedRuleGroupResponse]
$creadListPrec :: ReadPrec [DescribeManagedRuleGroupResponse]
readPrec :: ReadPrec DescribeManagedRuleGroupResponse
$creadPrec :: ReadPrec DescribeManagedRuleGroupResponse
readList :: ReadS [DescribeManagedRuleGroupResponse]
$creadList :: ReadS [DescribeManagedRuleGroupResponse]
readsPrec :: Int -> ReadS DescribeManagedRuleGroupResponse
$creadsPrec :: Int -> ReadS DescribeManagedRuleGroupResponse
Prelude.Read, Int -> DescribeManagedRuleGroupResponse -> ShowS
[DescribeManagedRuleGroupResponse] -> ShowS
DescribeManagedRuleGroupResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeManagedRuleGroupResponse] -> ShowS
$cshowList :: [DescribeManagedRuleGroupResponse] -> ShowS
show :: DescribeManagedRuleGroupResponse -> String
$cshow :: DescribeManagedRuleGroupResponse -> String
showsPrec :: Int -> DescribeManagedRuleGroupResponse -> ShowS
$cshowsPrec :: Int -> DescribeManagedRuleGroupResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeManagedRuleGroupResponse x
-> DescribeManagedRuleGroupResponse
forall x.
DescribeManagedRuleGroupResponse
-> Rep DescribeManagedRuleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeManagedRuleGroupResponse x
-> DescribeManagedRuleGroupResponse
$cfrom :: forall x.
DescribeManagedRuleGroupResponse
-> Rep DescribeManagedRuleGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeManagedRuleGroupResponse' 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:
--
-- 'availableLabels', 'describeManagedRuleGroupResponse_availableLabels' - The labels that one or more rules in this rule group add to matching web
-- requests. These labels are defined in the @RuleLabels@ for a Rule.
--
-- 'capacity', 'describeManagedRuleGroupResponse_capacity' - The web ACL capacity units (WCUs) required for this rule group. WAF uses
-- web ACL capacity units (WCU) to calculate and control the operating
-- resources that are used to run your rules, rule groups, and web ACLs.
-- WAF calculates capacity differently for each rule type, to reflect each
-- rule\'s relative cost. Rule group capacity is fixed at creation, so
-- users can plan their web ACL WCU usage when they use a rule group. The
-- WCU limit for web ACLs is 1,500.
--
-- 'consumedLabels', 'describeManagedRuleGroupResponse_consumedLabels' - The labels that one or more rules in this rule group match against in
-- label match statements. These labels are defined in a
-- @LabelMatchStatement@ specification, in the Statement definition of a
-- rule.
--
-- 'labelNamespace', 'describeManagedRuleGroupResponse_labelNamespace' - The label namespace prefix for this rule group. All labels added by
-- rules in this rule group have this prefix.
--
-- -   The syntax for the label namespace prefix for a managed rule group
--     is the following:
--
--     @awswaf:managed:\<vendor>:\<rule group name>@:
--
-- -   When a rule with a label matches a web request, WAF adds the fully
--     qualified label to the request. A fully qualified label is made up
--     of the label namespace from the rule group or web ACL where the rule
--     is defined and the label from the rule, separated by a colon:
--
--     @\<label namespace>:\<label from rule>@
--
-- 'rules', 'describeManagedRuleGroupResponse_rules' -
--
-- 'snsTopicArn', 'describeManagedRuleGroupResponse_snsTopicArn' - The Amazon resource name (ARN) of the Amazon Simple Notification Service
-- SNS topic that\'s used to record changes to the managed rule group. You
-- can subscribe to the SNS topic to receive notifications when the managed
-- rule group is modified, such as for new versions and for version
-- expiration. For more information, see the
-- <https://docs.aws.amazon.com/sns/latest/dg/welcome.html Amazon Simple Notification Service Developer Guide>.
--
-- 'versionName', 'describeManagedRuleGroupResponse_versionName' - The managed rule group\'s version.
--
-- 'httpStatus', 'describeManagedRuleGroupResponse_httpStatus' - The response's http status code.
newDescribeManagedRuleGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeManagedRuleGroupResponse
newDescribeManagedRuleGroupResponse :: Int -> DescribeManagedRuleGroupResponse
newDescribeManagedRuleGroupResponse Int
pHttpStatus_ =
  DescribeManagedRuleGroupResponse'
    { $sel:availableLabels:DescribeManagedRuleGroupResponse' :: Maybe [LabelSummary]
availableLabels =
        forall a. Maybe a
Prelude.Nothing,
      $sel:capacity:DescribeManagedRuleGroupResponse' :: Maybe Natural
capacity = forall a. Maybe a
Prelude.Nothing,
      $sel:consumedLabels:DescribeManagedRuleGroupResponse' :: Maybe [LabelSummary]
consumedLabels = forall a. Maybe a
Prelude.Nothing,
      $sel:labelNamespace:DescribeManagedRuleGroupResponse' :: Maybe Text
labelNamespace = forall a. Maybe a
Prelude.Nothing,
      $sel:rules:DescribeManagedRuleGroupResponse' :: Maybe [RuleSummary]
rules = forall a. Maybe a
Prelude.Nothing,
      $sel:snsTopicArn:DescribeManagedRuleGroupResponse' :: Maybe Text
snsTopicArn = forall a. Maybe a
Prelude.Nothing,
      $sel:versionName:DescribeManagedRuleGroupResponse' :: Maybe Text
versionName = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeManagedRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The labels that one or more rules in this rule group add to matching web
-- requests. These labels are defined in the @RuleLabels@ for a Rule.
describeManagedRuleGroupResponse_availableLabels :: Lens.Lens' DescribeManagedRuleGroupResponse (Prelude.Maybe [LabelSummary])
describeManagedRuleGroupResponse_availableLabels :: Lens' DescribeManagedRuleGroupResponse (Maybe [LabelSummary])
describeManagedRuleGroupResponse_availableLabels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Maybe [LabelSummary]
availableLabels :: Maybe [LabelSummary]
$sel:availableLabels:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe [LabelSummary]
availableLabels} -> Maybe [LabelSummary]
availableLabels) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Maybe [LabelSummary]
a -> DescribeManagedRuleGroupResponse
s {$sel:availableLabels:DescribeManagedRuleGroupResponse' :: Maybe [LabelSummary]
availableLabels = Maybe [LabelSummary]
a} :: DescribeManagedRuleGroupResponse) 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

-- | The web ACL capacity units (WCUs) required for this rule group. WAF uses
-- web ACL capacity units (WCU) to calculate and control the operating
-- resources that are used to run your rules, rule groups, and web ACLs.
-- WAF calculates capacity differently for each rule type, to reflect each
-- rule\'s relative cost. Rule group capacity is fixed at creation, so
-- users can plan their web ACL WCU usage when they use a rule group. The
-- WCU limit for web ACLs is 1,500.
describeManagedRuleGroupResponse_capacity :: Lens.Lens' DescribeManagedRuleGroupResponse (Prelude.Maybe Prelude.Natural)
describeManagedRuleGroupResponse_capacity :: Lens' DescribeManagedRuleGroupResponse (Maybe Natural)
describeManagedRuleGroupResponse_capacity = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Maybe Natural
capacity :: Maybe Natural
$sel:capacity:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Natural
capacity} -> Maybe Natural
capacity) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Maybe Natural
a -> DescribeManagedRuleGroupResponse
s {$sel:capacity:DescribeManagedRuleGroupResponse' :: Maybe Natural
capacity = Maybe Natural
a} :: DescribeManagedRuleGroupResponse)

-- | The labels that one or more rules in this rule group match against in
-- label match statements. These labels are defined in a
-- @LabelMatchStatement@ specification, in the Statement definition of a
-- rule.
describeManagedRuleGroupResponse_consumedLabels :: Lens.Lens' DescribeManagedRuleGroupResponse (Prelude.Maybe [LabelSummary])
describeManagedRuleGroupResponse_consumedLabels :: Lens' DescribeManagedRuleGroupResponse (Maybe [LabelSummary])
describeManagedRuleGroupResponse_consumedLabels = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Maybe [LabelSummary]
consumedLabels :: Maybe [LabelSummary]
$sel:consumedLabels:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe [LabelSummary]
consumedLabels} -> Maybe [LabelSummary]
consumedLabels) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Maybe [LabelSummary]
a -> DescribeManagedRuleGroupResponse
s {$sel:consumedLabels:DescribeManagedRuleGroupResponse' :: Maybe [LabelSummary]
consumedLabels = Maybe [LabelSummary]
a} :: DescribeManagedRuleGroupResponse) 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

-- | The label namespace prefix for this rule group. All labels added by
-- rules in this rule group have this prefix.
--
-- -   The syntax for the label namespace prefix for a managed rule group
--     is the following:
--
--     @awswaf:managed:\<vendor>:\<rule group name>@:
--
-- -   When a rule with a label matches a web request, WAF adds the fully
--     qualified label to the request. A fully qualified label is made up
--     of the label namespace from the rule group or web ACL where the rule
--     is defined and the label from the rule, separated by a colon:
--
--     @\<label namespace>:\<label from rule>@
describeManagedRuleGroupResponse_labelNamespace :: Lens.Lens' DescribeManagedRuleGroupResponse (Prelude.Maybe Prelude.Text)
describeManagedRuleGroupResponse_labelNamespace :: Lens' DescribeManagedRuleGroupResponse (Maybe Text)
describeManagedRuleGroupResponse_labelNamespace = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Maybe Text
labelNamespace :: Maybe Text
$sel:labelNamespace:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Text
labelNamespace} -> Maybe Text
labelNamespace) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Maybe Text
a -> DescribeManagedRuleGroupResponse
s {$sel:labelNamespace:DescribeManagedRuleGroupResponse' :: Maybe Text
labelNamespace = Maybe Text
a} :: DescribeManagedRuleGroupResponse)

describeManagedRuleGroupResponse_rules :: Lens.Lens' DescribeManagedRuleGroupResponse (Prelude.Maybe [RuleSummary])
describeManagedRuleGroupResponse_rules :: Lens' DescribeManagedRuleGroupResponse (Maybe [RuleSummary])
describeManagedRuleGroupResponse_rules = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Maybe [RuleSummary]
rules :: Maybe [RuleSummary]
$sel:rules:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe [RuleSummary]
rules} -> Maybe [RuleSummary]
rules) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Maybe [RuleSummary]
a -> DescribeManagedRuleGroupResponse
s {$sel:rules:DescribeManagedRuleGroupResponse' :: Maybe [RuleSummary]
rules = Maybe [RuleSummary]
a} :: DescribeManagedRuleGroupResponse) 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

-- | The Amazon resource name (ARN) of the Amazon Simple Notification Service
-- SNS topic that\'s used to record changes to the managed rule group. You
-- can subscribe to the SNS topic to receive notifications when the managed
-- rule group is modified, such as for new versions and for version
-- expiration. For more information, see the
-- <https://docs.aws.amazon.com/sns/latest/dg/welcome.html Amazon Simple Notification Service Developer Guide>.
describeManagedRuleGroupResponse_snsTopicArn :: Lens.Lens' DescribeManagedRuleGroupResponse (Prelude.Maybe Prelude.Text)
describeManagedRuleGroupResponse_snsTopicArn :: Lens' DescribeManagedRuleGroupResponse (Maybe Text)
describeManagedRuleGroupResponse_snsTopicArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Maybe Text
snsTopicArn :: Maybe Text
$sel:snsTopicArn:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Text
snsTopicArn} -> Maybe Text
snsTopicArn) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Maybe Text
a -> DescribeManagedRuleGroupResponse
s {$sel:snsTopicArn:DescribeManagedRuleGroupResponse' :: Maybe Text
snsTopicArn = Maybe Text
a} :: DescribeManagedRuleGroupResponse)

-- | The managed rule group\'s version.
describeManagedRuleGroupResponse_versionName :: Lens.Lens' DescribeManagedRuleGroupResponse (Prelude.Maybe Prelude.Text)
describeManagedRuleGroupResponse_versionName :: Lens' DescribeManagedRuleGroupResponse (Maybe Text)
describeManagedRuleGroupResponse_versionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Maybe Text
versionName :: Maybe Text
$sel:versionName:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Text
versionName} -> Maybe Text
versionName) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Maybe Text
a -> DescribeManagedRuleGroupResponse
s {$sel:versionName:DescribeManagedRuleGroupResponse' :: Maybe Text
versionName = Maybe Text
a} :: DescribeManagedRuleGroupResponse)

-- | The response's http status code.
describeManagedRuleGroupResponse_httpStatus :: Lens.Lens' DescribeManagedRuleGroupResponse Prelude.Int
describeManagedRuleGroupResponse_httpStatus :: Lens' DescribeManagedRuleGroupResponse Int
describeManagedRuleGroupResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeManagedRuleGroupResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeManagedRuleGroupResponse
s@DescribeManagedRuleGroupResponse' {} Int
a -> DescribeManagedRuleGroupResponse
s {$sel:httpStatus:DescribeManagedRuleGroupResponse' :: Int
httpStatus = Int
a} :: DescribeManagedRuleGroupResponse)

instance
  Prelude.NFData
    DescribeManagedRuleGroupResponse
  where
  rnf :: DescribeManagedRuleGroupResponse -> ()
rnf DescribeManagedRuleGroupResponse' {Int
Maybe Natural
Maybe [LabelSummary]
Maybe [RuleSummary]
Maybe Text
httpStatus :: Int
versionName :: Maybe Text
snsTopicArn :: Maybe Text
rules :: Maybe [RuleSummary]
labelNamespace :: Maybe Text
consumedLabels :: Maybe [LabelSummary]
capacity :: Maybe Natural
availableLabels :: Maybe [LabelSummary]
$sel:httpStatus:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Int
$sel:versionName:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Text
$sel:snsTopicArn:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Text
$sel:rules:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe [RuleSummary]
$sel:labelNamespace:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Text
$sel:consumedLabels:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe [LabelSummary]
$sel:capacity:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe Natural
$sel:availableLabels:DescribeManagedRuleGroupResponse' :: DescribeManagedRuleGroupResponse -> Maybe [LabelSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [LabelSummary]
availableLabels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
capacity
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [LabelSummary]
consumedLabels
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
labelNamespace
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [RuleSummary]
rules
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
snsTopicArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
versionName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus