{-# 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.WAF.ListIPSets
(
ListIPSets (..),
newListIPSets,
listIPSets_limit,
listIPSets_nextMarker,
ListIPSetsResponse (..),
newListIPSetsResponse,
listIPSetsResponse_iPSets,
listIPSetsResponse_nextMarker,
listIPSetsResponse_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.WAF.Types
data ListIPSets = ListIPSets'
{
ListIPSets -> Maybe Natural
limit :: Prelude.Maybe Prelude.Natural,
ListIPSets -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text
}
deriving (ListIPSets -> ListIPSets -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListIPSets -> ListIPSets -> Bool
$c/= :: ListIPSets -> ListIPSets -> Bool
== :: ListIPSets -> ListIPSets -> Bool
$c== :: ListIPSets -> ListIPSets -> Bool
Prelude.Eq, ReadPrec [ListIPSets]
ReadPrec ListIPSets
Int -> ReadS ListIPSets
ReadS [ListIPSets]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListIPSets]
$creadListPrec :: ReadPrec [ListIPSets]
readPrec :: ReadPrec ListIPSets
$creadPrec :: ReadPrec ListIPSets
readList :: ReadS [ListIPSets]
$creadList :: ReadS [ListIPSets]
readsPrec :: Int -> ReadS ListIPSets
$creadsPrec :: Int -> ReadS ListIPSets
Prelude.Read, Int -> ListIPSets -> ShowS
[ListIPSets] -> ShowS
ListIPSets -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListIPSets] -> ShowS
$cshowList :: [ListIPSets] -> ShowS
show :: ListIPSets -> String
$cshow :: ListIPSets -> String
showsPrec :: Int -> ListIPSets -> ShowS
$cshowsPrec :: Int -> ListIPSets -> ShowS
Prelude.Show, forall x. Rep ListIPSets x -> ListIPSets
forall x. ListIPSets -> Rep ListIPSets x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListIPSets x -> ListIPSets
$cfrom :: forall x. ListIPSets -> Rep ListIPSets x
Prelude.Generic)
newListIPSets ::
ListIPSets
newListIPSets :: ListIPSets
newListIPSets =
ListIPSets'
{ $sel:limit:ListIPSets' :: Maybe Natural
limit = forall a. Maybe a
Prelude.Nothing,
$sel:nextMarker:ListIPSets' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing
}
listIPSets_limit :: Lens.Lens' ListIPSets (Prelude.Maybe Prelude.Natural)
listIPSets_limit :: Lens' ListIPSets (Maybe Natural)
listIPSets_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSets' {Maybe Natural
limit :: Maybe Natural
$sel:limit:ListIPSets' :: ListIPSets -> Maybe Natural
limit} -> Maybe Natural
limit) (\s :: ListIPSets
s@ListIPSets' {} Maybe Natural
a -> ListIPSets
s {$sel:limit:ListIPSets' :: Maybe Natural
limit = Maybe Natural
a} :: ListIPSets)
listIPSets_nextMarker :: Lens.Lens' ListIPSets (Prelude.Maybe Prelude.Text)
listIPSets_nextMarker :: Lens' ListIPSets (Maybe Text)
listIPSets_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSets' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListIPSets' :: ListIPSets -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListIPSets
s@ListIPSets' {} Maybe Text
a -> ListIPSets
s {$sel:nextMarker:ListIPSets' :: Maybe Text
nextMarker = Maybe Text
a} :: ListIPSets)
instance Core.AWSPager ListIPSets where
page :: ListIPSets -> AWSResponse ListIPSets -> Maybe ListIPSets
page ListIPSets
rq AWSResponse ListIPSets
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListIPSets
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListIPSetsResponse (Maybe Text)
listIPSetsResponse_nextMarker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListIPSets
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListIPSetsResponse (Maybe [IPSetSummary])
listIPSetsResponse_iPSets
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListIPSets
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListIPSets (Maybe Text)
listIPSets_nextMarker
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListIPSets
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListIPSetsResponse (Maybe Text)
listIPSetsResponse_nextMarker
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListIPSets where
type AWSResponse ListIPSets = ListIPSetsResponse
request :: (Service -> Service) -> ListIPSets -> Request ListIPSets
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 ListIPSets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListIPSets)))
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 [IPSetSummary] -> Maybe Text -> Int -> ListIPSetsResponse
ListIPSetsResponse'
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
"IPSets" 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
"NextMarker")
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 ListIPSets where
hashWithSalt :: Int -> ListIPSets -> Int
hashWithSalt Int
_salt ListIPSets' {Maybe Natural
Maybe Text
nextMarker :: Maybe Text
limit :: Maybe Natural
$sel:nextMarker:ListIPSets' :: ListIPSets -> Maybe Text
$sel:limit:ListIPSets' :: ListIPSets -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextMarker
instance Prelude.NFData ListIPSets where
rnf :: ListIPSets -> ()
rnf ListIPSets' {Maybe Natural
Maybe Text
nextMarker :: Maybe Text
limit :: Maybe Natural
$sel:nextMarker:ListIPSets' :: ListIPSets -> Maybe Text
$sel:limit:ListIPSets' :: ListIPSets -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
instance Data.ToHeaders ListIPSets where
toHeaders :: ListIPSets -> 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_20150824.ListIPSets" :: 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 ListIPSets where
toJSON :: ListIPSets -> Value
toJSON ListIPSets' {Maybe Natural
Maybe Text
nextMarker :: Maybe Text
limit :: Maybe Natural
$sel:nextMarker:ListIPSets' :: ListIPSets -> Maybe Text
$sel:limit:ListIPSets' :: ListIPSets -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Limit" 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 Natural
limit,
(Key
"NextMarker" 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
nextMarker
]
)
instance Data.ToPath ListIPSets where
toPath :: ListIPSets -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListIPSets where
toQuery :: ListIPSets -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListIPSetsResponse = ListIPSetsResponse'
{
ListIPSetsResponse -> Maybe [IPSetSummary]
iPSets :: Prelude.Maybe [IPSetSummary],
ListIPSetsResponse -> Maybe Text
nextMarker :: Prelude.Maybe Prelude.Text,
ListIPSetsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListIPSetsResponse -> ListIPSetsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListIPSetsResponse -> ListIPSetsResponse -> Bool
$c/= :: ListIPSetsResponse -> ListIPSetsResponse -> Bool
== :: ListIPSetsResponse -> ListIPSetsResponse -> Bool
$c== :: ListIPSetsResponse -> ListIPSetsResponse -> Bool
Prelude.Eq, ReadPrec [ListIPSetsResponse]
ReadPrec ListIPSetsResponse
Int -> ReadS ListIPSetsResponse
ReadS [ListIPSetsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListIPSetsResponse]
$creadListPrec :: ReadPrec [ListIPSetsResponse]
readPrec :: ReadPrec ListIPSetsResponse
$creadPrec :: ReadPrec ListIPSetsResponse
readList :: ReadS [ListIPSetsResponse]
$creadList :: ReadS [ListIPSetsResponse]
readsPrec :: Int -> ReadS ListIPSetsResponse
$creadsPrec :: Int -> ReadS ListIPSetsResponse
Prelude.Read, Int -> ListIPSetsResponse -> ShowS
[ListIPSetsResponse] -> ShowS
ListIPSetsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListIPSetsResponse] -> ShowS
$cshowList :: [ListIPSetsResponse] -> ShowS
show :: ListIPSetsResponse -> String
$cshow :: ListIPSetsResponse -> String
showsPrec :: Int -> ListIPSetsResponse -> ShowS
$cshowsPrec :: Int -> ListIPSetsResponse -> ShowS
Prelude.Show, forall x. Rep ListIPSetsResponse x -> ListIPSetsResponse
forall x. ListIPSetsResponse -> Rep ListIPSetsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListIPSetsResponse x -> ListIPSetsResponse
$cfrom :: forall x. ListIPSetsResponse -> Rep ListIPSetsResponse x
Prelude.Generic)
newListIPSetsResponse ::
Prelude.Int ->
ListIPSetsResponse
newListIPSetsResponse :: Int -> ListIPSetsResponse
newListIPSetsResponse Int
pHttpStatus_ =
ListIPSetsResponse'
{ $sel:iPSets:ListIPSetsResponse' :: Maybe [IPSetSummary]
iPSets = forall a. Maybe a
Prelude.Nothing,
$sel:nextMarker:ListIPSetsResponse' :: Maybe Text
nextMarker = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListIPSetsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listIPSetsResponse_iPSets :: Lens.Lens' ListIPSetsResponse (Prelude.Maybe [IPSetSummary])
listIPSetsResponse_iPSets :: Lens' ListIPSetsResponse (Maybe [IPSetSummary])
listIPSetsResponse_iPSets = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSetsResponse' {Maybe [IPSetSummary]
iPSets :: Maybe [IPSetSummary]
$sel:iPSets:ListIPSetsResponse' :: ListIPSetsResponse -> Maybe [IPSetSummary]
iPSets} -> Maybe [IPSetSummary]
iPSets) (\s :: ListIPSetsResponse
s@ListIPSetsResponse' {} Maybe [IPSetSummary]
a -> ListIPSetsResponse
s {$sel:iPSets:ListIPSetsResponse' :: Maybe [IPSetSummary]
iPSets = Maybe [IPSetSummary]
a} :: ListIPSetsResponse) 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
listIPSetsResponse_nextMarker :: Lens.Lens' ListIPSetsResponse (Prelude.Maybe Prelude.Text)
listIPSetsResponse_nextMarker :: Lens' ListIPSetsResponse (Maybe Text)
listIPSetsResponse_nextMarker = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSetsResponse' {Maybe Text
nextMarker :: Maybe Text
$sel:nextMarker:ListIPSetsResponse' :: ListIPSetsResponse -> Maybe Text
nextMarker} -> Maybe Text
nextMarker) (\s :: ListIPSetsResponse
s@ListIPSetsResponse' {} Maybe Text
a -> ListIPSetsResponse
s {$sel:nextMarker:ListIPSetsResponse' :: Maybe Text
nextMarker = Maybe Text
a} :: ListIPSetsResponse)
listIPSetsResponse_httpStatus :: Lens.Lens' ListIPSetsResponse Prelude.Int
listIPSetsResponse_httpStatus :: Lens' ListIPSetsResponse Int
listIPSetsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSetsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListIPSetsResponse' :: ListIPSetsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListIPSetsResponse
s@ListIPSetsResponse' {} Int
a -> ListIPSetsResponse
s {$sel:httpStatus:ListIPSetsResponse' :: Int
httpStatus = Int
a} :: ListIPSetsResponse)
instance Prelude.NFData ListIPSetsResponse where
rnf :: ListIPSetsResponse -> ()
rnf ListIPSetsResponse' {Int
Maybe [IPSetSummary]
Maybe Text
httpStatus :: Int
nextMarker :: Maybe Text
iPSets :: Maybe [IPSetSummary]
$sel:httpStatus:ListIPSetsResponse' :: ListIPSetsResponse -> Int
$sel:nextMarker:ListIPSetsResponse' :: ListIPSetsResponse -> Maybe Text
$sel:iPSets:ListIPSetsResponse' :: ListIPSetsResponse -> Maybe [IPSetSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [IPSetSummary]
iPSets
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextMarker
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus