{-# 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.FraudDetector.GetDetectors
(
GetDetectors (..),
newGetDetectors,
getDetectors_nextToken,
getDetectors_detectorId,
getDetectors_maxResults,
GetDetectorsResponse (..),
newGetDetectorsResponse,
getDetectorsResponse_nextToken,
getDetectorsResponse_detectors,
getDetectorsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FraudDetector.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 GetDetectors = GetDetectors'
{
GetDetectors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetDetectors -> Maybe Text
detectorId :: Prelude.Maybe Prelude.Text,
GetDetectors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (GetDetectors -> GetDetectors -> Bool
(GetDetectors -> GetDetectors -> Bool)
-> (GetDetectors -> GetDetectors -> Bool) -> Eq GetDetectors
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDetectors -> GetDetectors -> Bool
$c/= :: GetDetectors -> GetDetectors -> Bool
== :: GetDetectors -> GetDetectors -> Bool
$c== :: GetDetectors -> GetDetectors -> Bool
Prelude.Eq, ReadPrec [GetDetectors]
ReadPrec GetDetectors
Int -> ReadS GetDetectors
ReadS [GetDetectors]
(Int -> ReadS GetDetectors)
-> ReadS [GetDetectors]
-> ReadPrec GetDetectors
-> ReadPrec [GetDetectors]
-> Read GetDetectors
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDetectors]
$creadListPrec :: ReadPrec [GetDetectors]
readPrec :: ReadPrec GetDetectors
$creadPrec :: ReadPrec GetDetectors
readList :: ReadS [GetDetectors]
$creadList :: ReadS [GetDetectors]
readsPrec :: Int -> ReadS GetDetectors
$creadsPrec :: Int -> ReadS GetDetectors
Prelude.Read, Int -> GetDetectors -> ShowS
[GetDetectors] -> ShowS
GetDetectors -> String
(Int -> GetDetectors -> ShowS)
-> (GetDetectors -> String)
-> ([GetDetectors] -> ShowS)
-> Show GetDetectors
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDetectors] -> ShowS
$cshowList :: [GetDetectors] -> ShowS
show :: GetDetectors -> String
$cshow :: GetDetectors -> String
showsPrec :: Int -> GetDetectors -> ShowS
$cshowsPrec :: Int -> GetDetectors -> ShowS
Prelude.Show, (forall x. GetDetectors -> Rep GetDetectors x)
-> (forall x. Rep GetDetectors x -> GetDetectors)
-> Generic GetDetectors
forall x. Rep GetDetectors x -> GetDetectors
forall x. GetDetectors -> Rep GetDetectors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDetectors x -> GetDetectors
$cfrom :: forall x. GetDetectors -> Rep GetDetectors x
Prelude.Generic)
newGetDetectors ::
GetDetectors
newGetDetectors :: GetDetectors
newGetDetectors =
GetDetectors' :: Maybe Text -> Maybe Text -> Maybe Natural -> GetDetectors
GetDetectors'
{ $sel:nextToken:GetDetectors' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:detectorId:GetDetectors' :: Maybe Text
detectorId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetDetectors' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
getDetectors_nextToken :: Lens.Lens' GetDetectors (Prelude.Maybe Prelude.Text)
getDetectors_nextToken :: (Maybe Text -> f (Maybe Text)) -> GetDetectors -> f GetDetectors
getDetectors_nextToken = (GetDetectors -> Maybe Text)
-> (GetDetectors -> Maybe Text -> GetDetectors)
-> Lens GetDetectors GetDetectors (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDetectors' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDetectors' :: GetDetectors -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDetectors
s@GetDetectors' {} Maybe Text
a -> GetDetectors
s {$sel:nextToken:GetDetectors' :: Maybe Text
nextToken = Maybe Text
a} :: GetDetectors)
getDetectors_detectorId :: Lens.Lens' GetDetectors (Prelude.Maybe Prelude.Text)
getDetectors_detectorId :: (Maybe Text -> f (Maybe Text)) -> GetDetectors -> f GetDetectors
getDetectors_detectorId = (GetDetectors -> Maybe Text)
-> (GetDetectors -> Maybe Text -> GetDetectors)
-> Lens GetDetectors GetDetectors (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDetectors' {Maybe Text
detectorId :: Maybe Text
$sel:detectorId:GetDetectors' :: GetDetectors -> Maybe Text
detectorId} -> Maybe Text
detectorId) (\s :: GetDetectors
s@GetDetectors' {} Maybe Text
a -> GetDetectors
s {$sel:detectorId:GetDetectors' :: Maybe Text
detectorId = Maybe Text
a} :: GetDetectors)
getDetectors_maxResults :: Lens.Lens' GetDetectors (Prelude.Maybe Prelude.Natural)
getDetectors_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetDetectors -> f GetDetectors
getDetectors_maxResults = (GetDetectors -> Maybe Natural)
-> (GetDetectors -> Maybe Natural -> GetDetectors)
-> Lens GetDetectors GetDetectors (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDetectors' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetDetectors' :: GetDetectors -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetDetectors
s@GetDetectors' {} Maybe Natural
a -> GetDetectors
s {$sel:maxResults:GetDetectors' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetDetectors)
instance Core.AWSRequest GetDetectors where
type AWSResponse GetDetectors = GetDetectorsResponse
request :: GetDetectors -> Request GetDetectors
request = Service -> GetDetectors -> Request GetDetectors
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetDetectors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDetectors)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDetectors))
-> Logger
-> Service
-> Proxy GetDetectors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDetectors)))
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 -> Maybe [Detector] -> Int -> GetDetectorsResponse
GetDetectorsResponse'
(Maybe Text -> Maybe [Detector] -> Int -> GetDetectorsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Detector] -> Int -> GetDetectorsResponse)
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 (Maybe [Detector] -> Int -> GetDetectorsResponse)
-> Either String (Maybe [Detector])
-> Either String (Int -> GetDetectorsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Detector]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"detectors" Either String (Maybe (Maybe [Detector]))
-> Maybe [Detector] -> Either String (Maybe [Detector])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Detector]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetDetectorsResponse)
-> Either String Int -> Either String GetDetectorsResponse
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 GetDetectors
instance Prelude.NFData GetDetectors
instance Core.ToHeaders GetDetectors where
toHeaders :: GetDetectors -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDetectors -> 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
"AWSHawksNestServiceFacade.GetDetectors" ::
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 GetDetectors where
toJSON :: GetDetectors -> Value
toJSON GetDetectors' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
detectorId :: Maybe Text
nextToken :: Maybe Text
$sel:maxResults:GetDetectors' :: GetDetectors -> Maybe Natural
$sel:detectorId:GetDetectors' :: GetDetectors -> Maybe Text
$sel:nextToken:GetDetectors' :: GetDetectors -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"nextToken" 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
nextToken,
(Text
"detectorId" 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
detectorId,
(Text
"maxResults" 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
maxResults
]
)
instance Core.ToPath GetDetectors where
toPath :: GetDetectors -> ByteString
toPath = ByteString -> GetDetectors -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetDetectors where
toQuery :: GetDetectors -> QueryString
toQuery = QueryString -> GetDetectors -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDetectorsResponse = GetDetectorsResponse'
{
GetDetectorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetDetectorsResponse -> Maybe [Detector]
detectors :: Prelude.Maybe [Detector],
GetDetectorsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDetectorsResponse -> GetDetectorsResponse -> Bool
(GetDetectorsResponse -> GetDetectorsResponse -> Bool)
-> (GetDetectorsResponse -> GetDetectorsResponse -> Bool)
-> Eq GetDetectorsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDetectorsResponse -> GetDetectorsResponse -> Bool
$c/= :: GetDetectorsResponse -> GetDetectorsResponse -> Bool
== :: GetDetectorsResponse -> GetDetectorsResponse -> Bool
$c== :: GetDetectorsResponse -> GetDetectorsResponse -> Bool
Prelude.Eq, ReadPrec [GetDetectorsResponse]
ReadPrec GetDetectorsResponse
Int -> ReadS GetDetectorsResponse
ReadS [GetDetectorsResponse]
(Int -> ReadS GetDetectorsResponse)
-> ReadS [GetDetectorsResponse]
-> ReadPrec GetDetectorsResponse
-> ReadPrec [GetDetectorsResponse]
-> Read GetDetectorsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDetectorsResponse]
$creadListPrec :: ReadPrec [GetDetectorsResponse]
readPrec :: ReadPrec GetDetectorsResponse
$creadPrec :: ReadPrec GetDetectorsResponse
readList :: ReadS [GetDetectorsResponse]
$creadList :: ReadS [GetDetectorsResponse]
readsPrec :: Int -> ReadS GetDetectorsResponse
$creadsPrec :: Int -> ReadS GetDetectorsResponse
Prelude.Read, Int -> GetDetectorsResponse -> ShowS
[GetDetectorsResponse] -> ShowS
GetDetectorsResponse -> String
(Int -> GetDetectorsResponse -> ShowS)
-> (GetDetectorsResponse -> String)
-> ([GetDetectorsResponse] -> ShowS)
-> Show GetDetectorsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDetectorsResponse] -> ShowS
$cshowList :: [GetDetectorsResponse] -> ShowS
show :: GetDetectorsResponse -> String
$cshow :: GetDetectorsResponse -> String
showsPrec :: Int -> GetDetectorsResponse -> ShowS
$cshowsPrec :: Int -> GetDetectorsResponse -> ShowS
Prelude.Show, (forall x. GetDetectorsResponse -> Rep GetDetectorsResponse x)
-> (forall x. Rep GetDetectorsResponse x -> GetDetectorsResponse)
-> Generic GetDetectorsResponse
forall x. Rep GetDetectorsResponse x -> GetDetectorsResponse
forall x. GetDetectorsResponse -> Rep GetDetectorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDetectorsResponse x -> GetDetectorsResponse
$cfrom :: forall x. GetDetectorsResponse -> Rep GetDetectorsResponse x
Prelude.Generic)
newGetDetectorsResponse ::
Prelude.Int ->
GetDetectorsResponse
newGetDetectorsResponse :: Int -> GetDetectorsResponse
newGetDetectorsResponse Int
pHttpStatus_ =
GetDetectorsResponse' :: Maybe Text -> Maybe [Detector] -> Int -> GetDetectorsResponse
GetDetectorsResponse'
{ $sel:nextToken:GetDetectorsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:detectors:GetDetectorsResponse' :: Maybe [Detector]
detectors = Maybe [Detector]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDetectorsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDetectorsResponse_nextToken :: Lens.Lens' GetDetectorsResponse (Prelude.Maybe Prelude.Text)
getDetectorsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetDetectorsResponse -> f GetDetectorsResponse
getDetectorsResponse_nextToken = (GetDetectorsResponse -> Maybe Text)
-> (GetDetectorsResponse -> Maybe Text -> GetDetectorsResponse)
-> Lens
GetDetectorsResponse GetDetectorsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDetectorsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDetectorsResponse' :: GetDetectorsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDetectorsResponse
s@GetDetectorsResponse' {} Maybe Text
a -> GetDetectorsResponse
s {$sel:nextToken:GetDetectorsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetDetectorsResponse)
getDetectorsResponse_detectors :: Lens.Lens' GetDetectorsResponse (Prelude.Maybe [Detector])
getDetectorsResponse_detectors :: (Maybe [Detector] -> f (Maybe [Detector]))
-> GetDetectorsResponse -> f GetDetectorsResponse
getDetectorsResponse_detectors = (GetDetectorsResponse -> Maybe [Detector])
-> (GetDetectorsResponse
-> Maybe [Detector] -> GetDetectorsResponse)
-> Lens
GetDetectorsResponse
GetDetectorsResponse
(Maybe [Detector])
(Maybe [Detector])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDetectorsResponse' {Maybe [Detector]
detectors :: Maybe [Detector]
$sel:detectors:GetDetectorsResponse' :: GetDetectorsResponse -> Maybe [Detector]
detectors} -> Maybe [Detector]
detectors) (\s :: GetDetectorsResponse
s@GetDetectorsResponse' {} Maybe [Detector]
a -> GetDetectorsResponse
s {$sel:detectors:GetDetectorsResponse' :: Maybe [Detector]
detectors = Maybe [Detector]
a} :: GetDetectorsResponse) ((Maybe [Detector] -> f (Maybe [Detector]))
-> GetDetectorsResponse -> f GetDetectorsResponse)
-> ((Maybe [Detector] -> f (Maybe [Detector]))
-> Maybe [Detector] -> f (Maybe [Detector]))
-> (Maybe [Detector] -> f (Maybe [Detector]))
-> GetDetectorsResponse
-> f GetDetectorsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Detector] [Detector] [Detector] [Detector]
-> Iso
(Maybe [Detector])
(Maybe [Detector])
(Maybe [Detector])
(Maybe [Detector])
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 [Detector] [Detector] [Detector] [Detector]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getDetectorsResponse_httpStatus :: Lens.Lens' GetDetectorsResponse Prelude.Int
getDetectorsResponse_httpStatus :: (Int -> f Int) -> GetDetectorsResponse -> f GetDetectorsResponse
getDetectorsResponse_httpStatus = (GetDetectorsResponse -> Int)
-> (GetDetectorsResponse -> Int -> GetDetectorsResponse)
-> Lens GetDetectorsResponse GetDetectorsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDetectorsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDetectorsResponse' :: GetDetectorsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDetectorsResponse
s@GetDetectorsResponse' {} Int
a -> GetDetectorsResponse
s {$sel:httpStatus:GetDetectorsResponse' :: Int
httpStatus = Int
a} :: GetDetectorsResponse)
instance Prelude.NFData GetDetectorsResponse