{-# 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.ComprehendMedical.StartEntitiesDetectionV2Job
-- 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 medical entity detection job for a collection of
-- documents. Use the @DescribeEntitiesDetectionV2Job@ operation to track
-- the status of a job.
module Amazonka.ComprehendMedical.StartEntitiesDetectionV2Job
  ( -- * Creating a Request
    StartEntitiesDetectionV2Job (..),
    newStartEntitiesDetectionV2Job,

    -- * Request Lenses
    startEntitiesDetectionV2Job_kmsKey,
    startEntitiesDetectionV2Job_jobName,
    startEntitiesDetectionV2Job_clientRequestToken,
    startEntitiesDetectionV2Job_inputDataConfig,
    startEntitiesDetectionV2Job_outputDataConfig,
    startEntitiesDetectionV2Job_dataAccessRoleArn,
    startEntitiesDetectionV2Job_languageCode,

    -- * Destructuring the Response
    StartEntitiesDetectionV2JobResponse (..),
    newStartEntitiesDetectionV2JobResponse,

    -- * Response Lenses
    startEntitiesDetectionV2JobResponse_jobId,
    startEntitiesDetectionV2JobResponse_httpStatus,
  )
where

import Amazonka.ComprehendMedical.Types
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

-- | /See:/ 'newStartEntitiesDetectionV2Job' smart constructor.
data StartEntitiesDetectionV2Job = StartEntitiesDetectionV2Job'
  { -- | An AWS Key Management Service key to encrypt your output files. If you
    -- do not specify a key, the files are written in plain text.
    StartEntitiesDetectionV2Job -> Maybe Text
kmsKey :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the job.
    StartEntitiesDetectionV2Job -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the request. If you don\'t set the client
    -- request token, Amazon Comprehend Medical generates one.
    StartEntitiesDetectionV2Job -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | Specifies the format and location of the input data for the job.
    StartEntitiesDetectionV2Job -> InputDataConfig
inputDataConfig :: InputDataConfig,
    -- | Specifies where to send the output files.
    StartEntitiesDetectionV2Job -> OutputDataConfig
outputDataConfig :: OutputDataConfig,
    -- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
    -- (IAM) role that grants Amazon Comprehend Medical read access to your
    -- input data. For more information, see
    -- <https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions-med.html#auth-role-permissions-med Role-Based Permissions Required for Asynchronous Operations>.
    StartEntitiesDetectionV2Job -> Text
dataAccessRoleArn :: Prelude.Text,
    -- | The language of the input documents. All documents must be in the same
    -- language.
    StartEntitiesDetectionV2Job -> LanguageCode
languageCode :: LanguageCode
  }
  deriving (StartEntitiesDetectionV2Job -> StartEntitiesDetectionV2Job -> Bool
(StartEntitiesDetectionV2Job
 -> StartEntitiesDetectionV2Job -> Bool)
-> (StartEntitiesDetectionV2Job
    -> StartEntitiesDetectionV2Job -> Bool)
-> Eq StartEntitiesDetectionV2Job
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartEntitiesDetectionV2Job -> StartEntitiesDetectionV2Job -> Bool
$c/= :: StartEntitiesDetectionV2Job -> StartEntitiesDetectionV2Job -> Bool
== :: StartEntitiesDetectionV2Job -> StartEntitiesDetectionV2Job -> Bool
$c== :: StartEntitiesDetectionV2Job -> StartEntitiesDetectionV2Job -> Bool
Prelude.Eq, ReadPrec [StartEntitiesDetectionV2Job]
ReadPrec StartEntitiesDetectionV2Job
Int -> ReadS StartEntitiesDetectionV2Job
ReadS [StartEntitiesDetectionV2Job]
(Int -> ReadS StartEntitiesDetectionV2Job)
-> ReadS [StartEntitiesDetectionV2Job]
-> ReadPrec StartEntitiesDetectionV2Job
-> ReadPrec [StartEntitiesDetectionV2Job]
-> Read StartEntitiesDetectionV2Job
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartEntitiesDetectionV2Job]
$creadListPrec :: ReadPrec [StartEntitiesDetectionV2Job]
readPrec :: ReadPrec StartEntitiesDetectionV2Job
$creadPrec :: ReadPrec StartEntitiesDetectionV2Job
readList :: ReadS [StartEntitiesDetectionV2Job]
$creadList :: ReadS [StartEntitiesDetectionV2Job]
readsPrec :: Int -> ReadS StartEntitiesDetectionV2Job
$creadsPrec :: Int -> ReadS StartEntitiesDetectionV2Job
Prelude.Read, Int -> StartEntitiesDetectionV2Job -> ShowS
[StartEntitiesDetectionV2Job] -> ShowS
StartEntitiesDetectionV2Job -> String
(Int -> StartEntitiesDetectionV2Job -> ShowS)
-> (StartEntitiesDetectionV2Job -> String)
-> ([StartEntitiesDetectionV2Job] -> ShowS)
-> Show StartEntitiesDetectionV2Job
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartEntitiesDetectionV2Job] -> ShowS
$cshowList :: [StartEntitiesDetectionV2Job] -> ShowS
show :: StartEntitiesDetectionV2Job -> String
$cshow :: StartEntitiesDetectionV2Job -> String
showsPrec :: Int -> StartEntitiesDetectionV2Job -> ShowS
$cshowsPrec :: Int -> StartEntitiesDetectionV2Job -> ShowS
Prelude.Show, (forall x.
 StartEntitiesDetectionV2Job -> Rep StartEntitiesDetectionV2Job x)
-> (forall x.
    Rep StartEntitiesDetectionV2Job x -> StartEntitiesDetectionV2Job)
-> Generic StartEntitiesDetectionV2Job
forall x.
Rep StartEntitiesDetectionV2Job x -> StartEntitiesDetectionV2Job
forall x.
StartEntitiesDetectionV2Job -> Rep StartEntitiesDetectionV2Job x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartEntitiesDetectionV2Job x -> StartEntitiesDetectionV2Job
$cfrom :: forall x.
StartEntitiesDetectionV2Job -> Rep StartEntitiesDetectionV2Job x
Prelude.Generic)

-- |
-- Create a value of 'StartEntitiesDetectionV2Job' 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:
--
-- 'kmsKey', 'startEntitiesDetectionV2Job_kmsKey' - An AWS Key Management Service key to encrypt your output files. If you
-- do not specify a key, the files are written in plain text.
--
-- 'jobName', 'startEntitiesDetectionV2Job_jobName' - The identifier of the job.
--
-- 'clientRequestToken', 'startEntitiesDetectionV2Job_clientRequestToken' - A unique identifier for the request. If you don\'t set the client
-- request token, Amazon Comprehend Medical generates one.
--
-- 'inputDataConfig', 'startEntitiesDetectionV2Job_inputDataConfig' - Specifies the format and location of the input data for the job.
--
-- 'outputDataConfig', 'startEntitiesDetectionV2Job_outputDataConfig' - Specifies where to send the output files.
--
-- 'dataAccessRoleArn', 'startEntitiesDetectionV2Job_dataAccessRoleArn' - The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that grants Amazon Comprehend Medical read access to your
-- input data. For more information, see
-- <https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions-med.html#auth-role-permissions-med Role-Based Permissions Required for Asynchronous Operations>.
--
-- 'languageCode', 'startEntitiesDetectionV2Job_languageCode' - The language of the input documents. All documents must be in the same
-- language.
newStartEntitiesDetectionV2Job ::
  -- | 'inputDataConfig'
  InputDataConfig ->
  -- | 'outputDataConfig'
  OutputDataConfig ->
  -- | 'dataAccessRoleArn'
  Prelude.Text ->
  -- | 'languageCode'
  LanguageCode ->
  StartEntitiesDetectionV2Job
newStartEntitiesDetectionV2Job :: InputDataConfig
-> OutputDataConfig
-> Text
-> LanguageCode
-> StartEntitiesDetectionV2Job
newStartEntitiesDetectionV2Job
  InputDataConfig
pInputDataConfig_
  OutputDataConfig
pOutputDataConfig_
  Text
pDataAccessRoleArn_
  LanguageCode
pLanguageCode_ =
    StartEntitiesDetectionV2Job' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> InputDataConfig
-> OutputDataConfig
-> Text
-> LanguageCode
-> StartEntitiesDetectionV2Job
StartEntitiesDetectionV2Job'
      { $sel:kmsKey:StartEntitiesDetectionV2Job' :: Maybe Text
kmsKey =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:jobName:StartEntitiesDetectionV2Job' :: Maybe Text
jobName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:clientRequestToken:StartEntitiesDetectionV2Job' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:inputDataConfig:StartEntitiesDetectionV2Job' :: InputDataConfig
inputDataConfig = InputDataConfig
pInputDataConfig_,
        $sel:outputDataConfig:StartEntitiesDetectionV2Job' :: OutputDataConfig
outputDataConfig = OutputDataConfig
pOutputDataConfig_,
        $sel:dataAccessRoleArn:StartEntitiesDetectionV2Job' :: Text
dataAccessRoleArn = Text
pDataAccessRoleArn_,
        $sel:languageCode:StartEntitiesDetectionV2Job' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_
      }

-- | An AWS Key Management Service key to encrypt your output files. If you
-- do not specify a key, the files are written in plain text.
startEntitiesDetectionV2Job_kmsKey :: Lens.Lens' StartEntitiesDetectionV2Job (Prelude.Maybe Prelude.Text)
startEntitiesDetectionV2Job_kmsKey :: (Maybe Text -> f (Maybe Text))
-> StartEntitiesDetectionV2Job -> f StartEntitiesDetectionV2Job
startEntitiesDetectionV2Job_kmsKey = (StartEntitiesDetectionV2Job -> Maybe Text)
-> (StartEntitiesDetectionV2Job
    -> Maybe Text -> StartEntitiesDetectionV2Job)
-> Lens
     StartEntitiesDetectionV2Job
     StartEntitiesDetectionV2Job
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEntitiesDetectionV2Job' {Maybe Text
kmsKey :: Maybe Text
$sel:kmsKey:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Maybe Text
kmsKey} -> Maybe Text
kmsKey) (\s :: StartEntitiesDetectionV2Job
s@StartEntitiesDetectionV2Job' {} Maybe Text
a -> StartEntitiesDetectionV2Job
s {$sel:kmsKey:StartEntitiesDetectionV2Job' :: Maybe Text
kmsKey = Maybe Text
a} :: StartEntitiesDetectionV2Job)

-- | The identifier of the job.
startEntitiesDetectionV2Job_jobName :: Lens.Lens' StartEntitiesDetectionV2Job (Prelude.Maybe Prelude.Text)
startEntitiesDetectionV2Job_jobName :: (Maybe Text -> f (Maybe Text))
-> StartEntitiesDetectionV2Job -> f StartEntitiesDetectionV2Job
startEntitiesDetectionV2Job_jobName = (StartEntitiesDetectionV2Job -> Maybe Text)
-> (StartEntitiesDetectionV2Job
    -> Maybe Text -> StartEntitiesDetectionV2Job)
-> Lens
     StartEntitiesDetectionV2Job
     StartEntitiesDetectionV2Job
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEntitiesDetectionV2Job' {Maybe Text
jobName :: Maybe Text
$sel:jobName:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Maybe Text
jobName} -> Maybe Text
jobName) (\s :: StartEntitiesDetectionV2Job
s@StartEntitiesDetectionV2Job' {} Maybe Text
a -> StartEntitiesDetectionV2Job
s {$sel:jobName:StartEntitiesDetectionV2Job' :: Maybe Text
jobName = Maybe Text
a} :: StartEntitiesDetectionV2Job)

-- | A unique identifier for the request. If you don\'t set the client
-- request token, Amazon Comprehend Medical generates one.
startEntitiesDetectionV2Job_clientRequestToken :: Lens.Lens' StartEntitiesDetectionV2Job (Prelude.Maybe Prelude.Text)
startEntitiesDetectionV2Job_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartEntitiesDetectionV2Job -> f StartEntitiesDetectionV2Job
startEntitiesDetectionV2Job_clientRequestToken = (StartEntitiesDetectionV2Job -> Maybe Text)
-> (StartEntitiesDetectionV2Job
    -> Maybe Text -> StartEntitiesDetectionV2Job)
-> Lens
     StartEntitiesDetectionV2Job
     StartEntitiesDetectionV2Job
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEntitiesDetectionV2Job' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartEntitiesDetectionV2Job
s@StartEntitiesDetectionV2Job' {} Maybe Text
a -> StartEntitiesDetectionV2Job
s {$sel:clientRequestToken:StartEntitiesDetectionV2Job' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartEntitiesDetectionV2Job)

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

-- | Specifies where to send the output files.
startEntitiesDetectionV2Job_outputDataConfig :: Lens.Lens' StartEntitiesDetectionV2Job OutputDataConfig
startEntitiesDetectionV2Job_outputDataConfig :: (OutputDataConfig -> f OutputDataConfig)
-> StartEntitiesDetectionV2Job -> f StartEntitiesDetectionV2Job
startEntitiesDetectionV2Job_outputDataConfig = (StartEntitiesDetectionV2Job -> OutputDataConfig)
-> (StartEntitiesDetectionV2Job
    -> OutputDataConfig -> StartEntitiesDetectionV2Job)
-> Lens
     StartEntitiesDetectionV2Job
     StartEntitiesDetectionV2Job
     OutputDataConfig
     OutputDataConfig
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEntitiesDetectionV2Job' {OutputDataConfig
outputDataConfig :: OutputDataConfig
$sel:outputDataConfig:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> OutputDataConfig
outputDataConfig} -> OutputDataConfig
outputDataConfig) (\s :: StartEntitiesDetectionV2Job
s@StartEntitiesDetectionV2Job' {} OutputDataConfig
a -> StartEntitiesDetectionV2Job
s {$sel:outputDataConfig:StartEntitiesDetectionV2Job' :: OutputDataConfig
outputDataConfig = OutputDataConfig
a} :: StartEntitiesDetectionV2Job)

-- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that grants Amazon Comprehend Medical read access to your
-- input data. For more information, see
-- <https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions-med.html#auth-role-permissions-med Role-Based Permissions Required for Asynchronous Operations>.
startEntitiesDetectionV2Job_dataAccessRoleArn :: Lens.Lens' StartEntitiesDetectionV2Job Prelude.Text
startEntitiesDetectionV2Job_dataAccessRoleArn :: (Text -> f Text)
-> StartEntitiesDetectionV2Job -> f StartEntitiesDetectionV2Job
startEntitiesDetectionV2Job_dataAccessRoleArn = (StartEntitiesDetectionV2Job -> Text)
-> (StartEntitiesDetectionV2Job
    -> Text -> StartEntitiesDetectionV2Job)
-> Lens
     StartEntitiesDetectionV2Job StartEntitiesDetectionV2Job Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEntitiesDetectionV2Job' {Text
dataAccessRoleArn :: Text
$sel:dataAccessRoleArn:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Text
dataAccessRoleArn} -> Text
dataAccessRoleArn) (\s :: StartEntitiesDetectionV2Job
s@StartEntitiesDetectionV2Job' {} Text
a -> StartEntitiesDetectionV2Job
s {$sel:dataAccessRoleArn:StartEntitiesDetectionV2Job' :: Text
dataAccessRoleArn = Text
a} :: StartEntitiesDetectionV2Job)

-- | The language of the input documents. All documents must be in the same
-- language.
startEntitiesDetectionV2Job_languageCode :: Lens.Lens' StartEntitiesDetectionV2Job LanguageCode
startEntitiesDetectionV2Job_languageCode :: (LanguageCode -> f LanguageCode)
-> StartEntitiesDetectionV2Job -> f StartEntitiesDetectionV2Job
startEntitiesDetectionV2Job_languageCode = (StartEntitiesDetectionV2Job -> LanguageCode)
-> (StartEntitiesDetectionV2Job
    -> LanguageCode -> StartEntitiesDetectionV2Job)
-> Lens
     StartEntitiesDetectionV2Job
     StartEntitiesDetectionV2Job
     LanguageCode
     LanguageCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEntitiesDetectionV2Job' {LanguageCode
languageCode :: LanguageCode
$sel:languageCode:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> LanguageCode
languageCode} -> LanguageCode
languageCode) (\s :: StartEntitiesDetectionV2Job
s@StartEntitiesDetectionV2Job' {} LanguageCode
a -> StartEntitiesDetectionV2Job
s {$sel:languageCode:StartEntitiesDetectionV2Job' :: LanguageCode
languageCode = LanguageCode
a} :: StartEntitiesDetectionV2Job)

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

instance Prelude.NFData StartEntitiesDetectionV2Job

instance Core.ToHeaders StartEntitiesDetectionV2Job where
  toHeaders :: StartEntitiesDetectionV2Job -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartEntitiesDetectionV2Job -> 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
"ComprehendMedical_20181030.StartEntitiesDetectionV2Job" ::
                          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 StartEntitiesDetectionV2Job where
  toJSON :: StartEntitiesDetectionV2Job -> Value
toJSON StartEntitiesDetectionV2Job' {Maybe Text
Text
InputDataConfig
LanguageCode
OutputDataConfig
languageCode :: LanguageCode
dataAccessRoleArn :: Text
outputDataConfig :: OutputDataConfig
inputDataConfig :: InputDataConfig
clientRequestToken :: Maybe Text
jobName :: Maybe Text
kmsKey :: Maybe Text
$sel:languageCode:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> LanguageCode
$sel:dataAccessRoleArn:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Text
$sel:outputDataConfig:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> OutputDataConfig
$sel:inputDataConfig:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> InputDataConfig
$sel:clientRequestToken:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Maybe Text
$sel:jobName:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Maybe Text
$sel:kmsKey:StartEntitiesDetectionV2Job' :: StartEntitiesDetectionV2Job -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KMSKey" 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
kmsKey,
            (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
"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
"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
"LanguageCode" Text -> LanguageCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= LanguageCode
languageCode)
          ]
      )

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

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

-- | /See:/ 'newStartEntitiesDetectionV2JobResponse' smart constructor.
data StartEntitiesDetectionV2JobResponse = StartEntitiesDetectionV2JobResponse'
  { -- | The identifier generated for the job. To get the status of a job, use
    -- this identifier with the @DescribeEntitiesDetectionV2Job@ operation.
    StartEntitiesDetectionV2JobResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartEntitiesDetectionV2JobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartEntitiesDetectionV2JobResponse
-> StartEntitiesDetectionV2JobResponse -> Bool
(StartEntitiesDetectionV2JobResponse
 -> StartEntitiesDetectionV2JobResponse -> Bool)
-> (StartEntitiesDetectionV2JobResponse
    -> StartEntitiesDetectionV2JobResponse -> Bool)
-> Eq StartEntitiesDetectionV2JobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartEntitiesDetectionV2JobResponse
-> StartEntitiesDetectionV2JobResponse -> Bool
$c/= :: StartEntitiesDetectionV2JobResponse
-> StartEntitiesDetectionV2JobResponse -> Bool
== :: StartEntitiesDetectionV2JobResponse
-> StartEntitiesDetectionV2JobResponse -> Bool
$c== :: StartEntitiesDetectionV2JobResponse
-> StartEntitiesDetectionV2JobResponse -> Bool
Prelude.Eq, ReadPrec [StartEntitiesDetectionV2JobResponse]
ReadPrec StartEntitiesDetectionV2JobResponse
Int -> ReadS StartEntitiesDetectionV2JobResponse
ReadS [StartEntitiesDetectionV2JobResponse]
(Int -> ReadS StartEntitiesDetectionV2JobResponse)
-> ReadS [StartEntitiesDetectionV2JobResponse]
-> ReadPrec StartEntitiesDetectionV2JobResponse
-> ReadPrec [StartEntitiesDetectionV2JobResponse]
-> Read StartEntitiesDetectionV2JobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartEntitiesDetectionV2JobResponse]
$creadListPrec :: ReadPrec [StartEntitiesDetectionV2JobResponse]
readPrec :: ReadPrec StartEntitiesDetectionV2JobResponse
$creadPrec :: ReadPrec StartEntitiesDetectionV2JobResponse
readList :: ReadS [StartEntitiesDetectionV2JobResponse]
$creadList :: ReadS [StartEntitiesDetectionV2JobResponse]
readsPrec :: Int -> ReadS StartEntitiesDetectionV2JobResponse
$creadsPrec :: Int -> ReadS StartEntitiesDetectionV2JobResponse
Prelude.Read, Int -> StartEntitiesDetectionV2JobResponse -> ShowS
[StartEntitiesDetectionV2JobResponse] -> ShowS
StartEntitiesDetectionV2JobResponse -> String
(Int -> StartEntitiesDetectionV2JobResponse -> ShowS)
-> (StartEntitiesDetectionV2JobResponse -> String)
-> ([StartEntitiesDetectionV2JobResponse] -> ShowS)
-> Show StartEntitiesDetectionV2JobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartEntitiesDetectionV2JobResponse] -> ShowS
$cshowList :: [StartEntitiesDetectionV2JobResponse] -> ShowS
show :: StartEntitiesDetectionV2JobResponse -> String
$cshow :: StartEntitiesDetectionV2JobResponse -> String
showsPrec :: Int -> StartEntitiesDetectionV2JobResponse -> ShowS
$cshowsPrec :: Int -> StartEntitiesDetectionV2JobResponse -> ShowS
Prelude.Show, (forall x.
 StartEntitiesDetectionV2JobResponse
 -> Rep StartEntitiesDetectionV2JobResponse x)
-> (forall x.
    Rep StartEntitiesDetectionV2JobResponse x
    -> StartEntitiesDetectionV2JobResponse)
-> Generic StartEntitiesDetectionV2JobResponse
forall x.
Rep StartEntitiesDetectionV2JobResponse x
-> StartEntitiesDetectionV2JobResponse
forall x.
StartEntitiesDetectionV2JobResponse
-> Rep StartEntitiesDetectionV2JobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartEntitiesDetectionV2JobResponse x
-> StartEntitiesDetectionV2JobResponse
$cfrom :: forall x.
StartEntitiesDetectionV2JobResponse
-> Rep StartEntitiesDetectionV2JobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartEntitiesDetectionV2JobResponse' 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', 'startEntitiesDetectionV2JobResponse_jobId' - The identifier generated for the job. To get the status of a job, use
-- this identifier with the @DescribeEntitiesDetectionV2Job@ operation.
--
-- 'httpStatus', 'startEntitiesDetectionV2JobResponse_httpStatus' - The response's http status code.
newStartEntitiesDetectionV2JobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartEntitiesDetectionV2JobResponse
newStartEntitiesDetectionV2JobResponse :: Int -> StartEntitiesDetectionV2JobResponse
newStartEntitiesDetectionV2JobResponse Int
pHttpStatus_ =
  StartEntitiesDetectionV2JobResponse' :: Maybe Text -> Int -> StartEntitiesDetectionV2JobResponse
StartEntitiesDetectionV2JobResponse'
    { $sel:jobId:StartEntitiesDetectionV2JobResponse' :: Maybe Text
jobId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartEntitiesDetectionV2JobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance
  Prelude.NFData
    StartEntitiesDetectionV2JobResponse