{-# 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.Translate.StopTextTranslationJob
(
StopTextTranslationJob (..),
newStopTextTranslationJob,
stopTextTranslationJob_jobId,
StopTextTranslationJobResponse (..),
newStopTextTranslationJobResponse,
stopTextTranslationJobResponse_jobId,
stopTextTranslationJobResponse_jobStatus,
stopTextTranslationJobResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Translate.Types
data StopTextTranslationJob = StopTextTranslationJob'
{
StopTextTranslationJob -> Text
jobId :: Prelude.Text
}
deriving (StopTextTranslationJob -> StopTextTranslationJob -> Bool
(StopTextTranslationJob -> StopTextTranslationJob -> Bool)
-> (StopTextTranslationJob -> StopTextTranslationJob -> Bool)
-> Eq StopTextTranslationJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopTextTranslationJob -> StopTextTranslationJob -> Bool
$c/= :: StopTextTranslationJob -> StopTextTranslationJob -> Bool
== :: StopTextTranslationJob -> StopTextTranslationJob -> Bool
$c== :: StopTextTranslationJob -> StopTextTranslationJob -> Bool
Prelude.Eq, ReadPrec [StopTextTranslationJob]
ReadPrec StopTextTranslationJob
Int -> ReadS StopTextTranslationJob
ReadS [StopTextTranslationJob]
(Int -> ReadS StopTextTranslationJob)
-> ReadS [StopTextTranslationJob]
-> ReadPrec StopTextTranslationJob
-> ReadPrec [StopTextTranslationJob]
-> Read StopTextTranslationJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopTextTranslationJob]
$creadListPrec :: ReadPrec [StopTextTranslationJob]
readPrec :: ReadPrec StopTextTranslationJob
$creadPrec :: ReadPrec StopTextTranslationJob
readList :: ReadS [StopTextTranslationJob]
$creadList :: ReadS [StopTextTranslationJob]
readsPrec :: Int -> ReadS StopTextTranslationJob
$creadsPrec :: Int -> ReadS StopTextTranslationJob
Prelude.Read, Int -> StopTextTranslationJob -> ShowS
[StopTextTranslationJob] -> ShowS
StopTextTranslationJob -> String
(Int -> StopTextTranslationJob -> ShowS)
-> (StopTextTranslationJob -> String)
-> ([StopTextTranslationJob] -> ShowS)
-> Show StopTextTranslationJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopTextTranslationJob] -> ShowS
$cshowList :: [StopTextTranslationJob] -> ShowS
show :: StopTextTranslationJob -> String
$cshow :: StopTextTranslationJob -> String
showsPrec :: Int -> StopTextTranslationJob -> ShowS
$cshowsPrec :: Int -> StopTextTranslationJob -> ShowS
Prelude.Show, (forall x. StopTextTranslationJob -> Rep StopTextTranslationJob x)
-> (forall x.
Rep StopTextTranslationJob x -> StopTextTranslationJob)
-> Generic StopTextTranslationJob
forall x. Rep StopTextTranslationJob x -> StopTextTranslationJob
forall x. StopTextTranslationJob -> Rep StopTextTranslationJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopTextTranslationJob x -> StopTextTranslationJob
$cfrom :: forall x. StopTextTranslationJob -> Rep StopTextTranslationJob x
Prelude.Generic)
newStopTextTranslationJob ::
Prelude.Text ->
StopTextTranslationJob
newStopTextTranslationJob :: Text -> StopTextTranslationJob
newStopTextTranslationJob Text
pJobId_ =
StopTextTranslationJob' :: Text -> StopTextTranslationJob
StopTextTranslationJob' {$sel:jobId:StopTextTranslationJob' :: Text
jobId = Text
pJobId_}
stopTextTranslationJob_jobId :: Lens.Lens' StopTextTranslationJob Prelude.Text
stopTextTranslationJob_jobId :: (Text -> f Text)
-> StopTextTranslationJob -> f StopTextTranslationJob
stopTextTranslationJob_jobId = (StopTextTranslationJob -> Text)
-> (StopTextTranslationJob -> Text -> StopTextTranslationJob)
-> Lens StopTextTranslationJob StopTextTranslationJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTextTranslationJob' {Text
jobId :: Text
$sel:jobId:StopTextTranslationJob' :: StopTextTranslationJob -> Text
jobId} -> Text
jobId) (\s :: StopTextTranslationJob
s@StopTextTranslationJob' {} Text
a -> StopTextTranslationJob
s {$sel:jobId:StopTextTranslationJob' :: Text
jobId = Text
a} :: StopTextTranslationJob)
instance Core.AWSRequest StopTextTranslationJob where
type
AWSResponse StopTextTranslationJob =
StopTextTranslationJobResponse
request :: StopTextTranslationJob -> Request StopTextTranslationJob
request = Service -> StopTextTranslationJob -> Request StopTextTranslationJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StopTextTranslationJob
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StopTextTranslationJob)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StopTextTranslationJob))
-> Logger
-> Service
-> Proxy StopTextTranslationJob
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StopTextTranslationJob)))
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 JobStatus -> Int -> StopTextTranslationJobResponse
StopTextTranslationJobResponse'
(Maybe Text
-> Maybe JobStatus -> Int -> StopTextTranslationJobResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe JobStatus -> Int -> StopTextTranslationJobResponse)
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 (Maybe JobStatus -> Int -> StopTextTranslationJobResponse)
-> Either String (Maybe JobStatus)
-> Either String (Int -> StopTextTranslationJobResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe JobStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobStatus")
Either String (Int -> StopTextTranslationJobResponse)
-> Either String Int
-> Either String StopTextTranslationJobResponse
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 StopTextTranslationJob
instance Prelude.NFData StopTextTranslationJob
instance Core.ToHeaders StopTextTranslationJob where
toHeaders :: StopTextTranslationJob -> ResponseHeaders
toHeaders =
ResponseHeaders -> StopTextTranslationJob -> 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
"AWSShineFrontendService_20170701.StopTextTranslationJob" ::
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 StopTextTranslationJob where
toJSON :: StopTextTranslationJob -> Value
toJSON StopTextTranslationJob' {Text
jobId :: Text
$sel:jobId:StopTextTranslationJob' :: StopTextTranslationJob -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"JobId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
jobId)]
)
instance Core.ToPath StopTextTranslationJob where
toPath :: StopTextTranslationJob -> ByteString
toPath = ByteString -> StopTextTranslationJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StopTextTranslationJob where
toQuery :: StopTextTranslationJob -> QueryString
toQuery = QueryString -> StopTextTranslationJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StopTextTranslationJobResponse = StopTextTranslationJobResponse'
{
StopTextTranslationJobResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
StopTextTranslationJobResponse -> Maybe JobStatus
jobStatus :: Prelude.Maybe JobStatus,
StopTextTranslationJobResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StopTextTranslationJobResponse
-> StopTextTranslationJobResponse -> Bool
(StopTextTranslationJobResponse
-> StopTextTranslationJobResponse -> Bool)
-> (StopTextTranslationJobResponse
-> StopTextTranslationJobResponse -> Bool)
-> Eq StopTextTranslationJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopTextTranslationJobResponse
-> StopTextTranslationJobResponse -> Bool
$c/= :: StopTextTranslationJobResponse
-> StopTextTranslationJobResponse -> Bool
== :: StopTextTranslationJobResponse
-> StopTextTranslationJobResponse -> Bool
$c== :: StopTextTranslationJobResponse
-> StopTextTranslationJobResponse -> Bool
Prelude.Eq, ReadPrec [StopTextTranslationJobResponse]
ReadPrec StopTextTranslationJobResponse
Int -> ReadS StopTextTranslationJobResponse
ReadS [StopTextTranslationJobResponse]
(Int -> ReadS StopTextTranslationJobResponse)
-> ReadS [StopTextTranslationJobResponse]
-> ReadPrec StopTextTranslationJobResponse
-> ReadPrec [StopTextTranslationJobResponse]
-> Read StopTextTranslationJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopTextTranslationJobResponse]
$creadListPrec :: ReadPrec [StopTextTranslationJobResponse]
readPrec :: ReadPrec StopTextTranslationJobResponse
$creadPrec :: ReadPrec StopTextTranslationJobResponse
readList :: ReadS [StopTextTranslationJobResponse]
$creadList :: ReadS [StopTextTranslationJobResponse]
readsPrec :: Int -> ReadS StopTextTranslationJobResponse
$creadsPrec :: Int -> ReadS StopTextTranslationJobResponse
Prelude.Read, Int -> StopTextTranslationJobResponse -> ShowS
[StopTextTranslationJobResponse] -> ShowS
StopTextTranslationJobResponse -> String
(Int -> StopTextTranslationJobResponse -> ShowS)
-> (StopTextTranslationJobResponse -> String)
-> ([StopTextTranslationJobResponse] -> ShowS)
-> Show StopTextTranslationJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopTextTranslationJobResponse] -> ShowS
$cshowList :: [StopTextTranslationJobResponse] -> ShowS
show :: StopTextTranslationJobResponse -> String
$cshow :: StopTextTranslationJobResponse -> String
showsPrec :: Int -> StopTextTranslationJobResponse -> ShowS
$cshowsPrec :: Int -> StopTextTranslationJobResponse -> ShowS
Prelude.Show, (forall x.
StopTextTranslationJobResponse
-> Rep StopTextTranslationJobResponse x)
-> (forall x.
Rep StopTextTranslationJobResponse x
-> StopTextTranslationJobResponse)
-> Generic StopTextTranslationJobResponse
forall x.
Rep StopTextTranslationJobResponse x
-> StopTextTranslationJobResponse
forall x.
StopTextTranslationJobResponse
-> Rep StopTextTranslationJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopTextTranslationJobResponse x
-> StopTextTranslationJobResponse
$cfrom :: forall x.
StopTextTranslationJobResponse
-> Rep StopTextTranslationJobResponse x
Prelude.Generic)
newStopTextTranslationJobResponse ::
Prelude.Int ->
StopTextTranslationJobResponse
newStopTextTranslationJobResponse :: Int -> StopTextTranslationJobResponse
newStopTextTranslationJobResponse Int
pHttpStatus_ =
StopTextTranslationJobResponse' :: Maybe Text
-> Maybe JobStatus -> Int -> StopTextTranslationJobResponse
StopTextTranslationJobResponse'
{ $sel:jobId:StopTextTranslationJobResponse' :: Maybe Text
jobId =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:jobStatus:StopTextTranslationJobResponse' :: Maybe JobStatus
jobStatus = Maybe JobStatus
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StopTextTranslationJobResponse' :: Int
httpStatus = Int
pHttpStatus_
}
stopTextTranslationJobResponse_jobId :: Lens.Lens' StopTextTranslationJobResponse (Prelude.Maybe Prelude.Text)
stopTextTranslationJobResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> StopTextTranslationJobResponse
-> f StopTextTranslationJobResponse
stopTextTranslationJobResponse_jobId = (StopTextTranslationJobResponse -> Maybe Text)
-> (StopTextTranslationJobResponse
-> Maybe Text -> StopTextTranslationJobResponse)
-> Lens
StopTextTranslationJobResponse
StopTextTranslationJobResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTextTranslationJobResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StopTextTranslationJobResponse' :: StopTextTranslationJobResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StopTextTranslationJobResponse
s@StopTextTranslationJobResponse' {} Maybe Text
a -> StopTextTranslationJobResponse
s {$sel:jobId:StopTextTranslationJobResponse' :: Maybe Text
jobId = Maybe Text
a} :: StopTextTranslationJobResponse)
stopTextTranslationJobResponse_jobStatus :: Lens.Lens' StopTextTranslationJobResponse (Prelude.Maybe JobStatus)
stopTextTranslationJobResponse_jobStatus :: (Maybe JobStatus -> f (Maybe JobStatus))
-> StopTextTranslationJobResponse
-> f StopTextTranslationJobResponse
stopTextTranslationJobResponse_jobStatus = (StopTextTranslationJobResponse -> Maybe JobStatus)
-> (StopTextTranslationJobResponse
-> Maybe JobStatus -> StopTextTranslationJobResponse)
-> Lens
StopTextTranslationJobResponse
StopTextTranslationJobResponse
(Maybe JobStatus)
(Maybe JobStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTextTranslationJobResponse' {Maybe JobStatus
jobStatus :: Maybe JobStatus
$sel:jobStatus:StopTextTranslationJobResponse' :: StopTextTranslationJobResponse -> Maybe JobStatus
jobStatus} -> Maybe JobStatus
jobStatus) (\s :: StopTextTranslationJobResponse
s@StopTextTranslationJobResponse' {} Maybe JobStatus
a -> StopTextTranslationJobResponse
s {$sel:jobStatus:StopTextTranslationJobResponse' :: Maybe JobStatus
jobStatus = Maybe JobStatus
a} :: StopTextTranslationJobResponse)
stopTextTranslationJobResponse_httpStatus :: Lens.Lens' StopTextTranslationJobResponse Prelude.Int
stopTextTranslationJobResponse_httpStatus :: (Int -> f Int)
-> StopTextTranslationJobResponse
-> f StopTextTranslationJobResponse
stopTextTranslationJobResponse_httpStatus = (StopTextTranslationJobResponse -> Int)
-> (StopTextTranslationJobResponse
-> Int -> StopTextTranslationJobResponse)
-> Lens
StopTextTranslationJobResponse
StopTextTranslationJobResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopTextTranslationJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopTextTranslationJobResponse' :: StopTextTranslationJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopTextTranslationJobResponse
s@StopTextTranslationJobResponse' {} Int
a -> StopTextTranslationJobResponse
s {$sel:httpStatus:StopTextTranslationJobResponse' :: Int
httpStatus = Int
a} :: StopTextTranslationJobResponse)
instance
Prelude.NFData
StopTextTranslationJobResponse