{-# 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.Route53Resolver.ListFirewallRules
-- 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)
--
-- Retrieves the firewall rules that you have defined for the specified
-- firewall rule group. DNS Firewall uses the rules in a rule group to
-- filter DNS network traffic for a VPC.
--
-- A single call might return only a partial list of the rules. For
-- information, see @MaxResults@.
--
-- This operation returns paginated results.
module Amazonka.Route53Resolver.ListFirewallRules
  ( -- * Creating a Request
    ListFirewallRules (..),
    newListFirewallRules,

    -- * Request Lenses
    listFirewallRules_priority,
    listFirewallRules_action,
    listFirewallRules_nextToken,
    listFirewallRules_maxResults,
    listFirewallRules_firewallRuleGroupId,

    -- * Destructuring the Response
    ListFirewallRulesResponse (..),
    newListFirewallRulesResponse,

    -- * Response Lenses
    listFirewallRulesResponse_firewallRules,
    listFirewallRulesResponse_nextToken,
    listFirewallRulesResponse_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.Route53Resolver.Types

-- | /See:/ 'newListFirewallRules' smart constructor.
data ListFirewallRules = ListFirewallRules'
  { -- | Optional additional filter for the rules to retrieve.
    --
    -- The setting that determines the processing order of the rules in a rule
    -- group. DNS Firewall processes the rules in a rule group by order of
    -- priority, starting from the lowest setting.
    ListFirewallRules -> Maybe Int
priority :: Prelude.Maybe Prelude.Int,
    -- | Optional additional filter for the rules to retrieve.
    --
    -- The action that DNS Firewall should take on a DNS query when it matches
    -- one of the domains in the rule\'s domain list:
    --
    -- -   @ALLOW@ - Permit the request to go through.
    --
    -- -   @ALERT@ - Permit the request to go through but send an alert to the
    --     logs.
    --
    -- -   @BLOCK@ - Disallow the request. If this is specified, additional
    --     handling details are provided in the rule\'s @BlockResponse@
    --     setting.
    ListFirewallRules -> Maybe Action
action :: Prelude.Maybe Action,
    -- | For the first call to this list request, omit this value.
    --
    -- When you request a list of objects, Resolver returns at most the number
    -- of objects specified in @MaxResults@. If more objects are available for
    -- retrieval, Resolver returns a @NextToken@ value in the response. To
    -- retrieve the next batch of objects, use the token that was returned for
    -- the prior request in your next request.
    ListFirewallRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of objects that you want Resolver to return for this
    -- request. If more objects are available, in the response, Resolver
    -- provides a @NextToken@ value that you can use in a subsequent call to
    -- get the next batch of objects.
    --
    -- If you don\'t specify a value for @MaxResults@, Resolver returns up to
    -- 100 objects.
    ListFirewallRules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The unique identifier of the firewall rule group that you want to
    -- retrieve the rules for.
    ListFirewallRules -> Text
firewallRuleGroupId :: Prelude.Text
  }
  deriving (ListFirewallRules -> ListFirewallRules -> Bool
(ListFirewallRules -> ListFirewallRules -> Bool)
-> (ListFirewallRules -> ListFirewallRules -> Bool)
-> Eq ListFirewallRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFirewallRules -> ListFirewallRules -> Bool
$c/= :: ListFirewallRules -> ListFirewallRules -> Bool
== :: ListFirewallRules -> ListFirewallRules -> Bool
$c== :: ListFirewallRules -> ListFirewallRules -> Bool
Prelude.Eq, ReadPrec [ListFirewallRules]
ReadPrec ListFirewallRules
Int -> ReadS ListFirewallRules
ReadS [ListFirewallRules]
(Int -> ReadS ListFirewallRules)
-> ReadS [ListFirewallRules]
-> ReadPrec ListFirewallRules
-> ReadPrec [ListFirewallRules]
-> Read ListFirewallRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFirewallRules]
$creadListPrec :: ReadPrec [ListFirewallRules]
readPrec :: ReadPrec ListFirewallRules
$creadPrec :: ReadPrec ListFirewallRules
readList :: ReadS [ListFirewallRules]
$creadList :: ReadS [ListFirewallRules]
readsPrec :: Int -> ReadS ListFirewallRules
$creadsPrec :: Int -> ReadS ListFirewallRules
Prelude.Read, Int -> ListFirewallRules -> ShowS
[ListFirewallRules] -> ShowS
ListFirewallRules -> String
(Int -> ListFirewallRules -> ShowS)
-> (ListFirewallRules -> String)
-> ([ListFirewallRules] -> ShowS)
-> Show ListFirewallRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFirewallRules] -> ShowS
$cshowList :: [ListFirewallRules] -> ShowS
show :: ListFirewallRules -> String
$cshow :: ListFirewallRules -> String
showsPrec :: Int -> ListFirewallRules -> ShowS
$cshowsPrec :: Int -> ListFirewallRules -> ShowS
Prelude.Show, (forall x. ListFirewallRules -> Rep ListFirewallRules x)
-> (forall x. Rep ListFirewallRules x -> ListFirewallRules)
-> Generic ListFirewallRules
forall x. Rep ListFirewallRules x -> ListFirewallRules
forall x. ListFirewallRules -> Rep ListFirewallRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFirewallRules x -> ListFirewallRules
$cfrom :: forall x. ListFirewallRules -> Rep ListFirewallRules x
Prelude.Generic)

-- |
-- Create a value of 'ListFirewallRules' 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:
--
-- 'priority', 'listFirewallRules_priority' - Optional additional filter for the rules to retrieve.
--
-- The setting that determines the processing order of the rules in a rule
-- group. DNS Firewall processes the rules in a rule group by order of
-- priority, starting from the lowest setting.
--
-- 'action', 'listFirewallRules_action' - Optional additional filter for the rules to retrieve.
--
-- The action that DNS Firewall should take on a DNS query when it matches
-- one of the domains in the rule\'s domain list:
--
-- -   @ALLOW@ - Permit the request to go through.
--
-- -   @ALERT@ - Permit the request to go through but send an alert to the
--     logs.
--
-- -   @BLOCK@ - Disallow the request. If this is specified, additional
--     handling details are provided in the rule\'s @BlockResponse@
--     setting.
--
-- 'nextToken', 'listFirewallRules_nextToken' - For the first call to this list request, omit this value.
--
-- When you request a list of objects, Resolver returns at most the number
-- of objects specified in @MaxResults@. If more objects are available for
-- retrieval, Resolver returns a @NextToken@ value in the response. To
-- retrieve the next batch of objects, use the token that was returned for
-- the prior request in your next request.
--
-- 'maxResults', 'listFirewallRules_maxResults' - The maximum number of objects that you want Resolver to return for this
-- request. If more objects are available, in the response, Resolver
-- provides a @NextToken@ value that you can use in a subsequent call to
-- get the next batch of objects.
--
-- If you don\'t specify a value for @MaxResults@, Resolver returns up to
-- 100 objects.
--
-- 'firewallRuleGroupId', 'listFirewallRules_firewallRuleGroupId' - The unique identifier of the firewall rule group that you want to
-- retrieve the rules for.
newListFirewallRules ::
  -- | 'firewallRuleGroupId'
  Prelude.Text ->
  ListFirewallRules
newListFirewallRules :: Text -> ListFirewallRules
newListFirewallRules Text
pFirewallRuleGroupId_ =
  ListFirewallRules' :: Maybe Int
-> Maybe Action
-> Maybe Text
-> Maybe Natural
-> Text
-> ListFirewallRules
ListFirewallRules'
    { $sel:priority:ListFirewallRules' :: Maybe Int
priority = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:action:ListFirewallRules' :: Maybe Action
action = Maybe Action
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFirewallRules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListFirewallRules' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:firewallRuleGroupId:ListFirewallRules' :: Text
firewallRuleGroupId = Text
pFirewallRuleGroupId_
    }

-- | Optional additional filter for the rules to retrieve.
--
-- The setting that determines the processing order of the rules in a rule
-- group. DNS Firewall processes the rules in a rule group by order of
-- priority, starting from the lowest setting.
listFirewallRules_priority :: Lens.Lens' ListFirewallRules (Prelude.Maybe Prelude.Int)
listFirewallRules_priority :: (Maybe Int -> f (Maybe Int))
-> ListFirewallRules -> f ListFirewallRules
listFirewallRules_priority = (ListFirewallRules -> Maybe Int)
-> (ListFirewallRules -> Maybe Int -> ListFirewallRules)
-> Lens ListFirewallRules ListFirewallRules (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFirewallRules' {Maybe Int
priority :: Maybe Int
$sel:priority:ListFirewallRules' :: ListFirewallRules -> Maybe Int
priority} -> Maybe Int
priority) (\s :: ListFirewallRules
s@ListFirewallRules' {} Maybe Int
a -> ListFirewallRules
s {$sel:priority:ListFirewallRules' :: Maybe Int
priority = Maybe Int
a} :: ListFirewallRules)

-- | Optional additional filter for the rules to retrieve.
--
-- The action that DNS Firewall should take on a DNS query when it matches
-- one of the domains in the rule\'s domain list:
--
-- -   @ALLOW@ - Permit the request to go through.
--
-- -   @ALERT@ - Permit the request to go through but send an alert to the
--     logs.
--
-- -   @BLOCK@ - Disallow the request. If this is specified, additional
--     handling details are provided in the rule\'s @BlockResponse@
--     setting.
listFirewallRules_action :: Lens.Lens' ListFirewallRules (Prelude.Maybe Action)
listFirewallRules_action :: (Maybe Action -> f (Maybe Action))
-> ListFirewallRules -> f ListFirewallRules
listFirewallRules_action = (ListFirewallRules -> Maybe Action)
-> (ListFirewallRules -> Maybe Action -> ListFirewallRules)
-> Lens
     ListFirewallRules ListFirewallRules (Maybe Action) (Maybe Action)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFirewallRules' {Maybe Action
action :: Maybe Action
$sel:action:ListFirewallRules' :: ListFirewallRules -> Maybe Action
action} -> Maybe Action
action) (\s :: ListFirewallRules
s@ListFirewallRules' {} Maybe Action
a -> ListFirewallRules
s {$sel:action:ListFirewallRules' :: Maybe Action
action = Maybe Action
a} :: ListFirewallRules)

-- | For the first call to this list request, omit this value.
--
-- When you request a list of objects, Resolver returns at most the number
-- of objects specified in @MaxResults@. If more objects are available for
-- retrieval, Resolver returns a @NextToken@ value in the response. To
-- retrieve the next batch of objects, use the token that was returned for
-- the prior request in your next request.
listFirewallRules_nextToken :: Lens.Lens' ListFirewallRules (Prelude.Maybe Prelude.Text)
listFirewallRules_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListFirewallRules -> f ListFirewallRules
listFirewallRules_nextToken = (ListFirewallRules -> Maybe Text)
-> (ListFirewallRules -> Maybe Text -> ListFirewallRules)
-> Lens
     ListFirewallRules ListFirewallRules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFirewallRules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFirewallRules' :: ListFirewallRules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFirewallRules
s@ListFirewallRules' {} Maybe Text
a -> ListFirewallRules
s {$sel:nextToken:ListFirewallRules' :: Maybe Text
nextToken = Maybe Text
a} :: ListFirewallRules)

-- | The maximum number of objects that you want Resolver to return for this
-- request. If more objects are available, in the response, Resolver
-- provides a @NextToken@ value that you can use in a subsequent call to
-- get the next batch of objects.
--
-- If you don\'t specify a value for @MaxResults@, Resolver returns up to
-- 100 objects.
listFirewallRules_maxResults :: Lens.Lens' ListFirewallRules (Prelude.Maybe Prelude.Natural)
listFirewallRules_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListFirewallRules -> f ListFirewallRules
listFirewallRules_maxResults = (ListFirewallRules -> Maybe Natural)
-> (ListFirewallRules -> Maybe Natural -> ListFirewallRules)
-> Lens
     ListFirewallRules ListFirewallRules (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFirewallRules' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListFirewallRules' :: ListFirewallRules -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListFirewallRules
s@ListFirewallRules' {} Maybe Natural
a -> ListFirewallRules
s {$sel:maxResults:ListFirewallRules' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListFirewallRules)

-- | The unique identifier of the firewall rule group that you want to
-- retrieve the rules for.
listFirewallRules_firewallRuleGroupId :: Lens.Lens' ListFirewallRules Prelude.Text
listFirewallRules_firewallRuleGroupId :: (Text -> f Text) -> ListFirewallRules -> f ListFirewallRules
listFirewallRules_firewallRuleGroupId = (ListFirewallRules -> Text)
-> (ListFirewallRules -> Text -> ListFirewallRules)
-> Lens ListFirewallRules ListFirewallRules Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFirewallRules' {Text
firewallRuleGroupId :: Text
$sel:firewallRuleGroupId:ListFirewallRules' :: ListFirewallRules -> Text
firewallRuleGroupId} -> Text
firewallRuleGroupId) (\s :: ListFirewallRules
s@ListFirewallRules' {} Text
a -> ListFirewallRules
s {$sel:firewallRuleGroupId:ListFirewallRules' :: Text
firewallRuleGroupId = Text
a} :: ListFirewallRules)

instance Core.AWSPager ListFirewallRules where
  page :: ListFirewallRules
-> AWSResponse ListFirewallRules -> Maybe ListFirewallRules
page ListFirewallRules
rq AWSResponse ListFirewallRules
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFirewallRules
ListFirewallRulesResponse
rs
            ListFirewallRulesResponse
-> Getting (First Text) ListFirewallRulesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFirewallRulesResponse
-> Const (First Text) ListFirewallRulesResponse
Lens' ListFirewallRulesResponse (Maybe Text)
listFirewallRulesResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFirewallRulesResponse
 -> Const (First Text) ListFirewallRulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFirewallRulesResponse 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 ListFirewallRules
forall a. Maybe a
Prelude.Nothing
    | Maybe [FirewallRule] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListFirewallRules
ListFirewallRulesResponse
rs
            ListFirewallRulesResponse
-> Getting
     (First [FirewallRule]) ListFirewallRulesResponse [FirewallRule]
-> Maybe [FirewallRule]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [FirewallRule]
 -> Const (First [FirewallRule]) (Maybe [FirewallRule]))
-> ListFirewallRulesResponse
-> Const (First [FirewallRule]) ListFirewallRulesResponse
Lens' ListFirewallRulesResponse (Maybe [FirewallRule])
listFirewallRulesResponse_firewallRules
              ((Maybe [FirewallRule]
  -> Const (First [FirewallRule]) (Maybe [FirewallRule]))
 -> ListFirewallRulesResponse
 -> Const (First [FirewallRule]) ListFirewallRulesResponse)
-> (([FirewallRule] -> Const (First [FirewallRule]) [FirewallRule])
    -> Maybe [FirewallRule]
    -> Const (First [FirewallRule]) (Maybe [FirewallRule]))
-> Getting
     (First [FirewallRule]) ListFirewallRulesResponse [FirewallRule]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([FirewallRule] -> Const (First [FirewallRule]) [FirewallRule])
-> Maybe [FirewallRule]
-> Const (First [FirewallRule]) (Maybe [FirewallRule])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListFirewallRules
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListFirewallRules -> Maybe ListFirewallRules
forall a. a -> Maybe a
Prelude.Just (ListFirewallRules -> Maybe ListFirewallRules)
-> ListFirewallRules -> Maybe ListFirewallRules
forall a b. (a -> b) -> a -> b
Prelude.$
        ListFirewallRules
rq
          ListFirewallRules
-> (ListFirewallRules -> ListFirewallRules) -> ListFirewallRules
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListFirewallRules -> Identity ListFirewallRules
Lens ListFirewallRules ListFirewallRules (Maybe Text) (Maybe Text)
listFirewallRules_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListFirewallRules -> Identity ListFirewallRules)
-> Maybe Text -> ListFirewallRules -> ListFirewallRules
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListFirewallRules
ListFirewallRulesResponse
rs
          ListFirewallRulesResponse
-> Getting (First Text) ListFirewallRulesResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListFirewallRulesResponse
-> Const (First Text) ListFirewallRulesResponse
Lens' ListFirewallRulesResponse (Maybe Text)
listFirewallRulesResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListFirewallRulesResponse
 -> Const (First Text) ListFirewallRulesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListFirewallRulesResponse 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 ListFirewallRules where
  type
    AWSResponse ListFirewallRules =
      ListFirewallRulesResponse
  request :: ListFirewallRules -> Request ListFirewallRules
request = Service -> ListFirewallRules -> Request ListFirewallRules
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListFirewallRules
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListFirewallRules)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListFirewallRules))
-> Logger
-> Service
-> Proxy ListFirewallRules
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListFirewallRules)))
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 [FirewallRule]
-> Maybe Text -> Int -> ListFirewallRulesResponse
ListFirewallRulesResponse'
            (Maybe [FirewallRule]
 -> Maybe Text -> Int -> ListFirewallRulesResponse)
-> Either String (Maybe [FirewallRule])
-> Either String (Maybe Text -> Int -> ListFirewallRulesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [FirewallRule]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"FirewallRules" Either String (Maybe (Maybe [FirewallRule]))
-> Maybe [FirewallRule] -> Either String (Maybe [FirewallRule])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FirewallRule]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListFirewallRulesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListFirewallRulesResponse)
forall (f :: * -> *) a b. Applicative f => 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
"NextToken")
            Either String (Int -> ListFirewallRulesResponse)
-> Either String Int -> Either String ListFirewallRulesResponse
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 ListFirewallRules

instance Prelude.NFData ListFirewallRules

instance Core.ToHeaders ListFirewallRules where
  toHeaders :: ListFirewallRules -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListFirewallRules -> 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
"Route53Resolver.ListFirewallRules" ::
                          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 ListFirewallRules where
  toJSON :: ListFirewallRules -> Value
toJSON ListFirewallRules' {Maybe Int
Maybe Natural
Maybe Text
Maybe Action
Text
firewallRuleGroupId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
action :: Maybe Action
priority :: Maybe Int
$sel:firewallRuleGroupId:ListFirewallRules' :: ListFirewallRules -> Text
$sel:maxResults:ListFirewallRules' :: ListFirewallRules -> Maybe Natural
$sel:nextToken:ListFirewallRules' :: ListFirewallRules -> Maybe Text
$sel:action:ListFirewallRules' :: ListFirewallRules -> Maybe Action
$sel:priority:ListFirewallRules' :: ListFirewallRules -> Maybe Int
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Priority" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
priority,
            (Text
"Action" Text -> Action -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Action -> Pair) -> Maybe Action -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Action
action,
            (Text
"NextToken" 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
nextToken,
            (Text
"MaxResults" 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
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"FirewallRuleGroupId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
firewallRuleGroupId)
          ]
      )

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

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

-- | /See:/ 'newListFirewallRulesResponse' smart constructor.
data ListFirewallRulesResponse = ListFirewallRulesResponse'
  { -- | A list of the rules that you have defined.
    --
    -- This might be a partial list of the firewall rules that you\'ve defined.
    -- For information, see @MaxResults@.
    ListFirewallRulesResponse -> Maybe [FirewallRule]
firewallRules :: Prelude.Maybe [FirewallRule],
    -- | If objects are still available for retrieval, Resolver returns this
    -- token in the response. To retrieve the next batch of objects, provide
    -- this token in your next request.
    ListFirewallRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListFirewallRulesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListFirewallRulesResponse -> ListFirewallRulesResponse -> Bool
(ListFirewallRulesResponse -> ListFirewallRulesResponse -> Bool)
-> (ListFirewallRulesResponse -> ListFirewallRulesResponse -> Bool)
-> Eq ListFirewallRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFirewallRulesResponse -> ListFirewallRulesResponse -> Bool
$c/= :: ListFirewallRulesResponse -> ListFirewallRulesResponse -> Bool
== :: ListFirewallRulesResponse -> ListFirewallRulesResponse -> Bool
$c== :: ListFirewallRulesResponse -> ListFirewallRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListFirewallRulesResponse]
ReadPrec ListFirewallRulesResponse
Int -> ReadS ListFirewallRulesResponse
ReadS [ListFirewallRulesResponse]
(Int -> ReadS ListFirewallRulesResponse)
-> ReadS [ListFirewallRulesResponse]
-> ReadPrec ListFirewallRulesResponse
-> ReadPrec [ListFirewallRulesResponse]
-> Read ListFirewallRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFirewallRulesResponse]
$creadListPrec :: ReadPrec [ListFirewallRulesResponse]
readPrec :: ReadPrec ListFirewallRulesResponse
$creadPrec :: ReadPrec ListFirewallRulesResponse
readList :: ReadS [ListFirewallRulesResponse]
$creadList :: ReadS [ListFirewallRulesResponse]
readsPrec :: Int -> ReadS ListFirewallRulesResponse
$creadsPrec :: Int -> ReadS ListFirewallRulesResponse
Prelude.Read, Int -> ListFirewallRulesResponse -> ShowS
[ListFirewallRulesResponse] -> ShowS
ListFirewallRulesResponse -> String
(Int -> ListFirewallRulesResponse -> ShowS)
-> (ListFirewallRulesResponse -> String)
-> ([ListFirewallRulesResponse] -> ShowS)
-> Show ListFirewallRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFirewallRulesResponse] -> ShowS
$cshowList :: [ListFirewallRulesResponse] -> ShowS
show :: ListFirewallRulesResponse -> String
$cshow :: ListFirewallRulesResponse -> String
showsPrec :: Int -> ListFirewallRulesResponse -> ShowS
$cshowsPrec :: Int -> ListFirewallRulesResponse -> ShowS
Prelude.Show, (forall x.
 ListFirewallRulesResponse -> Rep ListFirewallRulesResponse x)
-> (forall x.
    Rep ListFirewallRulesResponse x -> ListFirewallRulesResponse)
-> Generic ListFirewallRulesResponse
forall x.
Rep ListFirewallRulesResponse x -> ListFirewallRulesResponse
forall x.
ListFirewallRulesResponse -> Rep ListFirewallRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListFirewallRulesResponse x -> ListFirewallRulesResponse
$cfrom :: forall x.
ListFirewallRulesResponse -> Rep ListFirewallRulesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListFirewallRulesResponse' 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:
--
-- 'firewallRules', 'listFirewallRulesResponse_firewallRules' - A list of the rules that you have defined.
--
-- This might be a partial list of the firewall rules that you\'ve defined.
-- For information, see @MaxResults@.
--
-- 'nextToken', 'listFirewallRulesResponse_nextToken' - If objects are still available for retrieval, Resolver returns this
-- token in the response. To retrieve the next batch of objects, provide
-- this token in your next request.
--
-- 'httpStatus', 'listFirewallRulesResponse_httpStatus' - The response's http status code.
newListFirewallRulesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListFirewallRulesResponse
newListFirewallRulesResponse :: Int -> ListFirewallRulesResponse
newListFirewallRulesResponse Int
pHttpStatus_ =
  ListFirewallRulesResponse' :: Maybe [FirewallRule]
-> Maybe Text -> Int -> ListFirewallRulesResponse
ListFirewallRulesResponse'
    { $sel:firewallRules:ListFirewallRulesResponse' :: Maybe [FirewallRule]
firewallRules =
        Maybe [FirewallRule]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListFirewallRulesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListFirewallRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of the rules that you have defined.
--
-- This might be a partial list of the firewall rules that you\'ve defined.
-- For information, see @MaxResults@.
listFirewallRulesResponse_firewallRules :: Lens.Lens' ListFirewallRulesResponse (Prelude.Maybe [FirewallRule])
listFirewallRulesResponse_firewallRules :: (Maybe [FirewallRule] -> f (Maybe [FirewallRule]))
-> ListFirewallRulesResponse -> f ListFirewallRulesResponse
listFirewallRulesResponse_firewallRules = (ListFirewallRulesResponse -> Maybe [FirewallRule])
-> (ListFirewallRulesResponse
    -> Maybe [FirewallRule] -> ListFirewallRulesResponse)
-> Lens' ListFirewallRulesResponse (Maybe [FirewallRule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFirewallRulesResponse' {Maybe [FirewallRule]
firewallRules :: Maybe [FirewallRule]
$sel:firewallRules:ListFirewallRulesResponse' :: ListFirewallRulesResponse -> Maybe [FirewallRule]
firewallRules} -> Maybe [FirewallRule]
firewallRules) (\s :: ListFirewallRulesResponse
s@ListFirewallRulesResponse' {} Maybe [FirewallRule]
a -> ListFirewallRulesResponse
s {$sel:firewallRules:ListFirewallRulesResponse' :: Maybe [FirewallRule]
firewallRules = Maybe [FirewallRule]
a} :: ListFirewallRulesResponse) ((Maybe [FirewallRule] -> f (Maybe [FirewallRule]))
 -> ListFirewallRulesResponse -> f ListFirewallRulesResponse)
-> ((Maybe [FirewallRule] -> f (Maybe [FirewallRule]))
    -> Maybe [FirewallRule] -> f (Maybe [FirewallRule]))
-> (Maybe [FirewallRule] -> f (Maybe [FirewallRule]))
-> ListFirewallRulesResponse
-> f ListFirewallRulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [FirewallRule] [FirewallRule] [FirewallRule] [FirewallRule]
-> Iso
     (Maybe [FirewallRule])
     (Maybe [FirewallRule])
     (Maybe [FirewallRule])
     (Maybe [FirewallRule])
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 [FirewallRule] [FirewallRule] [FirewallRule] [FirewallRule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If objects are still available for retrieval, Resolver returns this
-- token in the response. To retrieve the next batch of objects, provide
-- this token in your next request.
listFirewallRulesResponse_nextToken :: Lens.Lens' ListFirewallRulesResponse (Prelude.Maybe Prelude.Text)
listFirewallRulesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListFirewallRulesResponse -> f ListFirewallRulesResponse
listFirewallRulesResponse_nextToken = (ListFirewallRulesResponse -> Maybe Text)
-> (ListFirewallRulesResponse
    -> Maybe Text -> ListFirewallRulesResponse)
-> Lens' ListFirewallRulesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFirewallRulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFirewallRulesResponse' :: ListFirewallRulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFirewallRulesResponse
s@ListFirewallRulesResponse' {} Maybe Text
a -> ListFirewallRulesResponse
s {$sel:nextToken:ListFirewallRulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFirewallRulesResponse)

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

instance Prelude.NFData ListFirewallRulesResponse