{-# 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_detectorId,
getDetectors_maxResults,
getDetectors_nextToken,
GetDetectorsResponse (..),
newGetDetectorsResponse,
getDetectorsResponse_detectors,
getDetectorsResponse_nextToken,
getDetectorsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FraudDetector.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetDetectors = GetDetectors'
{
GetDetectors -> Maybe Text
detectorId :: Prelude.Maybe Prelude.Text,
GetDetectors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetDetectors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (GetDetectors -> GetDetectors -> Bool
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]
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
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. 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'
{ $sel:detectorId:GetDetectors' :: Maybe Text
detectorId = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetDetectors' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetDetectors' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
getDetectors_detectorId :: Lens.Lens' GetDetectors (Prelude.Maybe Prelude.Text)
getDetectors_detectorId :: Lens' GetDetectors (Maybe Text)
getDetectors_detectorId = 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 :: Lens' GetDetectors (Maybe Natural)
getDetectors_maxResults = 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)
getDetectors_nextToken :: Lens.Lens' GetDetectors (Prelude.Maybe Prelude.Text)
getDetectors_nextToken :: Lens' GetDetectors (Maybe Text)
getDetectors_nextToken = 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)
instance Core.AWSRequest GetDetectors where
type AWSResponse GetDetectors = GetDetectorsResponse
request :: (Service -> Service) -> GetDetectors -> Request GetDetectors
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 GetDetectors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDetectors)))
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 [Detector] -> Maybe Text -> Int -> GetDetectorsResponse
GetDetectorsResponse'
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
"detectors" 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
"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))
)
instance Prelude.Hashable GetDetectors where
hashWithSalt :: Int -> GetDetectors -> Int
hashWithSalt Int
_salt GetDetectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
detectorId :: Maybe Text
$sel:nextToken:GetDetectors' :: GetDetectors -> Maybe Text
$sel:maxResults:GetDetectors' :: GetDetectors -> Maybe Natural
$sel:detectorId:GetDetectors' :: GetDetectors -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
detectorId
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 GetDetectors where
rnf :: GetDetectors -> ()
rnf GetDetectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
detectorId :: Maybe Text
$sel:nextToken:GetDetectors' :: GetDetectors -> Maybe Text
$sel:maxResults:GetDetectors' :: GetDetectors -> Maybe Natural
$sel:detectorId:GetDetectors' :: GetDetectors -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
detectorId
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 GetDetectors where
toHeaders :: GetDetectors -> 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
"AWSHawksNestServiceFacade.GetDetectors" ::
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 GetDetectors where
toJSON :: GetDetectors -> Value
toJSON GetDetectors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
detectorId :: Maybe Text
$sel:nextToken:GetDetectors' :: GetDetectors -> Maybe Text
$sel:maxResults:GetDetectors' :: GetDetectors -> Maybe Natural
$sel:detectorId:GetDetectors' :: GetDetectors -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"detectorId" 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
detectorId,
(Key
"maxResults" 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
maxResults,
(Key
"nextToken" 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
nextToken
]
)
instance Data.ToPath GetDetectors where
toPath :: GetDetectors -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetDetectors where
toQuery :: GetDetectors -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetDetectorsResponse = GetDetectorsResponse'
{
GetDetectorsResponse -> Maybe [Detector]
detectors :: Prelude.Maybe [Detector],
GetDetectorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetDetectorsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDetectorsResponse -> GetDetectorsResponse -> Bool
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]
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
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. 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'
{ $sel:detectors:GetDetectorsResponse' :: Maybe [Detector]
detectors = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetDetectorsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDetectorsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDetectorsResponse_detectors :: Lens.Lens' GetDetectorsResponse (Prelude.Maybe [Detector])
getDetectorsResponse_detectors :: Lens' GetDetectorsResponse (Maybe [Detector])
getDetectorsResponse_detectors = 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) 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
getDetectorsResponse_nextToken :: Lens.Lens' GetDetectorsResponse (Prelude.Maybe Prelude.Text)
getDetectorsResponse_nextToken :: Lens' GetDetectorsResponse (Maybe Text)
getDetectorsResponse_nextToken = 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_httpStatus :: Lens.Lens' GetDetectorsResponse Prelude.Int
getDetectorsResponse_httpStatus :: Lens' GetDetectorsResponse Int
getDetectorsResponse_httpStatus = 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 where
rnf :: GetDetectorsResponse -> ()
rnf GetDetectorsResponse' {Int
Maybe [Detector]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
detectors :: Maybe [Detector]
$sel:httpStatus:GetDetectorsResponse' :: GetDetectorsResponse -> Int
$sel:nextToken:GetDetectorsResponse' :: GetDetectorsResponse -> Maybe Text
$sel:detectors:GetDetectorsResponse' :: GetDetectorsResponse -> Maybe [Detector]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Detector]
detectors
seq :: forall a b. a -> b -> b
`Prelude.seq` 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