{-# 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.Rekognition.StartFaceDetection
(
StartFaceDetection (..),
newStartFaceDetection,
startFaceDetection_jobTag,
startFaceDetection_notificationChannel,
startFaceDetection_clientRequestToken,
startFaceDetection_faceAttributes,
startFaceDetection_video,
StartFaceDetectionResponse (..),
newStartFaceDetectionResponse,
startFaceDetectionResponse_jobId,
startFaceDetectionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartFaceDetection = StartFaceDetection'
{
StartFaceDetection -> Maybe Text
jobTag :: Prelude.Maybe Prelude.Text,
StartFaceDetection -> Maybe NotificationChannel
notificationChannel :: Prelude.Maybe NotificationChannel,
StartFaceDetection -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
StartFaceDetection -> Maybe FaceAttributes
faceAttributes :: Prelude.Maybe FaceAttributes,
StartFaceDetection -> Video
video :: Video
}
deriving (StartFaceDetection -> StartFaceDetection -> Bool
(StartFaceDetection -> StartFaceDetection -> Bool)
-> (StartFaceDetection -> StartFaceDetection -> Bool)
-> Eq StartFaceDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartFaceDetection -> StartFaceDetection -> Bool
$c/= :: StartFaceDetection -> StartFaceDetection -> Bool
== :: StartFaceDetection -> StartFaceDetection -> Bool
$c== :: StartFaceDetection -> StartFaceDetection -> Bool
Prelude.Eq, ReadPrec [StartFaceDetection]
ReadPrec StartFaceDetection
Int -> ReadS StartFaceDetection
ReadS [StartFaceDetection]
(Int -> ReadS StartFaceDetection)
-> ReadS [StartFaceDetection]
-> ReadPrec StartFaceDetection
-> ReadPrec [StartFaceDetection]
-> Read StartFaceDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartFaceDetection]
$creadListPrec :: ReadPrec [StartFaceDetection]
readPrec :: ReadPrec StartFaceDetection
$creadPrec :: ReadPrec StartFaceDetection
readList :: ReadS [StartFaceDetection]
$creadList :: ReadS [StartFaceDetection]
readsPrec :: Int -> ReadS StartFaceDetection
$creadsPrec :: Int -> ReadS StartFaceDetection
Prelude.Read, Int -> StartFaceDetection -> ShowS
[StartFaceDetection] -> ShowS
StartFaceDetection -> String
(Int -> StartFaceDetection -> ShowS)
-> (StartFaceDetection -> String)
-> ([StartFaceDetection] -> ShowS)
-> Show StartFaceDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartFaceDetection] -> ShowS
$cshowList :: [StartFaceDetection] -> ShowS
show :: StartFaceDetection -> String
$cshow :: StartFaceDetection -> String
showsPrec :: Int -> StartFaceDetection -> ShowS
$cshowsPrec :: Int -> StartFaceDetection -> ShowS
Prelude.Show, (forall x. StartFaceDetection -> Rep StartFaceDetection x)
-> (forall x. Rep StartFaceDetection x -> StartFaceDetection)
-> Generic StartFaceDetection
forall x. Rep StartFaceDetection x -> StartFaceDetection
forall x. StartFaceDetection -> Rep StartFaceDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartFaceDetection x -> StartFaceDetection
$cfrom :: forall x. StartFaceDetection -> Rep StartFaceDetection x
Prelude.Generic)
newStartFaceDetection ::
Video ->
StartFaceDetection
newStartFaceDetection :: Video -> StartFaceDetection
newStartFaceDetection Video
pVideo_ =
StartFaceDetection' :: Maybe Text
-> Maybe NotificationChannel
-> Maybe Text
-> Maybe FaceAttributes
-> Video
-> StartFaceDetection
StartFaceDetection'
{ $sel:jobTag:StartFaceDetection' :: Maybe Text
jobTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:notificationChannel:StartFaceDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
forall a. Maybe a
Prelude.Nothing,
$sel:clientRequestToken:StartFaceDetection' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:faceAttributes:StartFaceDetection' :: Maybe FaceAttributes
faceAttributes = Maybe FaceAttributes
forall a. Maybe a
Prelude.Nothing,
$sel:video:StartFaceDetection' :: Video
video = Video
pVideo_
}
startFaceDetection_jobTag :: Lens.Lens' StartFaceDetection (Prelude.Maybe Prelude.Text)
startFaceDetection_jobTag :: (Maybe Text -> f (Maybe Text))
-> StartFaceDetection -> f StartFaceDetection
startFaceDetection_jobTag = (StartFaceDetection -> Maybe Text)
-> (StartFaceDetection -> Maybe Text -> StartFaceDetection)
-> Lens
StartFaceDetection StartFaceDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFaceDetection' {Maybe Text
jobTag :: Maybe Text
$sel:jobTag:StartFaceDetection' :: StartFaceDetection -> Maybe Text
jobTag} -> Maybe Text
jobTag) (\s :: StartFaceDetection
s@StartFaceDetection' {} Maybe Text
a -> StartFaceDetection
s {$sel:jobTag:StartFaceDetection' :: Maybe Text
jobTag = Maybe Text
a} :: StartFaceDetection)
startFaceDetection_notificationChannel :: Lens.Lens' StartFaceDetection (Prelude.Maybe NotificationChannel)
startFaceDetection_notificationChannel :: (Maybe NotificationChannel -> f (Maybe NotificationChannel))
-> StartFaceDetection -> f StartFaceDetection
startFaceDetection_notificationChannel = (StartFaceDetection -> Maybe NotificationChannel)
-> (StartFaceDetection
-> Maybe NotificationChannel -> StartFaceDetection)
-> Lens
StartFaceDetection
StartFaceDetection
(Maybe NotificationChannel)
(Maybe NotificationChannel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFaceDetection' {Maybe NotificationChannel
notificationChannel :: Maybe NotificationChannel
$sel:notificationChannel:StartFaceDetection' :: StartFaceDetection -> Maybe NotificationChannel
notificationChannel} -> Maybe NotificationChannel
notificationChannel) (\s :: StartFaceDetection
s@StartFaceDetection' {} Maybe NotificationChannel
a -> StartFaceDetection
s {$sel:notificationChannel:StartFaceDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
a} :: StartFaceDetection)
startFaceDetection_clientRequestToken :: Lens.Lens' StartFaceDetection (Prelude.Maybe Prelude.Text)
startFaceDetection_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartFaceDetection -> f StartFaceDetection
startFaceDetection_clientRequestToken = (StartFaceDetection -> Maybe Text)
-> (StartFaceDetection -> Maybe Text -> StartFaceDetection)
-> Lens
StartFaceDetection StartFaceDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFaceDetection' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartFaceDetection' :: StartFaceDetection -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartFaceDetection
s@StartFaceDetection' {} Maybe Text
a -> StartFaceDetection
s {$sel:clientRequestToken:StartFaceDetection' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartFaceDetection)
startFaceDetection_faceAttributes :: Lens.Lens' StartFaceDetection (Prelude.Maybe FaceAttributes)
startFaceDetection_faceAttributes :: (Maybe FaceAttributes -> f (Maybe FaceAttributes))
-> StartFaceDetection -> f StartFaceDetection
startFaceDetection_faceAttributes = (StartFaceDetection -> Maybe FaceAttributes)
-> (StartFaceDetection
-> Maybe FaceAttributes -> StartFaceDetection)
-> Lens
StartFaceDetection
StartFaceDetection
(Maybe FaceAttributes)
(Maybe FaceAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFaceDetection' {Maybe FaceAttributes
faceAttributes :: Maybe FaceAttributes
$sel:faceAttributes:StartFaceDetection' :: StartFaceDetection -> Maybe FaceAttributes
faceAttributes} -> Maybe FaceAttributes
faceAttributes) (\s :: StartFaceDetection
s@StartFaceDetection' {} Maybe FaceAttributes
a -> StartFaceDetection
s {$sel:faceAttributes:StartFaceDetection' :: Maybe FaceAttributes
faceAttributes = Maybe FaceAttributes
a} :: StartFaceDetection)
startFaceDetection_video :: Lens.Lens' StartFaceDetection Video
startFaceDetection_video :: (Video -> f Video) -> StartFaceDetection -> f StartFaceDetection
startFaceDetection_video = (StartFaceDetection -> Video)
-> (StartFaceDetection -> Video -> StartFaceDetection)
-> Lens StartFaceDetection StartFaceDetection Video Video
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFaceDetection' {Video
video :: Video
$sel:video:StartFaceDetection' :: StartFaceDetection -> Video
video} -> Video
video) (\s :: StartFaceDetection
s@StartFaceDetection' {} Video
a -> StartFaceDetection
s {$sel:video:StartFaceDetection' :: Video
video = Video
a} :: StartFaceDetection)
instance Core.AWSRequest StartFaceDetection where
type
AWSResponse StartFaceDetection =
StartFaceDetectionResponse
request :: StartFaceDetection -> Request StartFaceDetection
request = Service -> StartFaceDetection -> Request StartFaceDetection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartFaceDetection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartFaceDetection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartFaceDetection))
-> Logger
-> Service
-> Proxy StartFaceDetection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartFaceDetection)))
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 -> StartFaceDetectionResponse
StartFaceDetectionResponse'
(Maybe Text -> Int -> StartFaceDetectionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartFaceDetectionResponse)
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
"JobId")
Either String (Int -> StartFaceDetectionResponse)
-> Either String Int -> Either String StartFaceDetectionResponse
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 StartFaceDetection
instance Prelude.NFData StartFaceDetection
instance Core.ToHeaders StartFaceDetection where
toHeaders :: StartFaceDetection -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartFaceDetection -> 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
"RekognitionService.StartFaceDetection" ::
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 StartFaceDetection where
toJSON :: StartFaceDetection -> Value
toJSON StartFaceDetection' {Maybe Text
Maybe FaceAttributes
Maybe NotificationChannel
Video
video :: Video
faceAttributes :: Maybe FaceAttributes
clientRequestToken :: Maybe Text
notificationChannel :: Maybe NotificationChannel
jobTag :: Maybe Text
$sel:video:StartFaceDetection' :: StartFaceDetection -> Video
$sel:faceAttributes:StartFaceDetection' :: StartFaceDetection -> Maybe FaceAttributes
$sel:clientRequestToken:StartFaceDetection' :: StartFaceDetection -> Maybe Text
$sel:notificationChannel:StartFaceDetection' :: StartFaceDetection -> Maybe NotificationChannel
$sel:jobTag:StartFaceDetection' :: StartFaceDetection -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"JobTag" 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
jobTag,
(Text
"NotificationChannel" Text -> NotificationChannel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(NotificationChannel -> Pair)
-> Maybe NotificationChannel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationChannel
notificationChannel,
(Text
"ClientRequestToken" 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
clientRequestToken,
(Text
"FaceAttributes" Text -> FaceAttributes -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(FaceAttributes -> Pair) -> Maybe FaceAttributes -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FaceAttributes
faceAttributes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Video" Text -> Video -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Video
video)
]
)
instance Core.ToPath StartFaceDetection where
toPath :: StartFaceDetection -> ByteString
toPath = ByteString -> StartFaceDetection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartFaceDetection where
toQuery :: StartFaceDetection -> QueryString
toQuery = QueryString -> StartFaceDetection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartFaceDetectionResponse = StartFaceDetectionResponse'
{
StartFaceDetectionResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
StartFaceDetectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartFaceDetectionResponse -> StartFaceDetectionResponse -> Bool
(StartFaceDetectionResponse -> StartFaceDetectionResponse -> Bool)
-> (StartFaceDetectionResponse
-> StartFaceDetectionResponse -> Bool)
-> Eq StartFaceDetectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartFaceDetectionResponse -> StartFaceDetectionResponse -> Bool
$c/= :: StartFaceDetectionResponse -> StartFaceDetectionResponse -> Bool
== :: StartFaceDetectionResponse -> StartFaceDetectionResponse -> Bool
$c== :: StartFaceDetectionResponse -> StartFaceDetectionResponse -> Bool
Prelude.Eq, ReadPrec [StartFaceDetectionResponse]
ReadPrec StartFaceDetectionResponse
Int -> ReadS StartFaceDetectionResponse
ReadS [StartFaceDetectionResponse]
(Int -> ReadS StartFaceDetectionResponse)
-> ReadS [StartFaceDetectionResponse]
-> ReadPrec StartFaceDetectionResponse
-> ReadPrec [StartFaceDetectionResponse]
-> Read StartFaceDetectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartFaceDetectionResponse]
$creadListPrec :: ReadPrec [StartFaceDetectionResponse]
readPrec :: ReadPrec StartFaceDetectionResponse
$creadPrec :: ReadPrec StartFaceDetectionResponse
readList :: ReadS [StartFaceDetectionResponse]
$creadList :: ReadS [StartFaceDetectionResponse]
readsPrec :: Int -> ReadS StartFaceDetectionResponse
$creadsPrec :: Int -> ReadS StartFaceDetectionResponse
Prelude.Read, Int -> StartFaceDetectionResponse -> ShowS
[StartFaceDetectionResponse] -> ShowS
StartFaceDetectionResponse -> String
(Int -> StartFaceDetectionResponse -> ShowS)
-> (StartFaceDetectionResponse -> String)
-> ([StartFaceDetectionResponse] -> ShowS)
-> Show StartFaceDetectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartFaceDetectionResponse] -> ShowS
$cshowList :: [StartFaceDetectionResponse] -> ShowS
show :: StartFaceDetectionResponse -> String
$cshow :: StartFaceDetectionResponse -> String
showsPrec :: Int -> StartFaceDetectionResponse -> ShowS
$cshowsPrec :: Int -> StartFaceDetectionResponse -> ShowS
Prelude.Show, (forall x.
StartFaceDetectionResponse -> Rep StartFaceDetectionResponse x)
-> (forall x.
Rep StartFaceDetectionResponse x -> StartFaceDetectionResponse)
-> Generic StartFaceDetectionResponse
forall x.
Rep StartFaceDetectionResponse x -> StartFaceDetectionResponse
forall x.
StartFaceDetectionResponse -> Rep StartFaceDetectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartFaceDetectionResponse x -> StartFaceDetectionResponse
$cfrom :: forall x.
StartFaceDetectionResponse -> Rep StartFaceDetectionResponse x
Prelude.Generic)
newStartFaceDetectionResponse ::
Prelude.Int ->
StartFaceDetectionResponse
newStartFaceDetectionResponse :: Int -> StartFaceDetectionResponse
newStartFaceDetectionResponse Int
pHttpStatus_ =
StartFaceDetectionResponse' :: Maybe Text -> Int -> StartFaceDetectionResponse
StartFaceDetectionResponse'
{ $sel:jobId:StartFaceDetectionResponse' :: Maybe Text
jobId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartFaceDetectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startFaceDetectionResponse_jobId :: Lens.Lens' StartFaceDetectionResponse (Prelude.Maybe Prelude.Text)
startFaceDetectionResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> StartFaceDetectionResponse -> f StartFaceDetectionResponse
startFaceDetectionResponse_jobId = (StartFaceDetectionResponse -> Maybe Text)
-> (StartFaceDetectionResponse
-> Maybe Text -> StartFaceDetectionResponse)
-> Lens
StartFaceDetectionResponse
StartFaceDetectionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFaceDetectionResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartFaceDetectionResponse' :: StartFaceDetectionResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartFaceDetectionResponse
s@StartFaceDetectionResponse' {} Maybe Text
a -> StartFaceDetectionResponse
s {$sel:jobId:StartFaceDetectionResponse' :: Maybe Text
jobId = Maybe Text
a} :: StartFaceDetectionResponse)
startFaceDetectionResponse_httpStatus :: Lens.Lens' StartFaceDetectionResponse Prelude.Int
startFaceDetectionResponse_httpStatus :: (Int -> f Int)
-> StartFaceDetectionResponse -> f StartFaceDetectionResponse
startFaceDetectionResponse_httpStatus = (StartFaceDetectionResponse -> Int)
-> (StartFaceDetectionResponse
-> Int -> StartFaceDetectionResponse)
-> Lens
StartFaceDetectionResponse StartFaceDetectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartFaceDetectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartFaceDetectionResponse' :: StartFaceDetectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartFaceDetectionResponse
s@StartFaceDetectionResponse' {} Int
a -> StartFaceDetectionResponse
s {$sel:httpStatus:StartFaceDetectionResponse' :: Int
httpStatus = Int
a} :: StartFaceDetectionResponse)
instance Prelude.NFData StartFaceDetectionResponse