{-# 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.WAF.ListActivatedRulesInRuleGroup
-- 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)
--
-- 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.
--
-- Returns an array of ActivatedRule objects.
--
-- This operation returns paginated results.
module Amazonka.WAF.ListActivatedRulesInRuleGroup
  ( -- * Creating a Request
    ListActivatedRulesInRuleGroup (..),
    newListActivatedRulesInRuleGroup,

    -- * Request Lenses
    listActivatedRulesInRuleGroup_ruleGroupId,
    listActivatedRulesInRuleGroup_nextMarker,
    listActivatedRulesInRuleGroup_limit,

    -- * Destructuring the Response
    ListActivatedRulesInRuleGroupResponse (..),
    newListActivatedRulesInRuleGroupResponse,

    -- * Response Lenses
    listActivatedRulesInRuleGroupResponse_nextMarker,
    listActivatedRulesInRuleGroupResponse_activatedRules,
    listActivatedRulesInRuleGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.WAF.Types

-- | /See:/ 'newListActivatedRulesInRuleGroup' smart constructor.
data ListActivatedRulesInRuleGroup = ListActivatedRulesInRuleGroup'
  { -- | The @RuleGroupId@ of the RuleGroup for which you want to get a list of
    -- ActivatedRule objects.
    ListActivatedRulesInRuleGroup -> Maybe Text
ruleGroupId :: Prelude.Maybe Prelude.Text,
    -- | If you specify a value for @Limit@ and you have more @ActivatedRules@
    -- than the value of @Limit@, AWS WAF returns a @NextMarker@ value in the
    -- response that allows you to list another group of @ActivatedRules@. For
    -- the second and subsequent @ListActivatedRulesInRuleGroup@ requests,
    -- specify the value of @NextMarker@ from the previous response to get
    -- information about another batch of @ActivatedRules@.
    ListActivatedRulesInRuleGroup -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | Specifies the number of @ActivatedRules@ that you want AWS WAF to return
    -- for this request. If you have more @ActivatedRules@ than the number that
    -- you specify for @Limit@, the response includes a @NextMarker@ value that
    -- you can use to get another batch of @ActivatedRules@.
    ListActivatedRulesInRuleGroup -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListActivatedRulesInRuleGroup
-> ListActivatedRulesInRuleGroup -> Bool
(ListActivatedRulesInRuleGroup
 -> ListActivatedRulesInRuleGroup -> Bool)
-> (ListActivatedRulesInRuleGroup
    -> ListActivatedRulesInRuleGroup -> Bool)
-> Eq ListActivatedRulesInRuleGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListActivatedRulesInRuleGroup
-> ListActivatedRulesInRuleGroup -> Bool
$c/= :: ListActivatedRulesInRuleGroup
-> ListActivatedRulesInRuleGroup -> Bool
== :: ListActivatedRulesInRuleGroup
-> ListActivatedRulesInRuleGroup -> Bool
$c== :: ListActivatedRulesInRuleGroup
-> ListActivatedRulesInRuleGroup -> Bool
Prelude.Eq, ReadPrec [ListActivatedRulesInRuleGroup]
ReadPrec ListActivatedRulesInRuleGroup
Int -> ReadS ListActivatedRulesInRuleGroup
ReadS [ListActivatedRulesInRuleGroup]
(Int -> ReadS ListActivatedRulesInRuleGroup)
-> ReadS [ListActivatedRulesInRuleGroup]
-> ReadPrec ListActivatedRulesInRuleGroup
-> ReadPrec [ListActivatedRulesInRuleGroup]
-> Read ListActivatedRulesInRuleGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListActivatedRulesInRuleGroup]
$creadListPrec :: ReadPrec [ListActivatedRulesInRuleGroup]
readPrec :: ReadPrec ListActivatedRulesInRuleGroup
$creadPrec :: ReadPrec ListActivatedRulesInRuleGroup
readList :: ReadS [ListActivatedRulesInRuleGroup]
$creadList :: ReadS [ListActivatedRulesInRuleGroup]
readsPrec :: Int -> ReadS ListActivatedRulesInRuleGroup
$creadsPrec :: Int -> ReadS ListActivatedRulesInRuleGroup
Prelude.Read, Int -> ListActivatedRulesInRuleGroup -> ShowS
[ListActivatedRulesInRuleGroup] -> ShowS
ListActivatedRulesInRuleGroup -> String
(Int -> ListActivatedRulesInRuleGroup -> ShowS)
-> (ListActivatedRulesInRuleGroup -> String)
-> ([ListActivatedRulesInRuleGroup] -> ShowS)
-> Show ListActivatedRulesInRuleGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListActivatedRulesInRuleGroup] -> ShowS
$cshowList :: [ListActivatedRulesInRuleGroup] -> ShowS
show :: ListActivatedRulesInRuleGroup -> String
$cshow :: ListActivatedRulesInRuleGroup -> String
showsPrec :: Int -> ListActivatedRulesInRuleGroup -> ShowS
$cshowsPrec :: Int -> ListActivatedRulesInRuleGroup -> ShowS
Prelude.Show, (forall x.
 ListActivatedRulesInRuleGroup
 -> Rep ListActivatedRulesInRuleGroup x)
-> (forall x.
    Rep ListActivatedRulesInRuleGroup x
    -> ListActivatedRulesInRuleGroup)
-> Generic ListActivatedRulesInRuleGroup
forall x.
Rep ListActivatedRulesInRuleGroup x
-> ListActivatedRulesInRuleGroup
forall x.
ListActivatedRulesInRuleGroup
-> Rep ListActivatedRulesInRuleGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListActivatedRulesInRuleGroup x
-> ListActivatedRulesInRuleGroup
$cfrom :: forall x.
ListActivatedRulesInRuleGroup
-> Rep ListActivatedRulesInRuleGroup x
Prelude.Generic)

-- |
-- Create a value of 'ListActivatedRulesInRuleGroup' 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', 'listActivatedRulesInRuleGroup_ruleGroupId' - The @RuleGroupId@ of the RuleGroup for which you want to get a list of
-- ActivatedRule objects.
--
-- 'nextMarker', 'listActivatedRulesInRuleGroup_nextMarker' - If you specify a value for @Limit@ and you have more @ActivatedRules@
-- than the value of @Limit@, AWS WAF returns a @NextMarker@ value in the
-- response that allows you to list another group of @ActivatedRules@. For
-- the second and subsequent @ListActivatedRulesInRuleGroup@ requests,
-- specify the value of @NextMarker@ from the previous response to get
-- information about another batch of @ActivatedRules@.
--
-- 'limit', 'listActivatedRulesInRuleGroup_limit' - Specifies the number of @ActivatedRules@ that you want AWS WAF to return
-- for this request. If you have more @ActivatedRules@ than the number that
-- you specify for @Limit@, the response includes a @NextMarker@ value that
-- you can use to get another batch of @ActivatedRules@.
newListActivatedRulesInRuleGroup ::
  ListActivatedRulesInRuleGroup
newListActivatedRulesInRuleGroup :: ListActivatedRulesInRuleGroup
newListActivatedRulesInRuleGroup =
  ListActivatedRulesInRuleGroup' :: Maybe Text
-> Maybe Text -> Maybe Natural -> ListActivatedRulesInRuleGroup
ListActivatedRulesInRuleGroup'
    { $sel:ruleGroupId:ListActivatedRulesInRuleGroup' :: Maybe Text
ruleGroupId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextMarker:ListActivatedRulesInRuleGroup' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:ListActivatedRulesInRuleGroup' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The @RuleGroupId@ of the RuleGroup for which you want to get a list of
-- ActivatedRule objects.
listActivatedRulesInRuleGroup_ruleGroupId :: Lens.Lens' ListActivatedRulesInRuleGroup (Prelude.Maybe Prelude.Text)
listActivatedRulesInRuleGroup_ruleGroupId :: (Maybe Text -> f (Maybe Text))
-> ListActivatedRulesInRuleGroup -> f ListActivatedRulesInRuleGroup
listActivatedRulesInRuleGroup_ruleGroupId = (ListActivatedRulesInRuleGroup -> Maybe Text)
-> (ListActivatedRulesInRuleGroup
    -> Maybe Text -> ListActivatedRulesInRuleGroup)
-> Lens
     ListActivatedRulesInRuleGroup
     ListActivatedRulesInRuleGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivatedRulesInRuleGroup' {Maybe Text
ruleGroupId :: Maybe Text
$sel:ruleGroupId:ListActivatedRulesInRuleGroup' :: ListActivatedRulesInRuleGroup -> Maybe Text
ruleGroupId} -> Maybe Text
ruleGroupId) (\s :: ListActivatedRulesInRuleGroup
s@ListActivatedRulesInRuleGroup' {} Maybe Text
a -> ListActivatedRulesInRuleGroup
s {$sel:ruleGroupId:ListActivatedRulesInRuleGroup' :: Maybe Text
ruleGroupId = Maybe Text
a} :: ListActivatedRulesInRuleGroup)

-- | If you specify a value for @Limit@ and you have more @ActivatedRules@
-- than the value of @Limit@, AWS WAF returns a @NextMarker@ value in the
-- response that allows you to list another group of @ActivatedRules@. For
-- the second and subsequent @ListActivatedRulesInRuleGroup@ requests,
-- specify the value of @NextMarker@ from the previous response to get
-- information about another batch of @ActivatedRules@.
listActivatedRulesInRuleGroup_nextMarker :: Lens.Lens' ListActivatedRulesInRuleGroup (Prelude.Maybe Prelude.Text)
listActivatedRulesInRuleGroup_nextMarker :: (Maybe Text -> f (Maybe Text))
-> ListActivatedRulesInRuleGroup -> f ListActivatedRulesInRuleGroup
listActivatedRulesInRuleGroup_nextMarker = (ListActivatedRulesInRuleGroup -> Maybe Text)
-> (ListActivatedRulesInRuleGroup
    -> Maybe Text -> ListActivatedRulesInRuleGroup)
-> Lens
     ListActivatedRulesInRuleGroup
     ListActivatedRulesInRuleGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivatedRulesInRuleGroup' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListActivatedRulesInRuleGroup' :: ListActivatedRulesInRuleGroup -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListActivatedRulesInRuleGroup
s@ListActivatedRulesInRuleGroup' {} Maybe Text
a -> ListActivatedRulesInRuleGroup
s {$sel:nextMarker:ListActivatedRulesInRuleGroup' :: Maybe Text
nextMarker = Maybe Text
a} :: ListActivatedRulesInRuleGroup)

-- | Specifies the number of @ActivatedRules@ that you want AWS WAF to return
-- for this request. If you have more @ActivatedRules@ than the number that
-- you specify for @Limit@, the response includes a @NextMarker@ value that
-- you can use to get another batch of @ActivatedRules@.
listActivatedRulesInRuleGroup_limit :: Lens.Lens' ListActivatedRulesInRuleGroup (Prelude.Maybe Prelude.Natural)
listActivatedRulesInRuleGroup_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListActivatedRulesInRuleGroup -> f ListActivatedRulesInRuleGroup
listActivatedRulesInRuleGroup_limit = (ListActivatedRulesInRuleGroup -> Maybe Natural)
-> (ListActivatedRulesInRuleGroup
    -> Maybe Natural -> ListActivatedRulesInRuleGroup)
-> Lens
     ListActivatedRulesInRuleGroup
     ListActivatedRulesInRuleGroup
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivatedRulesInRuleGroup' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListActivatedRulesInRuleGroup' :: ListActivatedRulesInRuleGroup -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListActivatedRulesInRuleGroup
s@ListActivatedRulesInRuleGroup' {} Maybe Natural
a -> ListActivatedRulesInRuleGroup
s {$sel:limit:ListActivatedRulesInRuleGroup' :: Maybe Natural
limit = Maybe Natural
a} :: ListActivatedRulesInRuleGroup)

instance Core.AWSPager ListActivatedRulesInRuleGroup where
  page :: ListActivatedRulesInRuleGroup
-> AWSResponse ListActivatedRulesInRuleGroup
-> Maybe ListActivatedRulesInRuleGroup
page ListActivatedRulesInRuleGroup
rq AWSResponse ListActivatedRulesInRuleGroup
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListActivatedRulesInRuleGroup
ListActivatedRulesInRuleGroupResponse
rs
            ListActivatedRulesInRuleGroupResponse
-> Getting (First Text) ListActivatedRulesInRuleGroupResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivatedRulesInRuleGroupResponse
-> Const (First Text) ListActivatedRulesInRuleGroupResponse
Lens' ListActivatedRulesInRuleGroupResponse (Maybe Text)
listActivatedRulesInRuleGroupResponse_nextMarker
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListActivatedRulesInRuleGroupResponse
 -> Const (First Text) ListActivatedRulesInRuleGroupResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListActivatedRulesInRuleGroupResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListActivatedRulesInRuleGroup
forall a. Maybe a
Prelude.Nothing
    | Maybe [ActivatedRule] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListActivatedRulesInRuleGroup
ListActivatedRulesInRuleGroupResponse
rs
            ListActivatedRulesInRuleGroupResponse
-> Getting
     (First [ActivatedRule])
     ListActivatedRulesInRuleGroupResponse
     [ActivatedRule]
-> Maybe [ActivatedRule]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [ActivatedRule]
 -> Const (First [ActivatedRule]) (Maybe [ActivatedRule]))
-> ListActivatedRulesInRuleGroupResponse
-> Const
     (First [ActivatedRule]) ListActivatedRulesInRuleGroupResponse
Lens' ListActivatedRulesInRuleGroupResponse (Maybe [ActivatedRule])
listActivatedRulesInRuleGroupResponse_activatedRules
              ((Maybe [ActivatedRule]
  -> Const (First [ActivatedRule]) (Maybe [ActivatedRule]))
 -> ListActivatedRulesInRuleGroupResponse
 -> Const
      (First [ActivatedRule]) ListActivatedRulesInRuleGroupResponse)
-> (([ActivatedRule]
     -> Const (First [ActivatedRule]) [ActivatedRule])
    -> Maybe [ActivatedRule]
    -> Const (First [ActivatedRule]) (Maybe [ActivatedRule]))
-> Getting
     (First [ActivatedRule])
     ListActivatedRulesInRuleGroupResponse
     [ActivatedRule]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([ActivatedRule] -> Const (First [ActivatedRule]) [ActivatedRule])
-> Maybe [ActivatedRule]
-> Const (First [ActivatedRule]) (Maybe [ActivatedRule])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListActivatedRulesInRuleGroup
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListActivatedRulesInRuleGroup
-> Maybe ListActivatedRulesInRuleGroup
forall a. a -> Maybe a
Prelude.Just (ListActivatedRulesInRuleGroup
 -> Maybe ListActivatedRulesInRuleGroup)
-> ListActivatedRulesInRuleGroup
-> Maybe ListActivatedRulesInRuleGroup
forall a b. (a -> b) -> a -> b
Prelude.$
        ListActivatedRulesInRuleGroup
rq
          ListActivatedRulesInRuleGroup
-> (ListActivatedRulesInRuleGroup -> ListActivatedRulesInRuleGroup)
-> ListActivatedRulesInRuleGroup
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListActivatedRulesInRuleGroup
-> Identity ListActivatedRulesInRuleGroup
Lens
  ListActivatedRulesInRuleGroup
  ListActivatedRulesInRuleGroup
  (Maybe Text)
  (Maybe Text)
listActivatedRulesInRuleGroup_nextMarker
          ((Maybe Text -> Identity (Maybe Text))
 -> ListActivatedRulesInRuleGroup
 -> Identity ListActivatedRulesInRuleGroup)
-> Maybe Text
-> ListActivatedRulesInRuleGroup
-> ListActivatedRulesInRuleGroup
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListActivatedRulesInRuleGroup
ListActivatedRulesInRuleGroupResponse
rs
          ListActivatedRulesInRuleGroupResponse
-> Getting (First Text) ListActivatedRulesInRuleGroupResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListActivatedRulesInRuleGroupResponse
-> Const (First Text) ListActivatedRulesInRuleGroupResponse
Lens' ListActivatedRulesInRuleGroupResponse (Maybe Text)
listActivatedRulesInRuleGroupResponse_nextMarker
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListActivatedRulesInRuleGroupResponse
 -> Const (First Text) ListActivatedRulesInRuleGroupResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListActivatedRulesInRuleGroupResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance
  Core.AWSRequest
    ListActivatedRulesInRuleGroup
  where
  type
    AWSResponse ListActivatedRulesInRuleGroup =
      ListActivatedRulesInRuleGroupResponse
  request :: ListActivatedRulesInRuleGroup
-> Request ListActivatedRulesInRuleGroup
request = Service
-> ListActivatedRulesInRuleGroup
-> Request ListActivatedRulesInRuleGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListActivatedRulesInRuleGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListActivatedRulesInRuleGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListActivatedRulesInRuleGroup))
-> Logger
-> Service
-> Proxy ListActivatedRulesInRuleGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListActivatedRulesInRuleGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe [ActivatedRule]
-> Int
-> ListActivatedRulesInRuleGroupResponse
ListActivatedRulesInRuleGroupResponse'
            (Maybe Text
 -> Maybe [ActivatedRule]
 -> Int
 -> ListActivatedRulesInRuleGroupResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ActivatedRule]
      -> Int -> ListActivatedRulesInRuleGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextMarker")
            Either
  String
  (Maybe [ActivatedRule]
   -> Int -> ListActivatedRulesInRuleGroupResponse)
-> Either String (Maybe [ActivatedRule])
-> Either String (Int -> ListActivatedRulesInRuleGroupResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ActivatedRule]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ActivatedRules" Either String (Maybe (Maybe [ActivatedRule]))
-> Maybe [ActivatedRule] -> Either String (Maybe [ActivatedRule])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ActivatedRule]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListActivatedRulesInRuleGroupResponse)
-> Either String Int
-> Either String ListActivatedRulesInRuleGroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance
  Prelude.Hashable
    ListActivatedRulesInRuleGroup

instance Prelude.NFData ListActivatedRulesInRuleGroup

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

instance Core.ToJSON ListActivatedRulesInRuleGroup where
  toJSON :: ListActivatedRulesInRuleGroup -> Value
toJSON ListActivatedRulesInRuleGroup' {Maybe Natural
Maybe Text
limit :: Maybe Natural
nextMarker :: Maybe Text
ruleGroupId :: Maybe Text
$sel:limit:ListActivatedRulesInRuleGroup' :: ListActivatedRulesInRuleGroup -> Maybe Natural
$sel:nextMarker:ListActivatedRulesInRuleGroup' :: ListActivatedRulesInRuleGroup -> Maybe Text
$sel:ruleGroupId:ListActivatedRulesInRuleGroup' :: ListActivatedRulesInRuleGroup -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RuleGroupId" 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
ruleGroupId,
            (Text
"NextMarker" 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
nextMarker,
            (Text
"Limit" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
limit
          ]
      )

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

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

-- | /See:/ 'newListActivatedRulesInRuleGroupResponse' smart constructor.
data ListActivatedRulesInRuleGroupResponse = ListActivatedRulesInRuleGroupResponse'
  { -- | If you have more @ActivatedRules@ than the number that you specified for
    -- @Limit@ in the request, the response includes a @NextMarker@ value. To
    -- list more @ActivatedRules@, submit another
    -- @ListActivatedRulesInRuleGroup@ request, and specify the @NextMarker@
    -- value from the response in the @NextMarker@ value in the next request.
    ListActivatedRulesInRuleGroupResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
    -- | An array of @ActivatedRules@ objects.
    ListActivatedRulesInRuleGroupResponse -> Maybe [ActivatedRule]
activatedRules :: Prelude.Maybe [ActivatedRule],
    -- | The response's http status code.
    ListActivatedRulesInRuleGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListActivatedRulesInRuleGroupResponse
-> ListActivatedRulesInRuleGroupResponse -> Bool
(ListActivatedRulesInRuleGroupResponse
 -> ListActivatedRulesInRuleGroupResponse -> Bool)
-> (ListActivatedRulesInRuleGroupResponse
    -> ListActivatedRulesInRuleGroupResponse -> Bool)
-> Eq ListActivatedRulesInRuleGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListActivatedRulesInRuleGroupResponse
-> ListActivatedRulesInRuleGroupResponse -> Bool
$c/= :: ListActivatedRulesInRuleGroupResponse
-> ListActivatedRulesInRuleGroupResponse -> Bool
== :: ListActivatedRulesInRuleGroupResponse
-> ListActivatedRulesInRuleGroupResponse -> Bool
$c== :: ListActivatedRulesInRuleGroupResponse
-> ListActivatedRulesInRuleGroupResponse -> Bool
Prelude.Eq, ReadPrec [ListActivatedRulesInRuleGroupResponse]
ReadPrec ListActivatedRulesInRuleGroupResponse
Int -> ReadS ListActivatedRulesInRuleGroupResponse
ReadS [ListActivatedRulesInRuleGroupResponse]
(Int -> ReadS ListActivatedRulesInRuleGroupResponse)
-> ReadS [ListActivatedRulesInRuleGroupResponse]
-> ReadPrec ListActivatedRulesInRuleGroupResponse
-> ReadPrec [ListActivatedRulesInRuleGroupResponse]
-> Read ListActivatedRulesInRuleGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListActivatedRulesInRuleGroupResponse]
$creadListPrec :: ReadPrec [ListActivatedRulesInRuleGroupResponse]
readPrec :: ReadPrec ListActivatedRulesInRuleGroupResponse
$creadPrec :: ReadPrec ListActivatedRulesInRuleGroupResponse
readList :: ReadS [ListActivatedRulesInRuleGroupResponse]
$creadList :: ReadS [ListActivatedRulesInRuleGroupResponse]
readsPrec :: Int -> ReadS ListActivatedRulesInRuleGroupResponse
$creadsPrec :: Int -> ReadS ListActivatedRulesInRuleGroupResponse
Prelude.Read, Int -> ListActivatedRulesInRuleGroupResponse -> ShowS
[ListActivatedRulesInRuleGroupResponse] -> ShowS
ListActivatedRulesInRuleGroupResponse -> String
(Int -> ListActivatedRulesInRuleGroupResponse -> ShowS)
-> (ListActivatedRulesInRuleGroupResponse -> String)
-> ([ListActivatedRulesInRuleGroupResponse] -> ShowS)
-> Show ListActivatedRulesInRuleGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListActivatedRulesInRuleGroupResponse] -> ShowS
$cshowList :: [ListActivatedRulesInRuleGroupResponse] -> ShowS
show :: ListActivatedRulesInRuleGroupResponse -> String
$cshow :: ListActivatedRulesInRuleGroupResponse -> String
showsPrec :: Int -> ListActivatedRulesInRuleGroupResponse -> ShowS
$cshowsPrec :: Int -> ListActivatedRulesInRuleGroupResponse -> ShowS
Prelude.Show, (forall x.
 ListActivatedRulesInRuleGroupResponse
 -> Rep ListActivatedRulesInRuleGroupResponse x)
-> (forall x.
    Rep ListActivatedRulesInRuleGroupResponse x
    -> ListActivatedRulesInRuleGroupResponse)
-> Generic ListActivatedRulesInRuleGroupResponse
forall x.
Rep ListActivatedRulesInRuleGroupResponse x
-> ListActivatedRulesInRuleGroupResponse
forall x.
ListActivatedRulesInRuleGroupResponse
-> Rep ListActivatedRulesInRuleGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListActivatedRulesInRuleGroupResponse x
-> ListActivatedRulesInRuleGroupResponse
$cfrom :: forall x.
ListActivatedRulesInRuleGroupResponse
-> Rep ListActivatedRulesInRuleGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListActivatedRulesInRuleGroupResponse' 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:
--
-- 'nextMarker', 'listActivatedRulesInRuleGroupResponse_nextMarker' - If you have more @ActivatedRules@ than the number that you specified for
-- @Limit@ in the request, the response includes a @NextMarker@ value. To
-- list more @ActivatedRules@, submit another
-- @ListActivatedRulesInRuleGroup@ request, and specify the @NextMarker@
-- value from the response in the @NextMarker@ value in the next request.
--
-- 'activatedRules', 'listActivatedRulesInRuleGroupResponse_activatedRules' - An array of @ActivatedRules@ objects.
--
-- 'httpStatus', 'listActivatedRulesInRuleGroupResponse_httpStatus' - The response's http status code.
newListActivatedRulesInRuleGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListActivatedRulesInRuleGroupResponse
newListActivatedRulesInRuleGroupResponse :: Int -> ListActivatedRulesInRuleGroupResponse
newListActivatedRulesInRuleGroupResponse Int
pHttpStatus_ =
  ListActivatedRulesInRuleGroupResponse' :: Maybe Text
-> Maybe [ActivatedRule]
-> Int
-> ListActivatedRulesInRuleGroupResponse
ListActivatedRulesInRuleGroupResponse'
    { $sel:nextMarker:ListActivatedRulesInRuleGroupResponse' :: Maybe Text
nextMarker =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:activatedRules:ListActivatedRulesInRuleGroupResponse' :: Maybe [ActivatedRule]
activatedRules = Maybe [ActivatedRule]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListActivatedRulesInRuleGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If you have more @ActivatedRules@ than the number that you specified for
-- @Limit@ in the request, the response includes a @NextMarker@ value. To
-- list more @ActivatedRules@, submit another
-- @ListActivatedRulesInRuleGroup@ request, and specify the @NextMarker@
-- value from the response in the @NextMarker@ value in the next request.
listActivatedRulesInRuleGroupResponse_nextMarker :: Lens.Lens' ListActivatedRulesInRuleGroupResponse (Prelude.Maybe Prelude.Text)
listActivatedRulesInRuleGroupResponse_nextMarker :: (Maybe Text -> f (Maybe Text))
-> ListActivatedRulesInRuleGroupResponse
-> f ListActivatedRulesInRuleGroupResponse
listActivatedRulesInRuleGroupResponse_nextMarker = (ListActivatedRulesInRuleGroupResponse -> Maybe Text)
-> (ListActivatedRulesInRuleGroupResponse
    -> Maybe Text -> ListActivatedRulesInRuleGroupResponse)
-> Lens' ListActivatedRulesInRuleGroupResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivatedRulesInRuleGroupResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListActivatedRulesInRuleGroupResponse' :: ListActivatedRulesInRuleGroupResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListActivatedRulesInRuleGroupResponse
s@ListActivatedRulesInRuleGroupResponse' {} Maybe Text
a -> ListActivatedRulesInRuleGroupResponse
s {$sel:nextMarker:ListActivatedRulesInRuleGroupResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListActivatedRulesInRuleGroupResponse)

-- | An array of @ActivatedRules@ objects.
listActivatedRulesInRuleGroupResponse_activatedRules :: Lens.Lens' ListActivatedRulesInRuleGroupResponse (Prelude.Maybe [ActivatedRule])
listActivatedRulesInRuleGroupResponse_activatedRules :: (Maybe [ActivatedRule] -> f (Maybe [ActivatedRule]))
-> ListActivatedRulesInRuleGroupResponse
-> f ListActivatedRulesInRuleGroupResponse
listActivatedRulesInRuleGroupResponse_activatedRules = (ListActivatedRulesInRuleGroupResponse -> Maybe [ActivatedRule])
-> (ListActivatedRulesInRuleGroupResponse
    -> Maybe [ActivatedRule] -> ListActivatedRulesInRuleGroupResponse)
-> Lens'
     ListActivatedRulesInRuleGroupResponse (Maybe [ActivatedRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListActivatedRulesInRuleGroupResponse' {Maybe [ActivatedRule]
activatedRules :: Maybe [ActivatedRule]
$sel:activatedRules:ListActivatedRulesInRuleGroupResponse' :: ListActivatedRulesInRuleGroupResponse -> Maybe [ActivatedRule]
activatedRules} -> Maybe [ActivatedRule]
activatedRules) (\s :: ListActivatedRulesInRuleGroupResponse
s@ListActivatedRulesInRuleGroupResponse' {} Maybe [ActivatedRule]
a -> ListActivatedRulesInRuleGroupResponse
s {$sel:activatedRules:ListActivatedRulesInRuleGroupResponse' :: Maybe [ActivatedRule]
activatedRules = Maybe [ActivatedRule]
a} :: ListActivatedRulesInRuleGroupResponse) ((Maybe [ActivatedRule] -> f (Maybe [ActivatedRule]))
 -> ListActivatedRulesInRuleGroupResponse
 -> f ListActivatedRulesInRuleGroupResponse)
-> ((Maybe [ActivatedRule] -> f (Maybe [ActivatedRule]))
    -> Maybe [ActivatedRule] -> f (Maybe [ActivatedRule]))
-> (Maybe [ActivatedRule] -> f (Maybe [ActivatedRule]))
-> ListActivatedRulesInRuleGroupResponse
-> f ListActivatedRulesInRuleGroupResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ActivatedRule] [ActivatedRule] [ActivatedRule] [ActivatedRule]
-> Iso
     (Maybe [ActivatedRule])
     (Maybe [ActivatedRule])
     (Maybe [ActivatedRule])
     (Maybe [ActivatedRule])
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
  [ActivatedRule] [ActivatedRule] [ActivatedRule] [ActivatedRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ListActivatedRulesInRuleGroupResponse