{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Translate.StartTextTranslationJob
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts an asynchronous batch translation job. Batch translation jobs can
-- be used to translate large volumes of text across multiple documents at
-- once. For more information, see async.
--
-- Batch translation jobs can be described with the
-- DescribeTextTranslationJob operation, listed with the
-- ListTextTranslationJobs operation, and stopped with the
-- StopTextTranslationJob operation.
--
-- Amazon Translate does not support batch translation of multiple source
-- languages at once.
module Amazonka.Translate.StartTextTranslationJob
  ( -- * Creating a Request
    StartTextTranslationJob (..),
    newStartTextTranslationJob,

    -- * Request Lenses
    startTextTranslationJob_jobName,
    startTextTranslationJob_parallelDataNames,
    startTextTranslationJob_terminologyNames,
    startTextTranslationJob_inputDataConfig,
    startTextTranslationJob_outputDataConfig,
    startTextTranslationJob_dataAccessRoleArn,
    startTextTranslationJob_sourceLanguageCode,
    startTextTranslationJob_targetLanguageCodes,
    startTextTranslationJob_clientToken,

    -- * Destructuring the Response
    StartTextTranslationJobResponse (..),
    newStartTextTranslationJobResponse,

    -- * Response Lenses
    startTextTranslationJobResponse_jobId,
    startTextTranslationJobResponse_jobStatus,
    startTextTranslationJobResponse_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

-- | /See:/ 'newStartTextTranslationJob' smart constructor.
data StartTextTranslationJob = StartTextTranslationJob'
  { -- | The name of the batch translation job to be performed.
    StartTextTranslationJob -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
    -- | The names of the parallel data resources to use in the batch translation
    -- job. For a list of available parallel data resources, use the
    -- ListParallelData operation.
    StartTextTranslationJob -> Maybe [Text]
parallelDataNames :: Prelude.Maybe [Prelude.Text],
    -- | The name of the terminology to use in the batch translation job. For a
    -- list of available terminologies, use the ListTerminologies operation.
    StartTextTranslationJob -> Maybe [Text]
terminologyNames :: Prelude.Maybe [Prelude.Text],
    -- | Specifies the format and S3 location of the input documents for the
    -- translation job.
    StartTextTranslationJob -> InputDataConfig
inputDataConfig :: InputDataConfig,
    -- | Specifies the S3 folder to which your job output will be saved.
    StartTextTranslationJob -> OutputDataConfig
outputDataConfig :: OutputDataConfig,
    -- | The Amazon Resource Name (ARN) of an AWS Identity Access and Management
    -- (IAM) role that grants Amazon Translate read access to your input data.
    -- For more nformation, see identity-and-access-management.
    StartTextTranslationJob -> Text
dataAccessRoleArn :: Prelude.Text,
    -- | The language code of the input language. For a list of language codes,
    -- see what-is-languages.
    --
    -- Amazon Translate does not automatically detect a source language during
    -- batch translation jobs.
    StartTextTranslationJob -> Text
sourceLanguageCode :: Prelude.Text,
    -- | The language code of the output language.
    StartTextTranslationJob -> NonEmpty Text
targetLanguageCodes :: Prelude.NonEmpty Prelude.Text,
    -- | A unique identifier for the request. This token is auto-generated when
    -- using the Amazon Translate SDK.
    StartTextTranslationJob -> Text
clientToken :: Prelude.Text
  }
  deriving (StartTextTranslationJob -> StartTextTranslationJob -> Bool
(StartTextTranslationJob -> StartTextTranslationJob -> Bool)
-> (StartTextTranslationJob -> StartTextTranslationJob -> Bool)
-> Eq StartTextTranslationJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTextTranslationJob -> StartTextTranslationJob -> Bool
$c/= :: StartTextTranslationJob -> StartTextTranslationJob -> Bool
== :: StartTextTranslationJob -> StartTextTranslationJob -> Bool
$c== :: StartTextTranslationJob -> StartTextTranslationJob -> Bool
Prelude.Eq, ReadPrec [StartTextTranslationJob]
ReadPrec StartTextTranslationJob
Int -> ReadS StartTextTranslationJob
ReadS [StartTextTranslationJob]
(Int -> ReadS StartTextTranslationJob)
-> ReadS [StartTextTranslationJob]
-> ReadPrec StartTextTranslationJob
-> ReadPrec [StartTextTranslationJob]
-> Read StartTextTranslationJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTextTranslationJob]
$creadListPrec :: ReadPrec [StartTextTranslationJob]
readPrec :: ReadPrec StartTextTranslationJob
$creadPrec :: ReadPrec StartTextTranslationJob
readList :: ReadS [StartTextTranslationJob]
$creadList :: ReadS [StartTextTranslationJob]
readsPrec :: Int -> ReadS StartTextTranslationJob
$creadsPrec :: Int -> ReadS StartTextTranslationJob
Prelude.Read, Int -> StartTextTranslationJob -> ShowS
[StartTextTranslationJob] -> ShowS
StartTextTranslationJob -> String
(Int -> StartTextTranslationJob -> ShowS)
-> (StartTextTranslationJob -> String)
-> ([StartTextTranslationJob] -> ShowS)
-> Show StartTextTranslationJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTextTranslationJob] -> ShowS
$cshowList :: [StartTextTranslationJob] -> ShowS
show :: StartTextTranslationJob -> String
$cshow :: StartTextTranslationJob -> String
showsPrec :: Int -> StartTextTranslationJob -> ShowS
$cshowsPrec :: Int -> StartTextTranslationJob -> ShowS
Prelude.Show, (forall x.
 StartTextTranslationJob -> Rep StartTextTranslationJob x)
-> (forall x.
    Rep StartTextTranslationJob x -> StartTextTranslationJob)
-> Generic StartTextTranslationJob
forall x. Rep StartTextTranslationJob x -> StartTextTranslationJob
forall x. StartTextTranslationJob -> Rep StartTextTranslationJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartTextTranslationJob x -> StartTextTranslationJob
$cfrom :: forall x. StartTextTranslationJob -> Rep StartTextTranslationJob x
Prelude.Generic)

-- |
-- Create a value of 'StartTextTranslationJob' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'jobName', 'startTextTranslationJob_jobName' - The name of the batch translation job to be performed.
--
-- 'parallelDataNames', 'startTextTranslationJob_parallelDataNames' - The names of the parallel data resources to use in the batch translation
-- job. For a list of available parallel data resources, use the
-- ListParallelData operation.
--
-- 'terminologyNames', 'startTextTranslationJob_terminologyNames' - The name of the terminology to use in the batch translation job. For a
-- list of available terminologies, use the ListTerminologies operation.
--
-- 'inputDataConfig', 'startTextTranslationJob_inputDataConfig' - Specifies the format and S3 location of the input documents for the
-- translation job.
--
-- 'outputDataConfig', 'startTextTranslationJob_outputDataConfig' - Specifies the S3 folder to which your job output will be saved.
--
-- 'dataAccessRoleArn', 'startTextTranslationJob_dataAccessRoleArn' - The Amazon Resource Name (ARN) of an AWS Identity Access and Management
-- (IAM) role that grants Amazon Translate read access to your input data.
-- For more nformation, see identity-and-access-management.
--
-- 'sourceLanguageCode', 'startTextTranslationJob_sourceLanguageCode' - The language code of the input language. For a list of language codes,
-- see what-is-languages.
--
-- Amazon Translate does not automatically detect a source language during
-- batch translation jobs.
--
-- 'targetLanguageCodes', 'startTextTranslationJob_targetLanguageCodes' - The language code of the output language.
--
-- 'clientToken', 'startTextTranslationJob_clientToken' - A unique identifier for the request. This token is auto-generated when
-- using the Amazon Translate SDK.
newStartTextTranslationJob ::
  -- | 'inputDataConfig'
  InputDataConfig ->
  -- | 'outputDataConfig'
  OutputDataConfig ->
  -- | 'dataAccessRoleArn'
  Prelude.Text ->
  -- | 'sourceLanguageCode'
  Prelude.Text ->
  -- | 'targetLanguageCodes'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'clientToken'
  Prelude.Text ->
  StartTextTranslationJob
newStartTextTranslationJob :: InputDataConfig
-> OutputDataConfig
-> Text
-> Text
-> NonEmpty Text
-> Text
-> StartTextTranslationJob
newStartTextTranslationJob
  InputDataConfig
pInputDataConfig_
  OutputDataConfig
pOutputDataConfig_
  Text
pDataAccessRoleArn_
  Text
pSourceLanguageCode_
  NonEmpty Text
pTargetLanguageCodes_
  Text
pClientToken_ =
    StartTextTranslationJob' :: Maybe Text
-> Maybe [Text]
-> Maybe [Text]
-> InputDataConfig
-> OutputDataConfig
-> Text
-> Text
-> NonEmpty Text
-> Text
-> StartTextTranslationJob
StartTextTranslationJob'
      { $sel:jobName:StartTextTranslationJob' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:parallelDataNames:StartTextTranslationJob' :: Maybe [Text]
parallelDataNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:terminologyNames:StartTextTranslationJob' :: Maybe [Text]
terminologyNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:inputDataConfig:StartTextTranslationJob' :: InputDataConfig
inputDataConfig = InputDataConfig
pInputDataConfig_,
        $sel:outputDataConfig:StartTextTranslationJob' :: OutputDataConfig
outputDataConfig = OutputDataConfig
pOutputDataConfig_,
        $sel:dataAccessRoleArn:StartTextTranslationJob' :: Text
dataAccessRoleArn = Text
pDataAccessRoleArn_,
        $sel:sourceLanguageCode:StartTextTranslationJob' :: Text
sourceLanguageCode = Text
pSourceLanguageCode_,
        $sel:targetLanguageCodes:StartTextTranslationJob' :: NonEmpty Text
targetLanguageCodes =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTargetLanguageCodes_,
        $sel:clientToken:StartTextTranslationJob' :: Text
clientToken = Text
pClientToken_
      }

-- | The name of the batch translation job to be performed.
startTextTranslationJob_jobName :: Lens.Lens' StartTextTranslationJob (Prelude.Maybe Prelude.Text)
startTextTranslationJob_jobName :: (Maybe Text -> f (Maybe Text))
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_jobName = (StartTextTranslationJob -> Maybe Text)
-> (StartTextTranslationJob
    -> Maybe Text -> StartTextTranslationJob)
-> Lens
     StartTextTranslationJob
     StartTextTranslationJob
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {Maybe Text
jobName :: Maybe Text
$sel:jobName:StartTextTranslationJob' :: StartTextTranslationJob -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} Maybe Text
a -> StartTextTranslationJob
s {$sel:jobName:StartTextTranslationJob' :: Maybe Text
jobName = Maybe Text
a} :: StartTextTranslationJob)

-- | The names of the parallel data resources to use in the batch translation
-- job. For a list of available parallel data resources, use the
-- ListParallelData operation.
startTextTranslationJob_parallelDataNames :: Lens.Lens' StartTextTranslationJob (Prelude.Maybe [Prelude.Text])
startTextTranslationJob_parallelDataNames :: (Maybe [Text] -> f (Maybe [Text]))
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_parallelDataNames = (StartTextTranslationJob -> Maybe [Text])
-> (StartTextTranslationJob
    -> Maybe [Text] -> StartTextTranslationJob)
-> Lens
     StartTextTranslationJob
     StartTextTranslationJob
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {Maybe [Text]
parallelDataNames :: Maybe [Text]
$sel:parallelDataNames:StartTextTranslationJob' :: StartTextTranslationJob -> Maybe [Text]
parallelDataNames} -> Maybe [Text]
parallelDataNames) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} Maybe [Text]
a -> StartTextTranslationJob
s {$sel:parallelDataNames:StartTextTranslationJob' :: Maybe [Text]
parallelDataNames = Maybe [Text]
a} :: StartTextTranslationJob) ((Maybe [Text] -> f (Maybe [Text]))
 -> StartTextTranslationJob -> f StartTextTranslationJob)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> StartTextTranslationJob
-> f StartTextTranslationJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the terminology to use in the batch translation job. For a
-- list of available terminologies, use the ListTerminologies operation.
startTextTranslationJob_terminologyNames :: Lens.Lens' StartTextTranslationJob (Prelude.Maybe [Prelude.Text])
startTextTranslationJob_terminologyNames :: (Maybe [Text] -> f (Maybe [Text]))
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_terminologyNames = (StartTextTranslationJob -> Maybe [Text])
-> (StartTextTranslationJob
    -> Maybe [Text] -> StartTextTranslationJob)
-> Lens
     StartTextTranslationJob
     StartTextTranslationJob
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {Maybe [Text]
terminologyNames :: Maybe [Text]
$sel:terminologyNames:StartTextTranslationJob' :: StartTextTranslationJob -> Maybe [Text]
terminologyNames} -> Maybe [Text]
terminologyNames) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} Maybe [Text]
a -> StartTextTranslationJob
s {$sel:terminologyNames:StartTextTranslationJob' :: Maybe [Text]
terminologyNames = Maybe [Text]
a} :: StartTextTranslationJob) ((Maybe [Text] -> f (Maybe [Text]))
 -> StartTextTranslationJob -> f StartTextTranslationJob)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> StartTextTranslationJob
-> f StartTextTranslationJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the format and S3 location of the input documents for the
-- translation job.
startTextTranslationJob_inputDataConfig :: Lens.Lens' StartTextTranslationJob InputDataConfig
startTextTranslationJob_inputDataConfig :: (InputDataConfig -> f InputDataConfig)
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_inputDataConfig = (StartTextTranslationJob -> InputDataConfig)
-> (StartTextTranslationJob
    -> InputDataConfig -> StartTextTranslationJob)
-> Lens
     StartTextTranslationJob
     StartTextTranslationJob
     InputDataConfig
     InputDataConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {InputDataConfig
inputDataConfig :: InputDataConfig
$sel:inputDataConfig:StartTextTranslationJob' :: StartTextTranslationJob -> InputDataConfig
inputDataConfig} -> InputDataConfig
inputDataConfig) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} InputDataConfig
a -> StartTextTranslationJob
s {$sel:inputDataConfig:StartTextTranslationJob' :: InputDataConfig
inputDataConfig = InputDataConfig
a} :: StartTextTranslationJob)

-- | Specifies the S3 folder to which your job output will be saved.
startTextTranslationJob_outputDataConfig :: Lens.Lens' StartTextTranslationJob OutputDataConfig
startTextTranslationJob_outputDataConfig :: (OutputDataConfig -> f OutputDataConfig)
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_outputDataConfig = (StartTextTranslationJob -> OutputDataConfig)
-> (StartTextTranslationJob
    -> OutputDataConfig -> StartTextTranslationJob)
-> Lens
     StartTextTranslationJob
     StartTextTranslationJob
     OutputDataConfig
     OutputDataConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {OutputDataConfig
outputDataConfig :: OutputDataConfig
$sel:outputDataConfig:StartTextTranslationJob' :: StartTextTranslationJob -> OutputDataConfig
outputDataConfig} -> OutputDataConfig
outputDataConfig) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} OutputDataConfig
a -> StartTextTranslationJob
s {$sel:outputDataConfig:StartTextTranslationJob' :: OutputDataConfig
outputDataConfig = OutputDataConfig
a} :: StartTextTranslationJob)

-- | The Amazon Resource Name (ARN) of an AWS Identity Access and Management
-- (IAM) role that grants Amazon Translate read access to your input data.
-- For more nformation, see identity-and-access-management.
startTextTranslationJob_dataAccessRoleArn :: Lens.Lens' StartTextTranslationJob Prelude.Text
startTextTranslationJob_dataAccessRoleArn :: (Text -> f Text)
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_dataAccessRoleArn = (StartTextTranslationJob -> Text)
-> (StartTextTranslationJob -> Text -> StartTextTranslationJob)
-> Lens StartTextTranslationJob StartTextTranslationJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {Text
dataAccessRoleArn :: Text
$sel:dataAccessRoleArn:StartTextTranslationJob' :: StartTextTranslationJob -> Text
dataAccessRoleArn} -> Text
dataAccessRoleArn) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} Text
a -> StartTextTranslationJob
s {$sel:dataAccessRoleArn:StartTextTranslationJob' :: Text
dataAccessRoleArn = Text
a} :: StartTextTranslationJob)

-- | The language code of the input language. For a list of language codes,
-- see what-is-languages.
--
-- Amazon Translate does not automatically detect a source language during
-- batch translation jobs.
startTextTranslationJob_sourceLanguageCode :: Lens.Lens' StartTextTranslationJob Prelude.Text
startTextTranslationJob_sourceLanguageCode :: (Text -> f Text)
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_sourceLanguageCode = (StartTextTranslationJob -> Text)
-> (StartTextTranslationJob -> Text -> StartTextTranslationJob)
-> Lens StartTextTranslationJob StartTextTranslationJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {Text
sourceLanguageCode :: Text
$sel:sourceLanguageCode:StartTextTranslationJob' :: StartTextTranslationJob -> Text
sourceLanguageCode} -> Text
sourceLanguageCode) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} Text
a -> StartTextTranslationJob
s {$sel:sourceLanguageCode:StartTextTranslationJob' :: Text
sourceLanguageCode = Text
a} :: StartTextTranslationJob)

-- | The language code of the output language.
startTextTranslationJob_targetLanguageCodes :: Lens.Lens' StartTextTranslationJob (Prelude.NonEmpty Prelude.Text)
startTextTranslationJob_targetLanguageCodes :: (NonEmpty Text -> f (NonEmpty Text))
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_targetLanguageCodes = (StartTextTranslationJob -> NonEmpty Text)
-> (StartTextTranslationJob
    -> NonEmpty Text -> StartTextTranslationJob)
-> Lens
     StartTextTranslationJob
     StartTextTranslationJob
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {NonEmpty Text
targetLanguageCodes :: NonEmpty Text
$sel:targetLanguageCodes:StartTextTranslationJob' :: StartTextTranslationJob -> NonEmpty Text
targetLanguageCodes} -> NonEmpty Text
targetLanguageCodes) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} NonEmpty Text
a -> StartTextTranslationJob
s {$sel:targetLanguageCodes:StartTextTranslationJob' :: NonEmpty Text
targetLanguageCodes = NonEmpty Text
a} :: StartTextTranslationJob) ((NonEmpty Text -> f (NonEmpty Text))
 -> StartTextTranslationJob -> f StartTextTranslationJob)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> StartTextTranslationJob
-> f StartTextTranslationJob
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A unique identifier for the request. This token is auto-generated when
-- using the Amazon Translate SDK.
startTextTranslationJob_clientToken :: Lens.Lens' StartTextTranslationJob Prelude.Text
startTextTranslationJob_clientToken :: (Text -> f Text)
-> StartTextTranslationJob -> f StartTextTranslationJob
startTextTranslationJob_clientToken = (StartTextTranslationJob -> Text)
-> (StartTextTranslationJob -> Text -> StartTextTranslationJob)
-> Lens StartTextTranslationJob StartTextTranslationJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJob' {Text
clientToken :: Text
$sel:clientToken:StartTextTranslationJob' :: StartTextTranslationJob -> Text
clientToken} -> Text
clientToken) (\s :: StartTextTranslationJob
s@StartTextTranslationJob' {} Text
a -> StartTextTranslationJob
s {$sel:clientToken:StartTextTranslationJob' :: Text
clientToken = Text
a} :: StartTextTranslationJob)

instance Core.AWSRequest StartTextTranslationJob where
  type
    AWSResponse StartTextTranslationJob =
      StartTextTranslationJobResponse
  request :: StartTextTranslationJob -> Request StartTextTranslationJob
request = Service
-> StartTextTranslationJob -> Request StartTextTranslationJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StartTextTranslationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartTextTranslationJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StartTextTranslationJob))
-> Logger
-> Service
-> Proxy StartTextTranslationJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartTextTranslationJob)))
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 -> StartTextTranslationJobResponse
StartTextTranslationJobResponse'
            (Maybe Text
 -> Maybe JobStatus -> Int -> StartTextTranslationJobResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe JobStatus -> Int -> StartTextTranslationJobResponse)
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 -> StartTextTranslationJobResponse)
-> Either String (Maybe JobStatus)
-> Either String (Int -> StartTextTranslationJobResponse)
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 -> StartTextTranslationJobResponse)
-> Either String Int
-> Either String StartTextTranslationJobResponse
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 StartTextTranslationJob

instance Prelude.NFData StartTextTranslationJob

instance Core.ToHeaders StartTextTranslationJob where
  toHeaders :: StartTextTranslationJob -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartTextTranslationJob -> 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.StartTextTranslationJob" ::
                          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 StartTextTranslationJob where
  toJSON :: StartTextTranslationJob -> Value
toJSON StartTextTranslationJob' {Maybe [Text]
Maybe Text
NonEmpty Text
Text
InputDataConfig
OutputDataConfig
clientToken :: Text
targetLanguageCodes :: NonEmpty Text
sourceLanguageCode :: Text
dataAccessRoleArn :: Text
outputDataConfig :: OutputDataConfig
inputDataConfig :: InputDataConfig
terminologyNames :: Maybe [Text]
parallelDataNames :: Maybe [Text]
jobName :: Maybe Text
$sel:clientToken:StartTextTranslationJob' :: StartTextTranslationJob -> Text
$sel:targetLanguageCodes:StartTextTranslationJob' :: StartTextTranslationJob -> NonEmpty Text
$sel:sourceLanguageCode:StartTextTranslationJob' :: StartTextTranslationJob -> Text
$sel:dataAccessRoleArn:StartTextTranslationJob' :: StartTextTranslationJob -> Text
$sel:outputDataConfig:StartTextTranslationJob' :: StartTextTranslationJob -> OutputDataConfig
$sel:inputDataConfig:StartTextTranslationJob' :: StartTextTranslationJob -> InputDataConfig
$sel:terminologyNames:StartTextTranslationJob' :: StartTextTranslationJob -> Maybe [Text]
$sel:parallelDataNames:StartTextTranslationJob' :: StartTextTranslationJob -> Maybe [Text]
$sel:jobName:StartTextTranslationJob' :: StartTextTranslationJob -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"JobName" 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
jobName,
            (Text
"ParallelDataNames" 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]
parallelDataNames,
            (Text
"TerminologyNames" 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]
terminologyNames,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"InputDataConfig" Text -> InputDataConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= InputDataConfig
inputDataConfig),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"OutputDataConfig" Text -> OutputDataConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= OutputDataConfig
outputDataConfig),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DataAccessRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataAccessRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SourceLanguageCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceLanguageCode),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"TargetLanguageCodes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
targetLanguageCodes),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken)
          ]
      )

instance Core.ToPath StartTextTranslationJob where
  toPath :: StartTextTranslationJob -> ByteString
toPath = ByteString -> StartTextTranslationJob -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery StartTextTranslationJob where
  toQuery :: StartTextTranslationJob -> QueryString
toQuery = QueryString -> StartTextTranslationJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStartTextTranslationJobResponse' smart constructor.
data StartTextTranslationJobResponse = StartTextTranslationJobResponse'
  { -- | The identifier generated for the job. To get the status of a job, use
    -- this ID with the DescribeTextTranslationJob operation.
    StartTextTranslationJobResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The status of the job. Possible values include:
    --
    -- -   @SUBMITTED@ - The job has been received and is queued for
    --     processing.
    --
    -- -   @IN_PROGRESS@ - Amazon Translate is processing the job.
    --
    -- -   @COMPLETED@ - The job was successfully completed and the output is
    --     available.
    --
    -- -   @COMPLETED_WITH_ERROR@ - The job was completed with errors. The
    --     errors can be analyzed in the job\'s output.
    --
    -- -   @FAILED@ - The job did not complete. To get details, use the
    --     DescribeTextTranslationJob operation.
    --
    -- -   @STOP_REQUESTED@ - The user who started the job has requested that
    --     it be stopped.
    --
    -- -   @STOPPED@ - The job has been stopped.
    StartTextTranslationJobResponse -> Maybe JobStatus
jobStatus :: Prelude.Maybe JobStatus,
    -- | The response's http status code.
    StartTextTranslationJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartTextTranslationJobResponse
-> StartTextTranslationJobResponse -> Bool
(StartTextTranslationJobResponse
 -> StartTextTranslationJobResponse -> Bool)
-> (StartTextTranslationJobResponse
    -> StartTextTranslationJobResponse -> Bool)
-> Eq StartTextTranslationJobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartTextTranslationJobResponse
-> StartTextTranslationJobResponse -> Bool
$c/= :: StartTextTranslationJobResponse
-> StartTextTranslationJobResponse -> Bool
== :: StartTextTranslationJobResponse
-> StartTextTranslationJobResponse -> Bool
$c== :: StartTextTranslationJobResponse
-> StartTextTranslationJobResponse -> Bool
Prelude.Eq, ReadPrec [StartTextTranslationJobResponse]
ReadPrec StartTextTranslationJobResponse
Int -> ReadS StartTextTranslationJobResponse
ReadS [StartTextTranslationJobResponse]
(Int -> ReadS StartTextTranslationJobResponse)
-> ReadS [StartTextTranslationJobResponse]
-> ReadPrec StartTextTranslationJobResponse
-> ReadPrec [StartTextTranslationJobResponse]
-> Read StartTextTranslationJobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartTextTranslationJobResponse]
$creadListPrec :: ReadPrec [StartTextTranslationJobResponse]
readPrec :: ReadPrec StartTextTranslationJobResponse
$creadPrec :: ReadPrec StartTextTranslationJobResponse
readList :: ReadS [StartTextTranslationJobResponse]
$creadList :: ReadS [StartTextTranslationJobResponse]
readsPrec :: Int -> ReadS StartTextTranslationJobResponse
$creadsPrec :: Int -> ReadS StartTextTranslationJobResponse
Prelude.Read, Int -> StartTextTranslationJobResponse -> ShowS
[StartTextTranslationJobResponse] -> ShowS
StartTextTranslationJobResponse -> String
(Int -> StartTextTranslationJobResponse -> ShowS)
-> (StartTextTranslationJobResponse -> String)
-> ([StartTextTranslationJobResponse] -> ShowS)
-> Show StartTextTranslationJobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartTextTranslationJobResponse] -> ShowS
$cshowList :: [StartTextTranslationJobResponse] -> ShowS
show :: StartTextTranslationJobResponse -> String
$cshow :: StartTextTranslationJobResponse -> String
showsPrec :: Int -> StartTextTranslationJobResponse -> ShowS
$cshowsPrec :: Int -> StartTextTranslationJobResponse -> ShowS
Prelude.Show, (forall x.
 StartTextTranslationJobResponse
 -> Rep StartTextTranslationJobResponse x)
-> (forall x.
    Rep StartTextTranslationJobResponse x
    -> StartTextTranslationJobResponse)
-> Generic StartTextTranslationJobResponse
forall x.
Rep StartTextTranslationJobResponse x
-> StartTextTranslationJobResponse
forall x.
StartTextTranslationJobResponse
-> Rep StartTextTranslationJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartTextTranslationJobResponse x
-> StartTextTranslationJobResponse
$cfrom :: forall x.
StartTextTranslationJobResponse
-> Rep StartTextTranslationJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartTextTranslationJobResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'jobId', 'startTextTranslationJobResponse_jobId' - The identifier generated for the job. To get the status of a job, use
-- this ID with the DescribeTextTranslationJob operation.
--
-- 'jobStatus', 'startTextTranslationJobResponse_jobStatus' - The status of the job. Possible values include:
--
-- -   @SUBMITTED@ - The job has been received and is queued for
--     processing.
--
-- -   @IN_PROGRESS@ - Amazon Translate is processing the job.
--
-- -   @COMPLETED@ - The job was successfully completed and the output is
--     available.
--
-- -   @COMPLETED_WITH_ERROR@ - The job was completed with errors. The
--     errors can be analyzed in the job\'s output.
--
-- -   @FAILED@ - The job did not complete. To get details, use the
--     DescribeTextTranslationJob operation.
--
-- -   @STOP_REQUESTED@ - The user who started the job has requested that
--     it be stopped.
--
-- -   @STOPPED@ - The job has been stopped.
--
-- 'httpStatus', 'startTextTranslationJobResponse_httpStatus' - The response's http status code.
newStartTextTranslationJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartTextTranslationJobResponse
newStartTextTranslationJobResponse :: Int -> StartTextTranslationJobResponse
newStartTextTranslationJobResponse Int
pHttpStatus_ =
  StartTextTranslationJobResponse' :: Maybe Text
-> Maybe JobStatus -> Int -> StartTextTranslationJobResponse
StartTextTranslationJobResponse'
    { $sel:jobId:StartTextTranslationJobResponse' :: Maybe Text
jobId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:StartTextTranslationJobResponse' :: Maybe JobStatus
jobStatus = Maybe JobStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartTextTranslationJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier generated for the job. To get the status of a job, use
-- this ID with the DescribeTextTranslationJob operation.
startTextTranslationJobResponse_jobId :: Lens.Lens' StartTextTranslationJobResponse (Prelude.Maybe Prelude.Text)
startTextTranslationJobResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> StartTextTranslationJobResponse
-> f StartTextTranslationJobResponse
startTextTranslationJobResponse_jobId = (StartTextTranslationJobResponse -> Maybe Text)
-> (StartTextTranslationJobResponse
    -> Maybe Text -> StartTextTranslationJobResponse)
-> Lens
     StartTextTranslationJobResponse
     StartTextTranslationJobResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJobResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartTextTranslationJobResponse' :: StartTextTranslationJobResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartTextTranslationJobResponse
s@StartTextTranslationJobResponse' {} Maybe Text
a -> StartTextTranslationJobResponse
s {$sel:jobId:StartTextTranslationJobResponse' :: Maybe Text
jobId = Maybe Text
a} :: StartTextTranslationJobResponse)

-- | The status of the job. Possible values include:
--
-- -   @SUBMITTED@ - The job has been received and is queued for
--     processing.
--
-- -   @IN_PROGRESS@ - Amazon Translate is processing the job.
--
-- -   @COMPLETED@ - The job was successfully completed and the output is
--     available.
--
-- -   @COMPLETED_WITH_ERROR@ - The job was completed with errors. The
--     errors can be analyzed in the job\'s output.
--
-- -   @FAILED@ - The job did not complete. To get details, use the
--     DescribeTextTranslationJob operation.
--
-- -   @STOP_REQUESTED@ - The user who started the job has requested that
--     it be stopped.
--
-- -   @STOPPED@ - The job has been stopped.
startTextTranslationJobResponse_jobStatus :: Lens.Lens' StartTextTranslationJobResponse (Prelude.Maybe JobStatus)
startTextTranslationJobResponse_jobStatus :: (Maybe JobStatus -> f (Maybe JobStatus))
-> StartTextTranslationJobResponse
-> f StartTextTranslationJobResponse
startTextTranslationJobResponse_jobStatus = (StartTextTranslationJobResponse -> Maybe JobStatus)
-> (StartTextTranslationJobResponse
    -> Maybe JobStatus -> StartTextTranslationJobResponse)
-> Lens
     StartTextTranslationJobResponse
     StartTextTranslationJobResponse
     (Maybe JobStatus)
     (Maybe JobStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJobResponse' {Maybe JobStatus
jobStatus :: Maybe JobStatus
$sel:jobStatus:StartTextTranslationJobResponse' :: StartTextTranslationJobResponse -> Maybe JobStatus
jobStatus} -> Maybe JobStatus
jobStatus) (\s :: StartTextTranslationJobResponse
s@StartTextTranslationJobResponse' {} Maybe JobStatus
a -> StartTextTranslationJobResponse
s {$sel:jobStatus:StartTextTranslationJobResponse' :: Maybe JobStatus
jobStatus = Maybe JobStatus
a} :: StartTextTranslationJobResponse)

-- | The response's http status code.
startTextTranslationJobResponse_httpStatus :: Lens.Lens' StartTextTranslationJobResponse Prelude.Int
startTextTranslationJobResponse_httpStatus :: (Int -> f Int)
-> StartTextTranslationJobResponse
-> f StartTextTranslationJobResponse
startTextTranslationJobResponse_httpStatus = (StartTextTranslationJobResponse -> Int)
-> (StartTextTranslationJobResponse
    -> Int -> StartTextTranslationJobResponse)
-> Lens
     StartTextTranslationJobResponse
     StartTextTranslationJobResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartTextTranslationJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartTextTranslationJobResponse' :: StartTextTranslationJobResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartTextTranslationJobResponse
s@StartTextTranslationJobResponse' {} Int
a -> StartTextTranslationJobResponse
s {$sel:httpStatus:StartTextTranslationJobResponse' :: Int
httpStatus = Int
a} :: StartTextTranslationJobResponse)

instance
  Prelude.NFData
    StartTextTranslationJobResponse