{-# 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_maxResults,
listDetectors_nextToken,
ListDetectorsResponse (..),
newListDetectorsResponse,
listDetectorsResponse_nextToken,
listDetectorsResponse_httpStatus,
listDetectorsResponse_detectorIds,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListDetectors = ListDetectors'
{
ListDetectors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListDetectors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListDetectors -> ListDetectors -> Bool
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]
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
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. 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'
{ $sel:maxResults:ListDetectors' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListDetectors' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listDetectors_maxResults :: Lens.Lens' ListDetectors (Prelude.Maybe Prelude.Natural)
listDetectors_maxResults :: Lens' ListDetectors (Maybe Natural)
listDetectors_maxResults = 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)
listDetectors_nextToken :: Lens.Lens' ListDetectors (Prelude.Maybe Prelude.Text)
listDetectors_nextToken :: Lens' ListDetectors (Maybe Text)
listDetectors_nextToken = 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)
instance Core.AWSPager ListDetectors where
page :: ListDetectors -> AWSResponse ListDetectors -> Maybe ListDetectors
page ListDetectors
rq AWSResponse ListDetectors
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListDetectors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDetectorsResponse (Maybe Text)
listDetectorsResponse_nextToken
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 ListDetectors
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListDetectorsResponse [Text]
listDetectorsResponse_detectorIds) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListDetectors
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListDetectors (Maybe Text)
listDetectors_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListDetectors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListDetectorsResponse (Maybe Text)
listDetectorsResponse_nextToken
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 ListDetectors where
type
AWSResponse ListDetectors =
ListDetectorsResponse
request :: (Service -> Service) -> ListDetectors -> Request ListDetectors
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListDetectors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListDetectors)))
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 Text -> Int -> [Text] -> ListDetectorsResponse
ListDetectorsResponse'
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
"nextToken")
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))
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
"detectorIds" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListDetectors where
hashWithSalt :: Int -> ListDetectors -> Int
hashWithSalt Int
_salt ListDetectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDetectors' :: ListDetectors -> Maybe Text
$sel:maxResults:ListDetectors' :: ListDetectors -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListDetectors where
rnf :: ListDetectors -> ()
rnf ListDetectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDetectors' :: ListDetectors -> Maybe Text
$sel:maxResults:ListDetectors' :: ListDetectors -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListDetectors where
toHeaders :: ListDetectors -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListDetectors where
toPath :: ListDetectors -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/detector"
instance Data.ToQuery ListDetectors where
toQuery :: ListDetectors -> QueryString
toQuery ListDetectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListDetectors' :: ListDetectors -> Maybe Text
$sel:maxResults:ListDetectors' :: ListDetectors -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
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
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]
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
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. 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'
{ $sel:nextToken:ListDetectorsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListDetectorsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:detectorIds:ListDetectorsResponse' :: [Text]
detectorIds = forall a. Monoid a => a
Prelude.mempty
}
listDetectorsResponse_nextToken :: Lens.Lens' ListDetectorsResponse (Prelude.Maybe Prelude.Text)
listDetectorsResponse_nextToken :: Lens' ListDetectorsResponse (Maybe Text)
listDetectorsResponse_nextToken = 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 :: Lens' ListDetectorsResponse Int
listDetectorsResponse_httpStatus = 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 :: Lens' ListDetectorsResponse [Text]
listDetectorsResponse_detectorIds = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData ListDetectorsResponse where
rnf :: ListDetectorsResponse -> ()
rnf ListDetectorsResponse' {Int
[Text]
Maybe Text
detectorIds :: [Text]
httpStatus :: Int
nextToken :: Maybe Text
$sel:detectorIds:ListDetectorsResponse' :: ListDetectorsResponse -> [Text]
$sel:httpStatus:ListDetectorsResponse' :: ListDetectorsResponse -> Int
$sel:nextToken:ListDetectorsResponse' :: ListDetectorsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
detectorIds