{-# 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.Textract.StartDocumentTextDetection
-- 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 the asynchronous detection of text in a document. Amazon Textract
-- can detect lines of text and the words that make up a line of text.
--
-- @StartDocumentTextDetection@ can analyze text in documents that are in
-- JPEG, PNG, and PDF format. The documents are stored in an Amazon S3
-- bucket. Use DocumentLocation to specify the bucket name and file name of
-- the document.
--
-- @StartTextDetection@ returns a job identifier (@JobId@) that you use to
-- get the results of the operation. When text detection is finished,
-- Amazon Textract publishes a completion status to the Amazon Simple
-- Notification Service (Amazon SNS) topic that you specify in
-- @NotificationChannel@. To get the results of the text detection
-- operation, first check that the status value published to the Amazon SNS
-- topic is @SUCCEEDED@. If so, call GetDocumentTextDetection, and pass the
-- job identifier (@JobId@) from the initial call to
-- @StartDocumentTextDetection@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html Document Text Detection>.
module Amazonka.Textract.StartDocumentTextDetection
  ( -- * Creating a Request
    StartDocumentTextDetection (..),
    newStartDocumentTextDetection,

    -- * Request Lenses
    startDocumentTextDetection_jobTag,
    startDocumentTextDetection_notificationChannel,
    startDocumentTextDetection_kmsKeyId,
    startDocumentTextDetection_outputConfig,
    startDocumentTextDetection_clientRequestToken,
    startDocumentTextDetection_documentLocation,

    -- * Destructuring the Response
    StartDocumentTextDetectionResponse (..),
    newStartDocumentTextDetectionResponse,

    -- * Response Lenses
    startDocumentTextDetectionResponse_jobId,
    startDocumentTextDetectionResponse_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.Textract.Types

-- | /See:/ 'newStartDocumentTextDetection' smart constructor.
data StartDocumentTextDetection = StartDocumentTextDetection'
  { -- | An identifier that you specify that\'s included in the completion
    -- notification published to the Amazon SNS topic. For example, you can use
    -- @JobTag@ to identify the type of document that the completion
    -- notification corresponds to (such as a tax form or a receipt).
    StartDocumentTextDetection -> Maybe Text
jobTag :: Prelude.Maybe Prelude.Text,
    -- | The Amazon SNS topic ARN that you want Amazon Textract to publish the
    -- completion status of the operation to.
    StartDocumentTextDetection -> Maybe NotificationChannel
notificationChannel :: Prelude.Maybe NotificationChannel,
    -- | The KMS key used to encrypt the inference results. This can be in either
    -- Key ID or Key Alias format. When a KMS key is provided, the KMS key will
    -- be used for server-side encryption of the objects in the customer
    -- bucket. When this parameter is not enabled, the result will be encrypted
    -- server side,using SSE-S3.
    StartDocumentTextDetection -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | Sets if the output will go to a customer defined bucket. By default
    -- Amazon Textract will save the results internally to be accessed with the
    -- GetDocumentTextDetection operation.
    StartDocumentTextDetection -> Maybe OutputConfig
outputConfig :: Prelude.Maybe OutputConfig,
    -- | The idempotent token that\'s used to identify the start request. If you
    -- use the same token with multiple @StartDocumentTextDetection@ requests,
    -- the same @JobId@ is returned. Use @ClientRequestToken@ to prevent the
    -- same job from being accidentally started more than once. For more
    -- information, see
    -- <https://docs.aws.amazon.com/textract/latest/dg/api-async.html Calling Amazon Textract Asynchronous Operations>.
    StartDocumentTextDetection -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The location of the document to be processed.
    StartDocumentTextDetection -> DocumentLocation
documentLocation :: DocumentLocation
  }
  deriving (StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
(StartDocumentTextDetection -> StartDocumentTextDetection -> Bool)
-> (StartDocumentTextDetection
    -> StartDocumentTextDetection -> Bool)
-> Eq StartDocumentTextDetection
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
$c/= :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
== :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
$c== :: StartDocumentTextDetection -> StartDocumentTextDetection -> Bool
Prelude.Eq, ReadPrec [StartDocumentTextDetection]
ReadPrec StartDocumentTextDetection
Int -> ReadS StartDocumentTextDetection
ReadS [StartDocumentTextDetection]
(Int -> ReadS StartDocumentTextDetection)
-> ReadS [StartDocumentTextDetection]
-> ReadPrec StartDocumentTextDetection
-> ReadPrec [StartDocumentTextDetection]
-> Read StartDocumentTextDetection
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDocumentTextDetection]
$creadListPrec :: ReadPrec [StartDocumentTextDetection]
readPrec :: ReadPrec StartDocumentTextDetection
$creadPrec :: ReadPrec StartDocumentTextDetection
readList :: ReadS [StartDocumentTextDetection]
$creadList :: ReadS [StartDocumentTextDetection]
readsPrec :: Int -> ReadS StartDocumentTextDetection
$creadsPrec :: Int -> ReadS StartDocumentTextDetection
Prelude.Read, Int -> StartDocumentTextDetection -> ShowS
[StartDocumentTextDetection] -> ShowS
StartDocumentTextDetection -> String
(Int -> StartDocumentTextDetection -> ShowS)
-> (StartDocumentTextDetection -> String)
-> ([StartDocumentTextDetection] -> ShowS)
-> Show StartDocumentTextDetection
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDocumentTextDetection] -> ShowS
$cshowList :: [StartDocumentTextDetection] -> ShowS
show :: StartDocumentTextDetection -> String
$cshow :: StartDocumentTextDetection -> String
showsPrec :: Int -> StartDocumentTextDetection -> ShowS
$cshowsPrec :: Int -> StartDocumentTextDetection -> ShowS
Prelude.Show, (forall x.
 StartDocumentTextDetection -> Rep StartDocumentTextDetection x)
-> (forall x.
    Rep StartDocumentTextDetection x -> StartDocumentTextDetection)
-> Generic StartDocumentTextDetection
forall x.
Rep StartDocumentTextDetection x -> StartDocumentTextDetection
forall x.
StartDocumentTextDetection -> Rep StartDocumentTextDetection x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDocumentTextDetection x -> StartDocumentTextDetection
$cfrom :: forall x.
StartDocumentTextDetection -> Rep StartDocumentTextDetection x
Prelude.Generic)

-- |
-- Create a value of 'StartDocumentTextDetection' 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:
--
-- 'jobTag', 'startDocumentTextDetection_jobTag' - An identifier that you specify that\'s included in the completion
-- notification published to the Amazon SNS topic. For example, you can use
-- @JobTag@ to identify the type of document that the completion
-- notification corresponds to (such as a tax form or a receipt).
--
-- 'notificationChannel', 'startDocumentTextDetection_notificationChannel' - The Amazon SNS topic ARN that you want Amazon Textract to publish the
-- completion status of the operation to.
--
-- 'kmsKeyId', 'startDocumentTextDetection_kmsKeyId' - The KMS key used to encrypt the inference results. This can be in either
-- Key ID or Key Alias format. When a KMS key is provided, the KMS key will
-- be used for server-side encryption of the objects in the customer
-- bucket. When this parameter is not enabled, the result will be encrypted
-- server side,using SSE-S3.
--
-- 'outputConfig', 'startDocumentTextDetection_outputConfig' - Sets if the output will go to a customer defined bucket. By default
-- Amazon Textract will save the results internally to be accessed with the
-- GetDocumentTextDetection operation.
--
-- 'clientRequestToken', 'startDocumentTextDetection_clientRequestToken' - The idempotent token that\'s used to identify the start request. If you
-- use the same token with multiple @StartDocumentTextDetection@ requests,
-- the same @JobId@ is returned. Use @ClientRequestToken@ to prevent the
-- same job from being accidentally started more than once. For more
-- information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/api-async.html Calling Amazon Textract Asynchronous Operations>.
--
-- 'documentLocation', 'startDocumentTextDetection_documentLocation' - The location of the document to be processed.
newStartDocumentTextDetection ::
  -- | 'documentLocation'
  DocumentLocation ->
  StartDocumentTextDetection
newStartDocumentTextDetection :: DocumentLocation -> StartDocumentTextDetection
newStartDocumentTextDetection DocumentLocation
pDocumentLocation_ =
  StartDocumentTextDetection' :: Maybe Text
-> Maybe NotificationChannel
-> Maybe Text
-> Maybe OutputConfig
-> Maybe Text
-> DocumentLocation
-> StartDocumentTextDetection
StartDocumentTextDetection'
    { $sel:jobTag:StartDocumentTextDetection' :: Maybe Text
jobTag =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:notificationChannel:StartDocumentTextDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:StartDocumentTextDetection' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputConfig:StartDocumentTextDetection' :: Maybe OutputConfig
outputConfig = Maybe OutputConfig
forall a. Maybe a
Prelude.Nothing,
      $sel:clientRequestToken:StartDocumentTextDetection' :: Maybe Text
clientRequestToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:documentLocation:StartDocumentTextDetection' :: DocumentLocation
documentLocation = DocumentLocation
pDocumentLocation_
    }

-- | An identifier that you specify that\'s included in the completion
-- notification published to the Amazon SNS topic. For example, you can use
-- @JobTag@ to identify the type of document that the completion
-- notification corresponds to (such as a tax form or a receipt).
startDocumentTextDetection_jobTag :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe Prelude.Text)
startDocumentTextDetection_jobTag :: (Maybe Text -> f (Maybe Text))
-> StartDocumentTextDetection -> f StartDocumentTextDetection
startDocumentTextDetection_jobTag = (StartDocumentTextDetection -> Maybe Text)
-> (StartDocumentTextDetection
    -> Maybe Text -> StartDocumentTextDetection)
-> Lens
     StartDocumentTextDetection
     StartDocumentTextDetection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe Text
jobTag :: Maybe Text
$sel:jobTag:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
jobTag} -> Maybe Text
jobTag) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe Text
a -> StartDocumentTextDetection
s {$sel:jobTag:StartDocumentTextDetection' :: Maybe Text
jobTag = Maybe Text
a} :: StartDocumentTextDetection)

-- | The Amazon SNS topic ARN that you want Amazon Textract to publish the
-- completion status of the operation to.
startDocumentTextDetection_notificationChannel :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe NotificationChannel)
startDocumentTextDetection_notificationChannel :: (Maybe NotificationChannel -> f (Maybe NotificationChannel))
-> StartDocumentTextDetection -> f StartDocumentTextDetection
startDocumentTextDetection_notificationChannel = (StartDocumentTextDetection -> Maybe NotificationChannel)
-> (StartDocumentTextDetection
    -> Maybe NotificationChannel -> StartDocumentTextDetection)
-> Lens
     StartDocumentTextDetection
     StartDocumentTextDetection
     (Maybe NotificationChannel)
     (Maybe NotificationChannel)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe NotificationChannel
notificationChannel :: Maybe NotificationChannel
$sel:notificationChannel:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe NotificationChannel
notificationChannel} -> Maybe NotificationChannel
notificationChannel) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe NotificationChannel
a -> StartDocumentTextDetection
s {$sel:notificationChannel:StartDocumentTextDetection' :: Maybe NotificationChannel
notificationChannel = Maybe NotificationChannel
a} :: StartDocumentTextDetection)

-- | The KMS key used to encrypt the inference results. This can be in either
-- Key ID or Key Alias format. When a KMS key is provided, the KMS key will
-- be used for server-side encryption of the objects in the customer
-- bucket. When this parameter is not enabled, the result will be encrypted
-- server side,using SSE-S3.
startDocumentTextDetection_kmsKeyId :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe Prelude.Text)
startDocumentTextDetection_kmsKeyId :: (Maybe Text -> f (Maybe Text))
-> StartDocumentTextDetection -> f StartDocumentTextDetection
startDocumentTextDetection_kmsKeyId = (StartDocumentTextDetection -> Maybe Text)
-> (StartDocumentTextDetection
    -> Maybe Text -> StartDocumentTextDetection)
-> Lens
     StartDocumentTextDetection
     StartDocumentTextDetection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe Text
a -> StartDocumentTextDetection
s {$sel:kmsKeyId:StartDocumentTextDetection' :: Maybe Text
kmsKeyId = Maybe Text
a} :: StartDocumentTextDetection)

-- | Sets if the output will go to a customer defined bucket. By default
-- Amazon Textract will save the results internally to be accessed with the
-- GetDocumentTextDetection operation.
startDocumentTextDetection_outputConfig :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe OutputConfig)
startDocumentTextDetection_outputConfig :: (Maybe OutputConfig -> f (Maybe OutputConfig))
-> StartDocumentTextDetection -> f StartDocumentTextDetection
startDocumentTextDetection_outputConfig = (StartDocumentTextDetection -> Maybe OutputConfig)
-> (StartDocumentTextDetection
    -> Maybe OutputConfig -> StartDocumentTextDetection)
-> Lens
     StartDocumentTextDetection
     StartDocumentTextDetection
     (Maybe OutputConfig)
     (Maybe OutputConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe OutputConfig
outputConfig :: Maybe OutputConfig
$sel:outputConfig:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe OutputConfig
outputConfig} -> Maybe OutputConfig
outputConfig) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe OutputConfig
a -> StartDocumentTextDetection
s {$sel:outputConfig:StartDocumentTextDetection' :: Maybe OutputConfig
outputConfig = Maybe OutputConfig
a} :: StartDocumentTextDetection)

-- | The idempotent token that\'s used to identify the start request. If you
-- use the same token with multiple @StartDocumentTextDetection@ requests,
-- the same @JobId@ is returned. Use @ClientRequestToken@ to prevent the
-- same job from being accidentally started more than once. For more
-- information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/api-async.html Calling Amazon Textract Asynchronous Operations>.
startDocumentTextDetection_clientRequestToken :: Lens.Lens' StartDocumentTextDetection (Prelude.Maybe Prelude.Text)
startDocumentTextDetection_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> StartDocumentTextDetection -> f StartDocumentTextDetection
startDocumentTextDetection_clientRequestToken = (StartDocumentTextDetection -> Maybe Text)
-> (StartDocumentTextDetection
    -> Maybe Text -> StartDocumentTextDetection)
-> Lens
     StartDocumentTextDetection
     StartDocumentTextDetection
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} Maybe Text
a -> StartDocumentTextDetection
s {$sel:clientRequestToken:StartDocumentTextDetection' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartDocumentTextDetection)

-- | The location of the document to be processed.
startDocumentTextDetection_documentLocation :: Lens.Lens' StartDocumentTextDetection DocumentLocation
startDocumentTextDetection_documentLocation :: (DocumentLocation -> f DocumentLocation)
-> StartDocumentTextDetection -> f StartDocumentTextDetection
startDocumentTextDetection_documentLocation = (StartDocumentTextDetection -> DocumentLocation)
-> (StartDocumentTextDetection
    -> DocumentLocation -> StartDocumentTextDetection)
-> Lens
     StartDocumentTextDetection
     StartDocumentTextDetection
     DocumentLocation
     DocumentLocation
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetection' {DocumentLocation
documentLocation :: DocumentLocation
$sel:documentLocation:StartDocumentTextDetection' :: StartDocumentTextDetection -> DocumentLocation
documentLocation} -> DocumentLocation
documentLocation) (\s :: StartDocumentTextDetection
s@StartDocumentTextDetection' {} DocumentLocation
a -> StartDocumentTextDetection
s {$sel:documentLocation:StartDocumentTextDetection' :: DocumentLocation
documentLocation = DocumentLocation
a} :: StartDocumentTextDetection)

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

instance Prelude.NFData StartDocumentTextDetection

instance Core.ToHeaders StartDocumentTextDetection where
  toHeaders :: StartDocumentTextDetection -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StartDocumentTextDetection -> 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
"Textract.StartDocumentTextDetection" ::
                          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 StartDocumentTextDetection where
  toJSON :: StartDocumentTextDetection -> Value
toJSON StartDocumentTextDetection' {Maybe Text
Maybe NotificationChannel
Maybe OutputConfig
DocumentLocation
documentLocation :: DocumentLocation
clientRequestToken :: Maybe Text
outputConfig :: Maybe OutputConfig
kmsKeyId :: Maybe Text
notificationChannel :: Maybe NotificationChannel
jobTag :: Maybe Text
$sel:documentLocation:StartDocumentTextDetection' :: StartDocumentTextDetection -> DocumentLocation
$sel:clientRequestToken:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:outputConfig:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe OutputConfig
$sel:kmsKeyId:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
$sel:notificationChannel:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe NotificationChannel
$sel:jobTag:StartDocumentTextDetection' :: StartDocumentTextDetection -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"JobTag" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jobTag,
            (Text
"NotificationChannel" Text -> NotificationChannel -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NotificationChannel -> Pair)
-> Maybe NotificationChannel -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationChannel
notificationChannel,
            (Text
"KMSKeyId" 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
kmsKeyId,
            (Text
"OutputConfig" Text -> OutputConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (OutputConfig -> Pair) -> Maybe OutputConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OutputConfig
outputConfig,
            (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
"DocumentLocation" Text -> DocumentLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= DocumentLocation
documentLocation)
          ]
      )

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

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

-- | /See:/ 'newStartDocumentTextDetectionResponse' smart constructor.
data StartDocumentTextDetectionResponse = StartDocumentTextDetectionResponse'
  { -- | The identifier of the text detection job for the document. Use @JobId@
    -- to identify the job in a subsequent call to @GetDocumentTextDetection@.
    -- A @JobId@ value is only valid for 7 days.
    StartDocumentTextDetectionResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StartDocumentTextDetectionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
(StartDocumentTextDetectionResponse
 -> StartDocumentTextDetectionResponse -> Bool)
-> (StartDocumentTextDetectionResponse
    -> StartDocumentTextDetectionResponse -> Bool)
-> Eq StartDocumentTextDetectionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
$c/= :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
== :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
$c== :: StartDocumentTextDetectionResponse
-> StartDocumentTextDetectionResponse -> Bool
Prelude.Eq, ReadPrec [StartDocumentTextDetectionResponse]
ReadPrec StartDocumentTextDetectionResponse
Int -> ReadS StartDocumentTextDetectionResponse
ReadS [StartDocumentTextDetectionResponse]
(Int -> ReadS StartDocumentTextDetectionResponse)
-> ReadS [StartDocumentTextDetectionResponse]
-> ReadPrec StartDocumentTextDetectionResponse
-> ReadPrec [StartDocumentTextDetectionResponse]
-> Read StartDocumentTextDetectionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDocumentTextDetectionResponse]
$creadListPrec :: ReadPrec [StartDocumentTextDetectionResponse]
readPrec :: ReadPrec StartDocumentTextDetectionResponse
$creadPrec :: ReadPrec StartDocumentTextDetectionResponse
readList :: ReadS [StartDocumentTextDetectionResponse]
$creadList :: ReadS [StartDocumentTextDetectionResponse]
readsPrec :: Int -> ReadS StartDocumentTextDetectionResponse
$creadsPrec :: Int -> ReadS StartDocumentTextDetectionResponse
Prelude.Read, Int -> StartDocumentTextDetectionResponse -> ShowS
[StartDocumentTextDetectionResponse] -> ShowS
StartDocumentTextDetectionResponse -> String
(Int -> StartDocumentTextDetectionResponse -> ShowS)
-> (StartDocumentTextDetectionResponse -> String)
-> ([StartDocumentTextDetectionResponse] -> ShowS)
-> Show StartDocumentTextDetectionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDocumentTextDetectionResponse] -> ShowS
$cshowList :: [StartDocumentTextDetectionResponse] -> ShowS
show :: StartDocumentTextDetectionResponse -> String
$cshow :: StartDocumentTextDetectionResponse -> String
showsPrec :: Int -> StartDocumentTextDetectionResponse -> ShowS
$cshowsPrec :: Int -> StartDocumentTextDetectionResponse -> ShowS
Prelude.Show, (forall x.
 StartDocumentTextDetectionResponse
 -> Rep StartDocumentTextDetectionResponse x)
-> (forall x.
    Rep StartDocumentTextDetectionResponse x
    -> StartDocumentTextDetectionResponse)
-> Generic StartDocumentTextDetectionResponse
forall x.
Rep StartDocumentTextDetectionResponse x
-> StartDocumentTextDetectionResponse
forall x.
StartDocumentTextDetectionResponse
-> Rep StartDocumentTextDetectionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartDocumentTextDetectionResponse x
-> StartDocumentTextDetectionResponse
$cfrom :: forall x.
StartDocumentTextDetectionResponse
-> Rep StartDocumentTextDetectionResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartDocumentTextDetectionResponse' 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', 'startDocumentTextDetectionResponse_jobId' - The identifier of the text detection job for the document. Use @JobId@
-- to identify the job in a subsequent call to @GetDocumentTextDetection@.
-- A @JobId@ value is only valid for 7 days.
--
-- 'httpStatus', 'startDocumentTextDetectionResponse_httpStatus' - The response's http status code.
newStartDocumentTextDetectionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartDocumentTextDetectionResponse
newStartDocumentTextDetectionResponse :: Int -> StartDocumentTextDetectionResponse
newStartDocumentTextDetectionResponse Int
pHttpStatus_ =
  StartDocumentTextDetectionResponse' :: Maybe Text -> Int -> StartDocumentTextDetectionResponse
StartDocumentTextDetectionResponse'
    { $sel:jobId:StartDocumentTextDetectionResponse' :: Maybe Text
jobId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartDocumentTextDetectionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of the text detection job for the document. Use @JobId@
-- to identify the job in a subsequent call to @GetDocumentTextDetection@.
-- A @JobId@ value is only valid for 7 days.
startDocumentTextDetectionResponse_jobId :: Lens.Lens' StartDocumentTextDetectionResponse (Prelude.Maybe Prelude.Text)
startDocumentTextDetectionResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> StartDocumentTextDetectionResponse
-> f StartDocumentTextDetectionResponse
startDocumentTextDetectionResponse_jobId = (StartDocumentTextDetectionResponse -> Maybe Text)
-> (StartDocumentTextDetectionResponse
    -> Maybe Text -> StartDocumentTextDetectionResponse)
-> Lens
     StartDocumentTextDetectionResponse
     StartDocumentTextDetectionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentTextDetectionResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartDocumentTextDetectionResponse' :: StartDocumentTextDetectionResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartDocumentTextDetectionResponse
s@StartDocumentTextDetectionResponse' {} Maybe Text
a -> StartDocumentTextDetectionResponse
s {$sel:jobId:StartDocumentTextDetectionResponse' :: Maybe Text
jobId = Maybe Text
a} :: StartDocumentTextDetectionResponse)

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

instance
  Prelude.NFData
    StartDocumentTextDetectionResponse