{-# 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.StartLabelDetection
(
StartLabelDetection (..),
newStartLabelDetection,
startLabelDetection_jobTag,
startLabelDetection_notificationChannel,
startLabelDetection_clientRequestToken,
startLabelDetection_minConfidence,
startLabelDetection_video,
StartLabelDetectionResponse (..),
newStartLabelDetectionResponse,
startLabelDetectionResponse_jobId,
startLabelDetectionResponse_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 StartLabelDetection = StartLabelDetection'
{
StartLabelDetection -> Maybe Text
jobTag :: Prelude.Maybe Prelude.Text,
StartLabelDetection -> Maybe NotificationChannel
notificationChannel :: Prelude.Maybe NotificationChannel,
StartLabelDetection -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
StartLabelDetection -> Maybe Double
minConfidence :: Prelude.Maybe Prelude.Double,
StartLabelDetection -> Video
video :: Video
}
deriving (StartLabelDetection -> StartLabelDetection -> Bool
(StartLabelDetection -> StartLabelDetection -> Bool)
-> (StartLabelDetection -> StartLabelDetection -> Bool)
-> Eq StartLabelDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartLabelDetection -> StartLabelDetection -> Bool
$c/= :: StartLabelDetection -> StartLabelDetection -> Bool
== :: StartLabelDetection -> StartLabelDetection -> Bool
$c== :: StartLabelDetection -> StartLabelDetection -> Bool
Prelude.Eq, ReadPrec [StartLabelDetection]
ReadPrec StartLabelDetection
Int -> ReadS StartLabelDetection
ReadS [StartLabelDetection]
(Int -> ReadS StartLabelDetection)
-> ReadS [StartLabelDetection]
-> ReadPrec StartLabelDetection
-> ReadPrec [StartLabelDetection]
-> Read StartLabelDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartLabelDetection]
$creadListPrec :: ReadPrec [StartLabelDetection]
readPrec :: ReadPrec StartLabelDetection
$creadPrec :: ReadPrec StartLabelDetection
readList :: ReadS [StartLabelDetection]
$creadList :: ReadS [StartLabelDetection]
readsPrec :: Int -> ReadS StartLabelDetection
$creadsPrec :: Int -> ReadS StartLabelDetection
Prelude.Read, Int -> StartLabelDetection -> ShowS
[StartLabelDetection] -> ShowS
StartLabelDetection -> String
(Int -> StartLabelDetection -> ShowS)
-> (StartLabelDetection -> String)
-> ([StartLabelDetection] -> ShowS)
-> Show StartLabelDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartLabelDetection] -> ShowS
$cshowList :: [StartLabelDetection] -> ShowS
show :: StartLabelDetection -> String
$cshow :: StartLabelDetection -> String
showsPrec :: Int -> StartLabelDetection -> ShowS
$cshowsPrec :: Int -> StartLabelDetection -> ShowS
Prelude.Show, (forall x. StartLabelDetection -> Rep StartLabelDetection x)
-> (forall x. Rep StartLabelDetection x -> StartLabelDetection)
-> Generic StartLabelDetection
forall x. Rep StartLabelDetection x -> StartLabelDetection
forall x. StartLabelDetection -> Rep StartLabelDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartLabelDetection x -> StartLabelDetection
$cfrom :: forall x. StartLabelDetection -> Rep StartLabelDetection x
Prelude.Generic)
newStartLabelDetection ::
Video ->
StartLabelDetection
newStartLabelDetection :: Video -> StartLabelDetection
newStartLabelDetection Video
pVideo_ =
StartLabelDetection' :: Maybe Text
-> Maybe NotificationChannel
-> Maybe Text
-> Maybe Double
-> Video
-> StartLabelDetection
StartLabelDetection'
{ $sel:jobTag:StartLabelDetection' :: Maybe Text
jobTag = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:notificationChannel:StartLabelDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
forall a. Maybe a
Prelude.Nothing,
$sel:clientRequestToken:StartLabelDetection' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:minConfidence:StartLabelDetection' :: Maybe Double
minConfidence = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:video:StartLabelDetection' :: Video
video = Video
pVideo_
}
startLabelDetection_jobTag :: Lens.Lens' StartLabelDetection (Prelude.Maybe Prelude.Text)
startLabelDetection_jobTag :: (Maybe Text -> f (Maybe Text))
-> StartLabelDetection -> f StartLabelDetection
startLabelDetection_jobTag = (StartLabelDetection -> Maybe Text)
-> (StartLabelDetection -> Maybe Text -> StartLabelDetection)
-> Lens
StartLabelDetection StartLabelDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLabelDetection' {Maybe Text
jobTag :: Maybe Text
$sel:jobTag:StartLabelDetection' :: StartLabelDetection -> Maybe Text
jobTag} -> Maybe Text
jobTag) (\s :: StartLabelDetection
s@StartLabelDetection' {} Maybe Text
a -> StartLabelDetection
s {$sel:jobTag:StartLabelDetection' :: Maybe Text
jobTag = Maybe Text
a} :: StartLabelDetection)
startLabelDetection_notificationChannel :: Lens.Lens' StartLabelDetection (Prelude.Maybe NotificationChannel)
startLabelDetection_notificationChannel :: (Maybe NotificationChannel -> f (Maybe NotificationChannel))
-> StartLabelDetection -> f StartLabelDetection
startLabelDetection_notificationChannel = (StartLabelDetection -> Maybe NotificationChannel)
-> (StartLabelDetection
-> Maybe NotificationChannel -> StartLabelDetection)
-> Lens
StartLabelDetection
StartLabelDetection
(Maybe NotificationChannel)
(Maybe NotificationChannel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLabelDetection' {Maybe NotificationChannel
notificationChannel :: Maybe NotificationChannel
$sel:notificationChannel:StartLabelDetection' :: StartLabelDetection -> Maybe NotificationChannel
notificationChannel} -> Maybe NotificationChannel
notificationChannel) (\s :: StartLabelDetection
s@StartLabelDetection' {} Maybe NotificationChannel
a -> StartLabelDetection
s {$sel:notificationChannel:StartLabelDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
a} :: StartLabelDetection)
startLabelDetection_clientRequestToken :: Lens.Lens' StartLabelDetection (Prelude.Maybe Prelude.Text)
startLabelDetection_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartLabelDetection -> f StartLabelDetection
startLabelDetection_clientRequestToken = (StartLabelDetection -> Maybe Text)
-> (StartLabelDetection -> Maybe Text -> StartLabelDetection)
-> Lens
StartLabelDetection StartLabelDetection (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLabelDetection' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartLabelDetection' :: StartLabelDetection -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartLabelDetection
s@StartLabelDetection' {} Maybe Text
a -> StartLabelDetection
s {$sel:clientRequestToken:StartLabelDetection' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartLabelDetection)
startLabelDetection_minConfidence :: Lens.Lens' StartLabelDetection (Prelude.Maybe Prelude.Double)
startLabelDetection_minConfidence :: (Maybe Double -> f (Maybe Double))
-> StartLabelDetection -> f StartLabelDetection
startLabelDetection_minConfidence = (StartLabelDetection -> Maybe Double)
-> (StartLabelDetection -> Maybe Double -> StartLabelDetection)
-> Lens
StartLabelDetection
StartLabelDetection
(Maybe Double)
(Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLabelDetection' {Maybe Double
minConfidence :: Maybe Double
$sel:minConfidence:StartLabelDetection' :: StartLabelDetection -> Maybe Double
minConfidence} -> Maybe Double
minConfidence) (\s :: StartLabelDetection
s@StartLabelDetection' {} Maybe Double
a -> StartLabelDetection
s {$sel:minConfidence:StartLabelDetection' :: Maybe Double
minConfidence = Maybe Double
a} :: StartLabelDetection)
startLabelDetection_video :: Lens.Lens' StartLabelDetection Video
startLabelDetection_video :: (Video -> f Video) -> StartLabelDetection -> f StartLabelDetection
startLabelDetection_video = (StartLabelDetection -> Video)
-> (StartLabelDetection -> Video -> StartLabelDetection)
-> Lens StartLabelDetection StartLabelDetection Video Video
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLabelDetection' {Video
video :: Video
$sel:video:StartLabelDetection' :: StartLabelDetection -> Video
video} -> Video
video) (\s :: StartLabelDetection
s@StartLabelDetection' {} Video
a -> StartLabelDetection
s {$sel:video:StartLabelDetection' :: Video
video = Video
a} :: StartLabelDetection)
instance Core.AWSRequest StartLabelDetection where
type
AWSResponse StartLabelDetection =
StartLabelDetectionResponse
request :: StartLabelDetection -> Request StartLabelDetection
request = Service -> StartLabelDetection -> Request StartLabelDetection
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartLabelDetection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartLabelDetection)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartLabelDetection))
-> Logger
-> Service
-> Proxy StartLabelDetection
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartLabelDetection)))
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 -> StartLabelDetectionResponse
StartLabelDetectionResponse'
(Maybe Text -> Int -> StartLabelDetectionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StartLabelDetectionResponse)
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 -> StartLabelDetectionResponse)
-> Either String Int -> Either String StartLabelDetectionResponse
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 StartLabelDetection
instance Prelude.NFData StartLabelDetection
instance Core.ToHeaders StartLabelDetection where
toHeaders :: StartLabelDetection -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartLabelDetection -> 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.StartLabelDetection" ::
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 StartLabelDetection where
toJSON :: StartLabelDetection -> Value
toJSON StartLabelDetection' {Maybe Double
Maybe Text
Maybe NotificationChannel
Video
video :: Video
minConfidence :: Maybe Double
clientRequestToken :: Maybe Text
notificationChannel :: Maybe NotificationChannel
jobTag :: Maybe Text
$sel:video:StartLabelDetection' :: StartLabelDetection -> Video
$sel:minConfidence:StartLabelDetection' :: StartLabelDetection -> Maybe Double
$sel:clientRequestToken:StartLabelDetection' :: StartLabelDetection -> Maybe Text
$sel:notificationChannel:StartLabelDetection' :: StartLabelDetection -> Maybe NotificationChannel
$sel:jobTag:StartLabelDetection' :: StartLabelDetection -> 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
"MinConfidence" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
minConfidence,
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 StartLabelDetection where
toPath :: StartLabelDetection -> ByteString
toPath = ByteString -> StartLabelDetection -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartLabelDetection where
toQuery :: StartLabelDetection -> QueryString
toQuery = QueryString -> StartLabelDetection -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartLabelDetectionResponse = StartLabelDetectionResponse'
{
StartLabelDetectionResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
StartLabelDetectionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartLabelDetectionResponse -> StartLabelDetectionResponse -> Bool
(StartLabelDetectionResponse
-> StartLabelDetectionResponse -> Bool)
-> (StartLabelDetectionResponse
-> StartLabelDetectionResponse -> Bool)
-> Eq StartLabelDetectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartLabelDetectionResponse -> StartLabelDetectionResponse -> Bool
$c/= :: StartLabelDetectionResponse -> StartLabelDetectionResponse -> Bool
== :: StartLabelDetectionResponse -> StartLabelDetectionResponse -> Bool
$c== :: StartLabelDetectionResponse -> StartLabelDetectionResponse -> Bool
Prelude.Eq, ReadPrec [StartLabelDetectionResponse]
ReadPrec StartLabelDetectionResponse
Int -> ReadS StartLabelDetectionResponse
ReadS [StartLabelDetectionResponse]
(Int -> ReadS StartLabelDetectionResponse)
-> ReadS [StartLabelDetectionResponse]
-> ReadPrec StartLabelDetectionResponse
-> ReadPrec [StartLabelDetectionResponse]
-> Read StartLabelDetectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartLabelDetectionResponse]
$creadListPrec :: ReadPrec [StartLabelDetectionResponse]
readPrec :: ReadPrec StartLabelDetectionResponse
$creadPrec :: ReadPrec StartLabelDetectionResponse
readList :: ReadS [StartLabelDetectionResponse]
$creadList :: ReadS [StartLabelDetectionResponse]
readsPrec :: Int -> ReadS StartLabelDetectionResponse
$creadsPrec :: Int -> ReadS StartLabelDetectionResponse
Prelude.Read, Int -> StartLabelDetectionResponse -> ShowS
[StartLabelDetectionResponse] -> ShowS
StartLabelDetectionResponse -> String
(Int -> StartLabelDetectionResponse -> ShowS)
-> (StartLabelDetectionResponse -> String)
-> ([StartLabelDetectionResponse] -> ShowS)
-> Show StartLabelDetectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartLabelDetectionResponse] -> ShowS
$cshowList :: [StartLabelDetectionResponse] -> ShowS
show :: StartLabelDetectionResponse -> String
$cshow :: StartLabelDetectionResponse -> String
showsPrec :: Int -> StartLabelDetectionResponse -> ShowS
$cshowsPrec :: Int -> StartLabelDetectionResponse -> ShowS
Prelude.Show, (forall x.
StartLabelDetectionResponse -> Rep StartLabelDetectionResponse x)
-> (forall x.
Rep StartLabelDetectionResponse x -> StartLabelDetectionResponse)
-> Generic StartLabelDetectionResponse
forall x.
Rep StartLabelDetectionResponse x -> StartLabelDetectionResponse
forall x.
StartLabelDetectionResponse -> Rep StartLabelDetectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartLabelDetectionResponse x -> StartLabelDetectionResponse
$cfrom :: forall x.
StartLabelDetectionResponse -> Rep StartLabelDetectionResponse x
Prelude.Generic)
newStartLabelDetectionResponse ::
Prelude.Int ->
StartLabelDetectionResponse
newStartLabelDetectionResponse :: Int -> StartLabelDetectionResponse
newStartLabelDetectionResponse Int
pHttpStatus_ =
StartLabelDetectionResponse' :: Maybe Text -> Int -> StartLabelDetectionResponse
StartLabelDetectionResponse'
{ $sel:jobId:StartLabelDetectionResponse' :: Maybe Text
jobId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartLabelDetectionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startLabelDetectionResponse_jobId :: Lens.Lens' StartLabelDetectionResponse (Prelude.Maybe Prelude.Text)
startLabelDetectionResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> StartLabelDetectionResponse -> f StartLabelDetectionResponse
startLabelDetectionResponse_jobId = (StartLabelDetectionResponse -> Maybe Text)
-> (StartLabelDetectionResponse
-> Maybe Text -> StartLabelDetectionResponse)
-> Lens
StartLabelDetectionResponse
StartLabelDetectionResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLabelDetectionResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartLabelDetectionResponse' :: StartLabelDetectionResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartLabelDetectionResponse
s@StartLabelDetectionResponse' {} Maybe Text
a -> StartLabelDetectionResponse
s {$sel:jobId:StartLabelDetectionResponse' :: Maybe Text
jobId = Maybe Text
a} :: StartLabelDetectionResponse)
startLabelDetectionResponse_httpStatus :: Lens.Lens' StartLabelDetectionResponse Prelude.Int
startLabelDetectionResponse_httpStatus :: (Int -> f Int)
-> StartLabelDetectionResponse -> f StartLabelDetectionResponse
startLabelDetectionResponse_httpStatus = (StartLabelDetectionResponse -> Int)
-> (StartLabelDetectionResponse
-> Int -> StartLabelDetectionResponse)
-> Lens
StartLabelDetectionResponse StartLabelDetectionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartLabelDetectionResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartLabelDetectionResponse' :: StartLabelDetectionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartLabelDetectionResponse
s@StartLabelDetectionResponse' {} Int
a -> StartLabelDetectionResponse
s {$sel:httpStatus:StartLabelDetectionResponse' :: Int
httpStatus = Int
a} :: StartLabelDetectionResponse)
instance Prelude.NFData StartLabelDetectionResponse