{-# 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 #-}
module Amazonka.WAFRegional.ListRateBasedRules
(
ListRateBasedRules (..),
newListRateBasedRules,
listRateBasedRules_nextMarker,
listRateBasedRules_limit,
ListRateBasedRulesResponse (..),
newListRateBasedRulesResponse,
listRateBasedRulesResponse_rules,
listRateBasedRulesResponse_nextMarker,
listRateBasedRulesResponse_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.WAFRegional.Types
data ListRateBasedRules = ListRateBasedRules'
{
ListRateBasedRules -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
ListRateBasedRules -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural
}
deriving (ListRateBasedRules -> ListRateBasedRules -> Bool
(ListRateBasedRules -> ListRateBasedRules -> Bool)
-> (ListRateBasedRules -> ListRateBasedRules -> Bool)
-> Eq ListRateBasedRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRateBasedRules -> ListRateBasedRules -> Bool
$c/= :: ListRateBasedRules -> ListRateBasedRules -> Bool
== :: ListRateBasedRules -> ListRateBasedRules -> Bool
$c== :: ListRateBasedRules -> ListRateBasedRules -> Bool
Prelude.Eq, ReadPrec [ListRateBasedRules]
ReadPrec ListRateBasedRules
Int -> ReadS ListRateBasedRules
ReadS [ListRateBasedRules]
(Int -> ReadS ListRateBasedRules)
-> ReadS [ListRateBasedRules]
-> ReadPrec ListRateBasedRules
-> ReadPrec [ListRateBasedRules]
-> Read ListRateBasedRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRateBasedRules]
$creadListPrec :: ReadPrec [ListRateBasedRules]
readPrec :: ReadPrec ListRateBasedRules
$creadPrec :: ReadPrec ListRateBasedRules
readList :: ReadS [ListRateBasedRules]
$creadList :: ReadS [ListRateBasedRules]
readsPrec :: Int -> ReadS ListRateBasedRules
$creadsPrec :: Int -> ReadS ListRateBasedRules
Prelude.Read, Int -> ListRateBasedRules -> ShowS
[ListRateBasedRules] -> ShowS
ListRateBasedRules -> String
(Int -> ListRateBasedRules -> ShowS)
-> (ListRateBasedRules -> String)
-> ([ListRateBasedRules] -> ShowS)
-> Show ListRateBasedRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRateBasedRules] -> ShowS
$cshowList :: [ListRateBasedRules] -> ShowS
show :: ListRateBasedRules -> String
$cshow :: ListRateBasedRules -> String
showsPrec :: Int -> ListRateBasedRules -> ShowS
$cshowsPrec :: Int -> ListRateBasedRules -> ShowS
Prelude.Show, (forall x. ListRateBasedRules -> Rep ListRateBasedRules x)
-> (forall x. Rep ListRateBasedRules x -> ListRateBasedRules)
-> Generic ListRateBasedRules
forall x. Rep ListRateBasedRules x -> ListRateBasedRules
forall x. ListRateBasedRules -> Rep ListRateBasedRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRateBasedRules x -> ListRateBasedRules
$cfrom :: forall x. ListRateBasedRules -> Rep ListRateBasedRules x
Prelude.Generic)
newListRateBasedRules ::
ListRateBasedRules
newListRateBasedRules :: ListRateBasedRules
newListRateBasedRules =
ListRateBasedRules' :: Maybe Text -> Maybe Natural -> ListRateBasedRules
ListRateBasedRules'
{ $sel:nextMarker:ListRateBasedRules' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:limit:ListRateBasedRules' :: Maybe Natural
limit = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listRateBasedRules_nextMarker :: Lens.Lens' ListRateBasedRules (Prelude.Maybe Prelude.Text)
listRateBasedRules_nextMarker :: (Maybe Text -> f (Maybe Text))
-> ListRateBasedRules -> f ListRateBasedRules
listRateBasedRules_nextMarker = (ListRateBasedRules -> Maybe Text)
-> (ListRateBasedRules -> Maybe Text -> ListRateBasedRules)
-> Lens
ListRateBasedRules ListRateBasedRules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRateBasedRules' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListRateBasedRules' :: ListRateBasedRules -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListRateBasedRules
s@ListRateBasedRules' {} Maybe Text
a -> ListRateBasedRules
s {$sel:nextMarker:ListRateBasedRules' :: Maybe Text
nextMarker = Maybe Text
a} :: ListRateBasedRules)
listRateBasedRules_limit :: Lens.Lens' ListRateBasedRules (Prelude.Maybe Prelude.Natural)
listRateBasedRules_limit :: (Maybe Natural -> f (Maybe Natural))
-> ListRateBasedRules -> f ListRateBasedRules
listRateBasedRules_limit = (ListRateBasedRules -> Maybe Natural)
-> (ListRateBasedRules -> Maybe Natural -> ListRateBasedRules)
-> Lens
ListRateBasedRules
ListRateBasedRules
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRateBasedRules' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListRateBasedRules' :: ListRateBasedRules -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListRateBasedRules
s@ListRateBasedRules' {} Maybe Natural
a -> ListRateBasedRules
s {$sel:limit:ListRateBasedRules' :: Maybe Natural
limit = Maybe Natural
a} :: ListRateBasedRules)
instance Core.AWSRequest ListRateBasedRules where
type
AWSResponse ListRateBasedRules =
ListRateBasedRulesResponse
request :: ListRateBasedRules -> Request ListRateBasedRules
request = Service -> ListRateBasedRules -> Request ListRateBasedRules
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListRateBasedRules
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListRateBasedRules)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListRateBasedRules))
-> Logger
-> Service
-> Proxy ListRateBasedRules
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListRateBasedRules)))
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 [RuleSummary]
-> Maybe Text -> Int -> ListRateBasedRulesResponse
ListRateBasedRulesResponse'
(Maybe [RuleSummary]
-> Maybe Text -> Int -> ListRateBasedRulesResponse)
-> Either String (Maybe [RuleSummary])
-> Either String (Maybe Text -> Int -> ListRateBasedRulesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [RuleSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Rules" Either String (Maybe (Maybe [RuleSummary]))
-> Maybe [RuleSummary] -> Either String (Maybe [RuleSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RuleSummary]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListRateBasedRulesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListRateBasedRulesResponse)
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
"NextMarker")
Either String (Int -> ListRateBasedRulesResponse)
-> Either String Int -> Either String ListRateBasedRulesResponse
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 ListRateBasedRules
instance Prelude.NFData ListRateBasedRules
instance Core.ToHeaders ListRateBasedRules where
toHeaders :: ListRateBasedRules -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListRateBasedRules -> 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_Regional_20161128.ListRateBasedRules" ::
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 ListRateBasedRules where
toJSON :: ListRateBasedRules -> Value
toJSON ListRateBasedRules' {Maybe Natural
Maybe Text
limit :: Maybe Natural
nextMarker :: Maybe Text
$sel:limit:ListRateBasedRules' :: ListRateBasedRules -> Maybe Natural
$sel:nextMarker:ListRateBasedRules' :: ListRateBasedRules -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (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 ListRateBasedRules where
toPath :: ListRateBasedRules -> ByteString
toPath = ByteString -> ListRateBasedRules -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListRateBasedRules where
toQuery :: ListRateBasedRules -> QueryString
toQuery = QueryString -> ListRateBasedRules -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ListRateBasedRulesResponse = ListRateBasedRulesResponse'
{
ListRateBasedRulesResponse -> Maybe [RuleSummary]
rules :: Prelude.Maybe [RuleSummary],
ListRateBasedRulesResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
ListRateBasedRulesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListRateBasedRulesResponse -> ListRateBasedRulesResponse -> Bool
(ListRateBasedRulesResponse -> ListRateBasedRulesResponse -> Bool)
-> (ListRateBasedRulesResponse
-> ListRateBasedRulesResponse -> Bool)
-> Eq ListRateBasedRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRateBasedRulesResponse -> ListRateBasedRulesResponse -> Bool
$c/= :: ListRateBasedRulesResponse -> ListRateBasedRulesResponse -> Bool
== :: ListRateBasedRulesResponse -> ListRateBasedRulesResponse -> Bool
$c== :: ListRateBasedRulesResponse -> ListRateBasedRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListRateBasedRulesResponse]
ReadPrec ListRateBasedRulesResponse
Int -> ReadS ListRateBasedRulesResponse
ReadS [ListRateBasedRulesResponse]
(Int -> ReadS ListRateBasedRulesResponse)
-> ReadS [ListRateBasedRulesResponse]
-> ReadPrec ListRateBasedRulesResponse
-> ReadPrec [ListRateBasedRulesResponse]
-> Read ListRateBasedRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRateBasedRulesResponse]
$creadListPrec :: ReadPrec [ListRateBasedRulesResponse]
readPrec :: ReadPrec ListRateBasedRulesResponse
$creadPrec :: ReadPrec ListRateBasedRulesResponse
readList :: ReadS [ListRateBasedRulesResponse]
$creadList :: ReadS [ListRateBasedRulesResponse]
readsPrec :: Int -> ReadS ListRateBasedRulesResponse
$creadsPrec :: Int -> ReadS ListRateBasedRulesResponse
Prelude.Read, Int -> ListRateBasedRulesResponse -> ShowS
[ListRateBasedRulesResponse] -> ShowS
ListRateBasedRulesResponse -> String
(Int -> ListRateBasedRulesResponse -> ShowS)
-> (ListRateBasedRulesResponse -> String)
-> ([ListRateBasedRulesResponse] -> ShowS)
-> Show ListRateBasedRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRateBasedRulesResponse] -> ShowS
$cshowList :: [ListRateBasedRulesResponse] -> ShowS
show :: ListRateBasedRulesResponse -> String
$cshow :: ListRateBasedRulesResponse -> String
showsPrec :: Int -> ListRateBasedRulesResponse -> ShowS
$cshowsPrec :: Int -> ListRateBasedRulesResponse -> ShowS
Prelude.Show, (forall x.
ListRateBasedRulesResponse -> Rep ListRateBasedRulesResponse x)
-> (forall x.
Rep ListRateBasedRulesResponse x -> ListRateBasedRulesResponse)
-> Generic ListRateBasedRulesResponse
forall x.
Rep ListRateBasedRulesResponse x -> ListRateBasedRulesResponse
forall x.
ListRateBasedRulesResponse -> Rep ListRateBasedRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListRateBasedRulesResponse x -> ListRateBasedRulesResponse
$cfrom :: forall x.
ListRateBasedRulesResponse -> Rep ListRateBasedRulesResponse x
Prelude.Generic)
newListRateBasedRulesResponse ::
Prelude.Int ->
ListRateBasedRulesResponse
newListRateBasedRulesResponse :: Int -> ListRateBasedRulesResponse
newListRateBasedRulesResponse Int
pHttpStatus_ =
ListRateBasedRulesResponse' :: Maybe [RuleSummary]
-> Maybe Text -> Int -> ListRateBasedRulesResponse
ListRateBasedRulesResponse'
{ $sel:rules:ListRateBasedRulesResponse' :: Maybe [RuleSummary]
rules =
Maybe [RuleSummary]
forall a. Maybe a
Prelude.Nothing,
$sel:nextMarker:ListRateBasedRulesResponse' :: Maybe Text
nextMarker = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListRateBasedRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listRateBasedRulesResponse_rules :: Lens.Lens' ListRateBasedRulesResponse (Prelude.Maybe [RuleSummary])
listRateBasedRulesResponse_rules :: (Maybe [RuleSummary] -> f (Maybe [RuleSummary]))
-> ListRateBasedRulesResponse -> f ListRateBasedRulesResponse
listRateBasedRulesResponse_rules = (ListRateBasedRulesResponse -> Maybe [RuleSummary])
-> (ListRateBasedRulesResponse
-> Maybe [RuleSummary] -> ListRateBasedRulesResponse)
-> Lens
ListRateBasedRulesResponse
ListRateBasedRulesResponse
(Maybe [RuleSummary])
(Maybe [RuleSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRateBasedRulesResponse' {Maybe [RuleSummary]
rules :: Maybe [RuleSummary]
$sel:rules:ListRateBasedRulesResponse' :: ListRateBasedRulesResponse -> Maybe [RuleSummary]
rules} -> Maybe [RuleSummary]
rules) (\s :: ListRateBasedRulesResponse
s@ListRateBasedRulesResponse' {} Maybe [RuleSummary]
a -> ListRateBasedRulesResponse
s {$sel:rules:ListRateBasedRulesResponse' :: Maybe [RuleSummary]
rules = Maybe [RuleSummary]
a} :: ListRateBasedRulesResponse) ((Maybe [RuleSummary] -> f (Maybe [RuleSummary]))
-> ListRateBasedRulesResponse -> f ListRateBasedRulesResponse)
-> ((Maybe [RuleSummary] -> f (Maybe [RuleSummary]))
-> Maybe [RuleSummary] -> f (Maybe [RuleSummary]))
-> (Maybe [RuleSummary] -> f (Maybe [RuleSummary]))
-> ListRateBasedRulesResponse
-> f ListRateBasedRulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RuleSummary] [RuleSummary] [RuleSummary] [RuleSummary]
-> Iso
(Maybe [RuleSummary])
(Maybe [RuleSummary])
(Maybe [RuleSummary])
(Maybe [RuleSummary])
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 [RuleSummary] [RuleSummary] [RuleSummary] [RuleSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listRateBasedRulesResponse_nextMarker :: Lens.Lens' ListRateBasedRulesResponse (Prelude.Maybe Prelude.Text)
listRateBasedRulesResponse_nextMarker :: (Maybe Text -> f (Maybe Text))
-> ListRateBasedRulesResponse -> f ListRateBasedRulesResponse
listRateBasedRulesResponse_nextMarker = (ListRateBasedRulesResponse -> Maybe Text)
-> (ListRateBasedRulesResponse
-> Maybe Text -> ListRateBasedRulesResponse)
-> Lens
ListRateBasedRulesResponse
ListRateBasedRulesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRateBasedRulesResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListRateBasedRulesResponse' :: ListRateBasedRulesResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListRateBasedRulesResponse
s@ListRateBasedRulesResponse' {} Maybe Text
a -> ListRateBasedRulesResponse
s {$sel:nextMarker:ListRateBasedRulesResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListRateBasedRulesResponse)
listRateBasedRulesResponse_httpStatus :: Lens.Lens' ListRateBasedRulesResponse Prelude.Int
listRateBasedRulesResponse_httpStatus :: (Int -> f Int)
-> ListRateBasedRulesResponse -> f ListRateBasedRulesResponse
listRateBasedRulesResponse_httpStatus = (ListRateBasedRulesResponse -> Int)
-> (ListRateBasedRulesResponse
-> Int -> ListRateBasedRulesResponse)
-> Lens
ListRateBasedRulesResponse ListRateBasedRulesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRateBasedRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListRateBasedRulesResponse' :: ListRateBasedRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListRateBasedRulesResponse
s@ListRateBasedRulesResponse' {} Int
a -> ListRateBasedRulesResponse
s {$sel:httpStatus:ListRateBasedRulesResponse' :: Int
httpStatus = Int
a} :: ListRateBasedRulesResponse)
instance Prelude.NFData ListRateBasedRulesResponse