{-# 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.ListDetectors
(
ListDetectors (..),
newListDetectors,
listDetectors_nextToken,
listDetectors_maxResults,
ListDetectorsResponse (..),
newListDetectorsResponse,
listDetectorsResponse_nextToken,
listDetectorsResponse_httpStatus,
listDetectorsResponse_detectorIds,
)
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 ListDetectors = ListDetectors'
{
ListDetectors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDetectors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListDetectors -> ListDetectors -> Bool
(ListDetectors -> ListDetectors -> Bool)
-> (ListDetectors -> ListDetectors -> Bool) -> Eq ListDetectors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDetectors -> ListDetectors -> Bool
$c/= :: ListDetectors -> ListDetectors -> Bool
== :: ListDetectors -> ListDetectors -> Bool
$c== :: ListDetectors -> ListDetectors -> Bool
Prelude.Eq, ReadPrec [ListDetectors]
ReadPrec ListDetectors
Int -> ReadS ListDetectors
ReadS [ListDetectors]
(Int -> ReadS ListDetectors)
-> ReadS [ListDetectors]
-> ReadPrec ListDetectors
-> ReadPrec [ListDetectors]
-> Read ListDetectors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDetectors]
$creadListPrec :: ReadPrec [ListDetectors]
readPrec :: ReadPrec ListDetectors
$creadPrec :: ReadPrec ListDetectors
readList :: ReadS [ListDetectors]
$creadList :: ReadS [ListDetectors]
readsPrec :: Int -> ReadS ListDetectors
$creadsPrec :: Int -> ReadS ListDetectors
Prelude.Read, Int -> ListDetectors -> ShowS
[ListDetectors] -> ShowS
ListDetectors -> String
(Int -> ListDetectors -> ShowS)
-> (ListDetectors -> String)
-> ([ListDetectors] -> ShowS)
-> Show ListDetectors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDetectors] -> ShowS
$cshowList :: [ListDetectors] -> ShowS
show :: ListDetectors -> String
$cshow :: ListDetectors -> String
showsPrec :: Int -> ListDetectors -> ShowS
$cshowsPrec :: Int -> ListDetectors -> ShowS
Prelude.Show, (forall x. ListDetectors -> Rep ListDetectors x)
-> (forall x. Rep ListDetectors x -> ListDetectors)
-> Generic ListDetectors
forall x. Rep ListDetectors x -> ListDetectors
forall x. ListDetectors -> Rep ListDetectors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDetectors x -> ListDetectors
$cfrom :: forall x. ListDetectors -> Rep ListDetectors x
Prelude.Generic)
newListDetectors ::
ListDetectors
newListDetectors :: ListDetectors
newListDetectors =
ListDetectors' :: Maybe Text -> Maybe Natural -> ListDetectors
ListDetectors'
{ $sel:nextToken:ListDetectors' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListDetectors' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listDetectors_nextToken :: Lens.Lens' ListDetectors (Prelude.Maybe Prelude.Text)
listDetectors_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListDetectors -> f ListDetectors
listDetectors_nextToken = (ListDetectors -> Maybe Text)
-> (ListDetectors -> Maybe Text -> ListDetectors)
-> Lens ListDetectors ListDetectors (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectors' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDetectors' :: ListDetectors -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDetectors
s@ListDetectors' {} Maybe Text
a -> ListDetectors
s {$sel:nextToken:ListDetectors' :: Maybe Text
nextToken = Maybe Text
a} :: ListDetectors)
listDetectors_maxResults :: Lens.Lens' ListDetectors (Prelude.Maybe Prelude.Natural)
listDetectors_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListDetectors -> f ListDetectors
listDetectors_maxResults = (ListDetectors -> Maybe Natural)
-> (ListDetectors -> Maybe Natural -> ListDetectors)
-> Lens ListDetectors ListDetectors (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectors' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListDetectors' :: ListDetectors -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListDetectors
s@ListDetectors' {} Maybe Natural
a -> ListDetectors
s {$sel:maxResults:ListDetectors' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListDetectors)
instance Core.AWSPager ListDetectors where
page :: ListDetectors -> AWSResponse ListDetectors -> Maybe ListDetectors
page ListDetectors
rq AWSResponse ListDetectors
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDetectors
ListDetectorsResponse
rs
ListDetectorsResponse
-> Getting (First Text) ListDetectorsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDetectorsResponse
-> Const (First Text) ListDetectorsResponse
Lens' ListDetectorsResponse (Maybe Text)
listDetectorsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListDetectorsResponse
-> Const (First Text) ListDetectorsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDetectorsResponse 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 ListDetectors
forall a. Maybe a
Prelude.Nothing
| [Text] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
(AWSResponse ListDetectors
ListDetectorsResponse
rs ListDetectorsResponse
-> Getting [Text] ListDetectorsResponse [Text] -> [Text]
forall s a. s -> Getting a s a -> a
Lens.^. Getting [Text] ListDetectorsResponse [Text]
Lens' ListDetectorsResponse [Text]
listDetectorsResponse_detectorIds) =
Maybe ListDetectors
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListDetectors -> Maybe ListDetectors
forall a. a -> Maybe a
Prelude.Just (ListDetectors -> Maybe ListDetectors)
-> ListDetectors -> Maybe ListDetectors
forall a b. (a -> b) -> a -> b
Prelude.$
ListDetectors
rq
ListDetectors -> (ListDetectors -> ListDetectors) -> ListDetectors
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListDetectors -> Identity ListDetectors
Lens ListDetectors ListDetectors (Maybe Text) (Maybe Text)
listDetectors_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListDetectors -> Identity ListDetectors)
-> Maybe Text -> ListDetectors -> ListDetectors
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDetectors
ListDetectorsResponse
rs
ListDetectorsResponse
-> Getting (First Text) ListDetectorsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListDetectorsResponse
-> Const (First Text) ListDetectorsResponse
Lens' ListDetectorsResponse (Maybe Text)
listDetectorsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListDetectorsResponse
-> Const (First Text) ListDetectorsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListDetectorsResponse 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 ListDetectors where
type
AWSResponse ListDetectors =
ListDetectorsResponse
request :: ListDetectors -> Request ListDetectors
request = Service -> ListDetectors -> Request ListDetectors
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListDetectors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDetectors)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListDetectors))
-> Logger
-> Service
-> Proxy ListDetectors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDetectors)))
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] -> ListDetectorsResponse
ListDetectorsResponse'
(Maybe Text -> Int -> [Text] -> ListDetectorsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> [Text] -> ListDetectorsResponse)
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] -> ListDetectorsResponse)
-> Either String Int
-> Either String ([Text] -> ListDetectorsResponse)
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] -> ListDetectorsResponse)
-> Either String [Text] -> Either String ListDetectorsResponse
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
"detectorIds" 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 ListDetectors
instance Prelude.NFData ListDetectors
instance Core.ToHeaders ListDetectors where
toHeaders :: ListDetectors -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListDetectors -> 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 ListDetectors where
toPath :: ListDetectors -> ByteString
toPath = ByteString -> ListDetectors -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/detector"
instance Core.ToQuery ListDetectors where
toQuery :: ListDetectors -> QueryString
toQuery ListDetectors' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListDetectors' :: ListDetectors -> Maybe Natural
$sel:nextToken:ListDetectors' :: ListDetectors -> 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 ListDetectorsResponse = ListDetectorsResponse'
{
ListDetectorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListDetectorsResponse -> Int
httpStatus :: Prelude.Int,
ListDetectorsResponse -> [Text]
detectorIds :: [Prelude.Text]
}
deriving (ListDetectorsResponse -> ListDetectorsResponse -> Bool
(ListDetectorsResponse -> ListDetectorsResponse -> Bool)
-> (ListDetectorsResponse -> ListDetectorsResponse -> Bool)
-> Eq ListDetectorsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListDetectorsResponse -> ListDetectorsResponse -> Bool
$c/= :: ListDetectorsResponse -> ListDetectorsResponse -> Bool
== :: ListDetectorsResponse -> ListDetectorsResponse -> Bool
$c== :: ListDetectorsResponse -> ListDetectorsResponse -> Bool
Prelude.Eq, ReadPrec [ListDetectorsResponse]
ReadPrec ListDetectorsResponse
Int -> ReadS ListDetectorsResponse
ReadS [ListDetectorsResponse]
(Int -> ReadS ListDetectorsResponse)
-> ReadS [ListDetectorsResponse]
-> ReadPrec ListDetectorsResponse
-> ReadPrec [ListDetectorsResponse]
-> Read ListDetectorsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListDetectorsResponse]
$creadListPrec :: ReadPrec [ListDetectorsResponse]
readPrec :: ReadPrec ListDetectorsResponse
$creadPrec :: ReadPrec ListDetectorsResponse
readList :: ReadS [ListDetectorsResponse]
$creadList :: ReadS [ListDetectorsResponse]
readsPrec :: Int -> ReadS ListDetectorsResponse
$creadsPrec :: Int -> ReadS ListDetectorsResponse
Prelude.Read, Int -> ListDetectorsResponse -> ShowS
[ListDetectorsResponse] -> ShowS
ListDetectorsResponse -> String
(Int -> ListDetectorsResponse -> ShowS)
-> (ListDetectorsResponse -> String)
-> ([ListDetectorsResponse] -> ShowS)
-> Show ListDetectorsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListDetectorsResponse] -> ShowS
$cshowList :: [ListDetectorsResponse] -> ShowS
show :: ListDetectorsResponse -> String
$cshow :: ListDetectorsResponse -> String
showsPrec :: Int -> ListDetectorsResponse -> ShowS
$cshowsPrec :: Int -> ListDetectorsResponse -> ShowS
Prelude.Show, (forall x. ListDetectorsResponse -> Rep ListDetectorsResponse x)
-> (forall x. Rep ListDetectorsResponse x -> ListDetectorsResponse)
-> Generic ListDetectorsResponse
forall x. Rep ListDetectorsResponse x -> ListDetectorsResponse
forall x. ListDetectorsResponse -> Rep ListDetectorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListDetectorsResponse x -> ListDetectorsResponse
$cfrom :: forall x. ListDetectorsResponse -> Rep ListDetectorsResponse x
Prelude.Generic)
newListDetectorsResponse ::
Prelude.Int ->
ListDetectorsResponse
newListDetectorsResponse :: Int -> ListDetectorsResponse
newListDetectorsResponse Int
pHttpStatus_ =
ListDetectorsResponse' :: Maybe Text -> Int -> [Text] -> ListDetectorsResponse
ListDetectorsResponse'
{ $sel:nextToken:ListDetectorsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDetectorsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:detectorIds:ListDetectorsResponse' :: [Text]
detectorIds = [Text]
forall a. Monoid a => a
Prelude.mempty
}
listDetectorsResponse_nextToken :: Lens.Lens' ListDetectorsResponse (Prelude.Maybe Prelude.Text)
listDetectorsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListDetectorsResponse -> f ListDetectorsResponse
listDetectorsResponse_nextToken = (ListDetectorsResponse -> Maybe Text)
-> (ListDetectorsResponse -> Maybe Text -> ListDetectorsResponse)
-> Lens' ListDetectorsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectorsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListDetectorsResponse' :: ListDetectorsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListDetectorsResponse
s@ListDetectorsResponse' {} Maybe Text
a -> ListDetectorsResponse
s {$sel:nextToken:ListDetectorsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListDetectorsResponse)
listDetectorsResponse_httpStatus :: Lens.Lens' ListDetectorsResponse Prelude.Int
listDetectorsResponse_httpStatus :: (Int -> f Int) -> ListDetectorsResponse -> f ListDetectorsResponse
listDetectorsResponse_httpStatus = (ListDetectorsResponse -> Int)
-> (ListDetectorsResponse -> Int -> ListDetectorsResponse)
-> Lens ListDetectorsResponse ListDetectorsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectorsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListDetectorsResponse' :: ListDetectorsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListDetectorsResponse
s@ListDetectorsResponse' {} Int
a -> ListDetectorsResponse
s {$sel:httpStatus:ListDetectorsResponse' :: Int
httpStatus = Int
a} :: ListDetectorsResponse)
listDetectorsResponse_detectorIds :: Lens.Lens' ListDetectorsResponse [Prelude.Text]
listDetectorsResponse_detectorIds :: ([Text] -> f [Text])
-> ListDetectorsResponse -> f ListDetectorsResponse
listDetectorsResponse_detectorIds = (ListDetectorsResponse -> [Text])
-> (ListDetectorsResponse -> [Text] -> ListDetectorsResponse)
-> Lens' ListDetectorsResponse [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListDetectorsResponse' {[Text]
detectorIds :: [Text]
$sel:detectorIds:ListDetectorsResponse' :: ListDetectorsResponse -> [Text]
detectorIds} -> [Text]
detectorIds) (\s :: ListDetectorsResponse
s@ListDetectorsResponse' {} [Text]
a -> ListDetectorsResponse
s {$sel:detectorIds:ListDetectorsResponse' :: [Text]
detectorIds = [Text]
a} :: ListDetectorsResponse) (([Text] -> f [Text])
-> ListDetectorsResponse -> f ListDetectorsResponse)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> ListDetectorsResponse
-> f ListDetectorsResponse
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 ListDetectorsResponse