{-# 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.GuardDuty.ListIPSets
(
ListIPSets (..),
newListIPSets,
listIPSets_nextToken,
listIPSets_maxResults,
listIPSets_detectorId,
ListIPSetsResponse (..),
newListIPSetsResponse,
listIPSetsResponse_nextToken,
listIPSetsResponse_httpStatus,
listIPSetsResponse_ipSetIds,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListIPSets = ListIPSets'
{
ListIPSets -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListIPSets -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListIPSets -> Text
detectorId :: Prelude.Text
}
deriving (ListIPSets -> ListIPSets -> Bool
(ListIPSets -> ListIPSets -> Bool)
-> (ListIPSets -> ListIPSets -> Bool) -> Eq ListIPSets
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]
(Int -> ReadS ListIPSets)
-> ReadS [ListIPSets]
-> ReadPrec ListIPSets
-> ReadPrec [ListIPSets]
-> Read 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
(Int -> ListIPSets -> ShowS)
-> (ListIPSets -> String)
-> ([ListIPSets] -> ShowS)
-> Show ListIPSets
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. ListIPSets -> Rep ListIPSets x)
-> (forall x. Rep ListIPSets x -> ListIPSets) -> Generic ListIPSets
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 ::
Prelude.Text ->
ListIPSets
newListIPSets :: Text -> ListIPSets
newListIPSets Text
pDetectorId_ =
ListIPSets' :: Maybe Text -> Maybe Natural -> Text -> ListIPSets
ListIPSets'
{ $sel:nextToken:ListIPSets' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListIPSets' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:ListIPSets' :: Text
detectorId = Text
pDetectorId_
}
listIPSets_nextToken :: Lens.Lens' ListIPSets (Prelude.Maybe Prelude.Text)
listIPSets_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListIPSets -> f ListIPSets
listIPSets_nextToken = (ListIPSets -> Maybe Text)
-> (ListIPSets -> Maybe Text -> ListIPSets)
-> Lens ListIPSets ListIPSets (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSets' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListIPSets' :: ListIPSets -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListIPSets
s@ListIPSets' {} Maybe Text
a -> ListIPSets
s {$sel:nextToken:ListIPSets' :: Maybe Text
nextToken = Maybe Text
a} :: ListIPSets)
listIPSets_maxResults :: Lens.Lens' ListIPSets (Prelude.Maybe Prelude.Natural)
listIPSets_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListIPSets -> f ListIPSets
listIPSets_maxResults = (ListIPSets -> Maybe Natural)
-> (ListIPSets -> Maybe Natural -> ListIPSets)
-> Lens ListIPSets ListIPSets (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSets' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListIPSets' :: ListIPSets -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListIPSets
s@ListIPSets' {} Maybe Natural
a -> ListIPSets
s {$sel:maxResults:ListIPSets' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListIPSets)
listIPSets_detectorId :: Lens.Lens' ListIPSets Prelude.Text
listIPSets_detectorId :: (Text -> f Text) -> ListIPSets -> f ListIPSets
listIPSets_detectorId = (ListIPSets -> Text)
-> (ListIPSets -> Text -> ListIPSets)
-> Lens ListIPSets ListIPSets Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSets' {Text
detectorId :: Text
$sel:detectorId:ListIPSets' :: ListIPSets -> Text
detectorId} -> Text
detectorId) (\s :: ListIPSets
s@ListIPSets' {} Text
a -> ListIPSets
s {$sel:detectorId:ListIPSets' :: Text
detectorId = Text
a} :: ListIPSets)
instance Core.AWSPager ListIPSets where
page :: ListIPSets -> AWSResponse ListIPSets -> Maybe ListIPSets
page ListIPSets
rq AWSResponse ListIPSets
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListIPSets
ListIPSetsResponse
rs
ListIPSetsResponse
-> Getting (First Text) ListIPSetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListIPSetsResponse -> Const (First Text) ListIPSetsResponse
Lens' ListIPSetsResponse (Maybe Text)
listIPSetsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListIPSetsResponse -> Const (First Text) ListIPSetsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListIPSetsResponse 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 ListIPSets
forall a. Maybe a
Prelude.Nothing
| [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop (AWSResponse ListIPSets
ListIPSetsResponse
rs ListIPSetsResponse
-> Getting [Text] ListIPSetsResponse [Text] -> [Text]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Text] ListIPSetsResponse [Text]
Lens' ListIPSetsResponse [Text]
listIPSetsResponse_ipSetIds) =
Maybe ListIPSets
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListIPSets -> Maybe ListIPSets
forall a. a -> Maybe a
Prelude.Just (ListIPSets -> Maybe ListIPSets) -> ListIPSets -> Maybe ListIPSets
forall a b. (a -> b) -> a -> b
Prelude.$
ListIPSets
rq
ListIPSets -> (ListIPSets -> ListIPSets) -> ListIPSets
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListIPSets -> Identity ListIPSets
Lens ListIPSets ListIPSets (Maybe Text) (Maybe Text)
listIPSets_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListIPSets -> Identity ListIPSets)
-> Maybe Text -> ListIPSets -> ListIPSets
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListIPSets
ListIPSetsResponse
rs
ListIPSetsResponse
-> Getting (First Text) ListIPSetsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListIPSetsResponse -> Const (First Text) ListIPSetsResponse
Lens' ListIPSetsResponse (Maybe Text)
listIPSetsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListIPSetsResponse -> Const (First Text) ListIPSetsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListIPSetsResponse 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 ListIPSets where
type AWSResponse ListIPSets = ListIPSetsResponse
request :: ListIPSets -> Request ListIPSets
request = Service -> ListIPSets -> Request ListIPSets
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListIPSets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListIPSets)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListIPSets))
-> Logger
-> Service
-> Proxy ListIPSets
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListIPSets)))
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 -> Int -> [Text] -> ListIPSetsResponse
ListIPSetsResponse'
(Maybe Text -> Int -> [Text] -> ListIPSetsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Text] -> ListIPSetsResponse)
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
"nextToken")
Either String (Int -> [Text] -> ListIPSetsResponse)
-> Either String Int
-> Either String ([Text] -> ListIPSetsResponse)
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))
Either String ([Text] -> ListIPSetsResponse)
-> Either String [Text] -> Either String ListIPSetsResponse
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
"ipSetIds" Either String (Maybe [Text]) -> [Text] -> Either String [Text]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Text]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListIPSets
instance Prelude.NFData ListIPSets
instance Core.ToHeaders ListIPSets where
toHeaders :: ListIPSets -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListIPSets -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath ListIPSets where
toPath :: ListIPSets -> ByteString
toPath ListIPSets' {Maybe Natural
Maybe Text
Text
detectorId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:detectorId:ListIPSets' :: ListIPSets -> Text
$sel:maxResults:ListIPSets' :: ListIPSets -> Maybe Natural
$sel:nextToken:ListIPSets' :: ListIPSets -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/detector/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
detectorId, ByteString
"/ipset"]
instance Core.ToQuery ListIPSets where
toQuery :: ListIPSets -> QueryString
toQuery ListIPSets' {Maybe Natural
Maybe Text
Text
detectorId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:detectorId:ListIPSets' :: ListIPSets -> Text
$sel:maxResults:ListIPSets' :: ListIPSets -> Maybe Natural
$sel:nextToken:ListIPSets' :: ListIPSets -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListIPSetsResponse = ListIPSetsResponse'
{
ListIPSetsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListIPSetsResponse -> Int
httpStatus :: Prelude.Int,
ListIPSetsResponse -> [Text]
ipSetIds :: [Prelude.Text]
}
deriving (ListIPSetsResponse -> ListIPSetsResponse -> Bool
(ListIPSetsResponse -> ListIPSetsResponse -> Bool)
-> (ListIPSetsResponse -> ListIPSetsResponse -> Bool)
-> Eq ListIPSetsResponse
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]
(Int -> ReadS ListIPSetsResponse)
-> ReadS [ListIPSetsResponse]
-> ReadPrec ListIPSetsResponse
-> ReadPrec [ListIPSetsResponse]
-> Read 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
(Int -> ListIPSetsResponse -> ShowS)
-> (ListIPSetsResponse -> String)
-> ([ListIPSetsResponse] -> ShowS)
-> Show ListIPSetsResponse
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. ListIPSetsResponse -> Rep ListIPSetsResponse x)
-> (forall x. Rep ListIPSetsResponse x -> ListIPSetsResponse)
-> Generic ListIPSetsResponse
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' :: Maybe Text -> Int -> [Text] -> ListIPSetsResponse
ListIPSetsResponse'
{ $sel:nextToken:ListIPSetsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListIPSetsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:ipSetIds:ListIPSetsResponse' :: [Text]
ipSetIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
listIPSetsResponse_nextToken :: Lens.Lens' ListIPSetsResponse (Prelude.Maybe Prelude.Text)
listIPSetsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListIPSetsResponse -> f ListIPSetsResponse
listIPSetsResponse_nextToken = (ListIPSetsResponse -> Maybe Text)
-> (ListIPSetsResponse -> Maybe Text -> ListIPSetsResponse)
-> Lens' ListIPSetsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSetsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListIPSetsResponse' :: ListIPSetsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListIPSetsResponse
s@ListIPSetsResponse' {} Maybe Text
a -> ListIPSetsResponse
s {$sel:nextToken:ListIPSetsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListIPSetsResponse)
listIPSetsResponse_httpStatus :: Lens.Lens' ListIPSetsResponse Prelude.Int
listIPSetsResponse_httpStatus :: (Int -> f Int) -> ListIPSetsResponse -> f ListIPSetsResponse
listIPSetsResponse_httpStatus = (ListIPSetsResponse -> Int)
-> (ListIPSetsResponse -> Int -> ListIPSetsResponse)
-> Lens ListIPSetsResponse ListIPSetsResponse Int Int
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)
listIPSetsResponse_ipSetIds :: Lens.Lens' ListIPSetsResponse [Prelude.Text]
listIPSetsResponse_ipSetIds :: ([Text] -> f [Text]) -> ListIPSetsResponse -> f ListIPSetsResponse
listIPSetsResponse_ipSetIds = (ListIPSetsResponse -> [Text])
-> (ListIPSetsResponse -> [Text] -> ListIPSetsResponse)
-> Lens' ListIPSetsResponse [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListIPSetsResponse' {[Text]
ipSetIds :: [Text]
$sel:ipSetIds:ListIPSetsResponse' :: ListIPSetsResponse -> [Text]
ipSetIds} -> [Text]
ipSetIds) (\s :: ListIPSetsResponse
s@ListIPSetsResponse' {} [Text]
a -> ListIPSetsResponse
s {$sel:ipSetIds:ListIPSetsResponse' :: [Text]
ipSetIds = [Text]
a} :: ListIPSetsResponse) (([Text] -> f [Text])
-> ListIPSetsResponse -> f ListIPSetsResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListIPSetsResponse
-> f ListIPSetsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListIPSetsResponse