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