{-# 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.StartDocumentAnalysis
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Starts the asynchronous analysis of an input document for relationships
-- between detected items such as key-value pairs, tables, and selection
-- elements.
--
-- @StartDocumentAnalysis@ can analyze text in documents that are in JPEG,
-- PNG, TIFF, 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.
--
-- @StartDocumentAnalysis@ returns a job identifier (@JobId@) that you use
-- to get the results of the operation. When text analysis 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 analysis
-- operation, first check that the status value published to the Amazon SNS
-- topic is @SUCCEEDED@. If so, call GetDocumentAnalysis, and pass the job
-- identifier (@JobId@) from the initial call to @StartDocumentAnalysis@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html Document Text Analysis>.
module Amazonka.Textract.StartDocumentAnalysis
  ( -- * Creating a Request
    StartDocumentAnalysis (..),
    newStartDocumentAnalysis,

    -- * Request Lenses
    startDocumentAnalysis_clientRequestToken,
    startDocumentAnalysis_jobTag,
    startDocumentAnalysis_kmsKeyId,
    startDocumentAnalysis_notificationChannel,
    startDocumentAnalysis_outputConfig,
    startDocumentAnalysis_queriesConfig,
    startDocumentAnalysis_documentLocation,
    startDocumentAnalysis_featureTypes,

    -- * Destructuring the Response
    StartDocumentAnalysisResponse (..),
    newStartDocumentAnalysisResponse,

    -- * Response Lenses
    startDocumentAnalysisResponse_jobId,
    startDocumentAnalysisResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Textract.Types

-- | /See:/ 'newStartDocumentAnalysis' smart constructor.
data StartDocumentAnalysis = StartDocumentAnalysis'
  { -- | The idempotent token that you use to identify the start request. If you
    -- use the same token with multiple @StartDocumentAnalysis@ 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>.
    StartDocumentAnalysis -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | 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).
    StartDocumentAnalysis -> Maybe Text
jobTag :: Prelude.Maybe Prelude.Text,
    -- | 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.
    StartDocumentAnalysis -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon SNS topic ARN that you want Amazon Textract to publish the
    -- completion status of the operation to.
    StartDocumentAnalysis -> Maybe NotificationChannel
notificationChannel :: Prelude.Maybe NotificationChannel,
    -- | Sets if the output will go to a customer defined bucket. By default,
    -- Amazon Textract will save the results internally to be accessed by the
    -- GetDocumentAnalysis operation.
    StartDocumentAnalysis -> Maybe OutputConfig
outputConfig :: Prelude.Maybe OutputConfig,
    StartDocumentAnalysis -> Maybe QueriesConfig
queriesConfig :: Prelude.Maybe QueriesConfig,
    -- | The location of the document to be processed.
    StartDocumentAnalysis -> DocumentLocation
documentLocation :: DocumentLocation,
    -- | A list of the types of analysis to perform. Add TABLES to the list to
    -- return information about the tables that are detected in the input
    -- document. Add FORMS to return detected form data. To perform both types
    -- of analysis, add TABLES and FORMS to @FeatureTypes@. All lines and words
    -- detected in the document are included in the response (including text
    -- that isn\'t related to the value of @FeatureTypes@).
    StartDocumentAnalysis -> [FeatureType]
featureTypes :: [FeatureType]
  }
  deriving (StartDocumentAnalysis -> StartDocumentAnalysis -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDocumentAnalysis -> StartDocumentAnalysis -> Bool
$c/= :: StartDocumentAnalysis -> StartDocumentAnalysis -> Bool
== :: StartDocumentAnalysis -> StartDocumentAnalysis -> Bool
$c== :: StartDocumentAnalysis -> StartDocumentAnalysis -> Bool
Prelude.Eq, ReadPrec [StartDocumentAnalysis]
ReadPrec StartDocumentAnalysis
Int -> ReadS StartDocumentAnalysis
ReadS [StartDocumentAnalysis]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDocumentAnalysis]
$creadListPrec :: ReadPrec [StartDocumentAnalysis]
readPrec :: ReadPrec StartDocumentAnalysis
$creadPrec :: ReadPrec StartDocumentAnalysis
readList :: ReadS [StartDocumentAnalysis]
$creadList :: ReadS [StartDocumentAnalysis]
readsPrec :: Int -> ReadS StartDocumentAnalysis
$creadsPrec :: Int -> ReadS StartDocumentAnalysis
Prelude.Read, Int -> StartDocumentAnalysis -> ShowS
[StartDocumentAnalysis] -> ShowS
StartDocumentAnalysis -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDocumentAnalysis] -> ShowS
$cshowList :: [StartDocumentAnalysis] -> ShowS
show :: StartDocumentAnalysis -> String
$cshow :: StartDocumentAnalysis -> String
showsPrec :: Int -> StartDocumentAnalysis -> ShowS
$cshowsPrec :: Int -> StartDocumentAnalysis -> ShowS
Prelude.Show, forall x. Rep StartDocumentAnalysis x -> StartDocumentAnalysis
forall x. StartDocumentAnalysis -> Rep StartDocumentAnalysis x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartDocumentAnalysis x -> StartDocumentAnalysis
$cfrom :: forall x. StartDocumentAnalysis -> Rep StartDocumentAnalysis x
Prelude.Generic)

-- |
-- Create a value of 'StartDocumentAnalysis' 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:
--
-- 'clientRequestToken', 'startDocumentAnalysis_clientRequestToken' - The idempotent token that you use to identify the start request. If you
-- use the same token with multiple @StartDocumentAnalysis@ 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>.
--
-- 'jobTag', 'startDocumentAnalysis_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).
--
-- 'kmsKeyId', 'startDocumentAnalysis_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.
--
-- 'notificationChannel', 'startDocumentAnalysis_notificationChannel' - The Amazon SNS topic ARN that you want Amazon Textract to publish the
-- completion status of the operation to.
--
-- 'outputConfig', 'startDocumentAnalysis_outputConfig' - Sets if the output will go to a customer defined bucket. By default,
-- Amazon Textract will save the results internally to be accessed by the
-- GetDocumentAnalysis operation.
--
-- 'queriesConfig', 'startDocumentAnalysis_queriesConfig' - Undocumented member.
--
-- 'documentLocation', 'startDocumentAnalysis_documentLocation' - The location of the document to be processed.
--
-- 'featureTypes', 'startDocumentAnalysis_featureTypes' - A list of the types of analysis to perform. Add TABLES to the list to
-- return information about the tables that are detected in the input
-- document. Add FORMS to return detected form data. To perform both types
-- of analysis, add TABLES and FORMS to @FeatureTypes@. All lines and words
-- detected in the document are included in the response (including text
-- that isn\'t related to the value of @FeatureTypes@).
newStartDocumentAnalysis ::
  -- | 'documentLocation'
  DocumentLocation ->
  StartDocumentAnalysis
newStartDocumentAnalysis :: DocumentLocation -> StartDocumentAnalysis
newStartDocumentAnalysis DocumentLocation
pDocumentLocation_ =
  StartDocumentAnalysis'
    { $sel:clientRequestToken:StartDocumentAnalysis' :: Maybe Text
clientRequestToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:jobTag:StartDocumentAnalysis' :: Maybe Text
jobTag = forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:StartDocumentAnalysis' :: Maybe Text
kmsKeyId = forall a. Maybe a
Prelude.Nothing,
      $sel:notificationChannel:StartDocumentAnalysis' :: Maybe NotificationChannel
notificationChannel = forall a. Maybe a
Prelude.Nothing,
      $sel:outputConfig:StartDocumentAnalysis' :: Maybe OutputConfig
outputConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:queriesConfig:StartDocumentAnalysis' :: Maybe QueriesConfig
queriesConfig = forall a. Maybe a
Prelude.Nothing,
      $sel:documentLocation:StartDocumentAnalysis' :: DocumentLocation
documentLocation = DocumentLocation
pDocumentLocation_,
      $sel:featureTypes:StartDocumentAnalysis' :: [FeatureType]
featureTypes = forall a. Monoid a => a
Prelude.mempty
    }

-- | The idempotent token that you use to identify the start request. If you
-- use the same token with multiple @StartDocumentAnalysis@ 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>.
startDocumentAnalysis_clientRequestToken :: Lens.Lens' StartDocumentAnalysis (Prelude.Maybe Prelude.Text)
startDocumentAnalysis_clientRequestToken :: Lens' StartDocumentAnalysis (Maybe Text)
startDocumentAnalysis_clientRequestToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentAnalysis' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: StartDocumentAnalysis
s@StartDocumentAnalysis' {} Maybe Text
a -> StartDocumentAnalysis
s {$sel:clientRequestToken:StartDocumentAnalysis' :: Maybe Text
clientRequestToken = Maybe Text
a} :: StartDocumentAnalysis)

-- | 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).
startDocumentAnalysis_jobTag :: Lens.Lens' StartDocumentAnalysis (Prelude.Maybe Prelude.Text)
startDocumentAnalysis_jobTag :: Lens' StartDocumentAnalysis (Maybe Text)
startDocumentAnalysis_jobTag = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentAnalysis' {Maybe Text
jobTag :: Maybe Text
$sel:jobTag:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
jobTag} -> Maybe Text
jobTag) (\s :: StartDocumentAnalysis
s@StartDocumentAnalysis' {} Maybe Text
a -> StartDocumentAnalysis
s {$sel:jobTag:StartDocumentAnalysis' :: Maybe Text
jobTag = Maybe Text
a} :: StartDocumentAnalysis)

-- | 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.
startDocumentAnalysis_kmsKeyId :: Lens.Lens' StartDocumentAnalysis (Prelude.Maybe Prelude.Text)
startDocumentAnalysis_kmsKeyId :: Lens' StartDocumentAnalysis (Maybe Text)
startDocumentAnalysis_kmsKeyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentAnalysis' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: StartDocumentAnalysis
s@StartDocumentAnalysis' {} Maybe Text
a -> StartDocumentAnalysis
s {$sel:kmsKeyId:StartDocumentAnalysis' :: Maybe Text
kmsKeyId = Maybe Text
a} :: StartDocumentAnalysis)

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

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

-- | Undocumented member.
startDocumentAnalysis_queriesConfig :: Lens.Lens' StartDocumentAnalysis (Prelude.Maybe QueriesConfig)
startDocumentAnalysis_queriesConfig :: Lens' StartDocumentAnalysis (Maybe QueriesConfig)
startDocumentAnalysis_queriesConfig = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentAnalysis' {Maybe QueriesConfig
queriesConfig :: Maybe QueriesConfig
$sel:queriesConfig:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe QueriesConfig
queriesConfig} -> Maybe QueriesConfig
queriesConfig) (\s :: StartDocumentAnalysis
s@StartDocumentAnalysis' {} Maybe QueriesConfig
a -> StartDocumentAnalysis
s {$sel:queriesConfig:StartDocumentAnalysis' :: Maybe QueriesConfig
queriesConfig = Maybe QueriesConfig
a} :: StartDocumentAnalysis)

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

-- | A list of the types of analysis to perform. Add TABLES to the list to
-- return information about the tables that are detected in the input
-- document. Add FORMS to return detected form data. To perform both types
-- of analysis, add TABLES and FORMS to @FeatureTypes@. All lines and words
-- detected in the document are included in the response (including text
-- that isn\'t related to the value of @FeatureTypes@).
startDocumentAnalysis_featureTypes :: Lens.Lens' StartDocumentAnalysis [FeatureType]
startDocumentAnalysis_featureTypes :: Lens' StartDocumentAnalysis [FeatureType]
startDocumentAnalysis_featureTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDocumentAnalysis' {[FeatureType]
featureTypes :: [FeatureType]
$sel:featureTypes:StartDocumentAnalysis' :: StartDocumentAnalysis -> [FeatureType]
featureTypes} -> [FeatureType]
featureTypes) (\s :: StartDocumentAnalysis
s@StartDocumentAnalysis' {} [FeatureType]
a -> StartDocumentAnalysis
s {$sel:featureTypes:StartDocumentAnalysis' :: [FeatureType]
featureTypes = [FeatureType]
a} :: StartDocumentAnalysis) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest StartDocumentAnalysis where
  type
    AWSResponse StartDocumentAnalysis =
      StartDocumentAnalysisResponse
  request :: (Service -> Service)
-> StartDocumentAnalysis -> Request StartDocumentAnalysis
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StartDocumentAnalysis
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartDocumentAnalysis)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> StartDocumentAnalysisResponse
StartDocumentAnalysisResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"JobId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StartDocumentAnalysis where
  hashWithSalt :: Int -> StartDocumentAnalysis -> Int
hashWithSalt Int
_salt StartDocumentAnalysis' {[FeatureType]
Maybe Text
Maybe NotificationChannel
Maybe OutputConfig
Maybe QueriesConfig
DocumentLocation
featureTypes :: [FeatureType]
documentLocation :: DocumentLocation
queriesConfig :: Maybe QueriesConfig
outputConfig :: Maybe OutputConfig
notificationChannel :: Maybe NotificationChannel
kmsKeyId :: Maybe Text
jobTag :: Maybe Text
clientRequestToken :: Maybe Text
$sel:featureTypes:StartDocumentAnalysis' :: StartDocumentAnalysis -> [FeatureType]
$sel:documentLocation:StartDocumentAnalysis' :: StartDocumentAnalysis -> DocumentLocation
$sel:queriesConfig:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe QueriesConfig
$sel:outputConfig:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe OutputConfig
$sel:notificationChannel:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe NotificationChannel
$sel:kmsKeyId:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
$sel:jobTag:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
$sel:clientRequestToken:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientRequestToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
jobTag
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
kmsKeyId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe NotificationChannel
notificationChannel
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe OutputConfig
outputConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe QueriesConfig
queriesConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DocumentLocation
documentLocation
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [FeatureType]
featureTypes

instance Prelude.NFData StartDocumentAnalysis where
  rnf :: StartDocumentAnalysis -> ()
rnf StartDocumentAnalysis' {[FeatureType]
Maybe Text
Maybe NotificationChannel
Maybe OutputConfig
Maybe QueriesConfig
DocumentLocation
featureTypes :: [FeatureType]
documentLocation :: DocumentLocation
queriesConfig :: Maybe QueriesConfig
outputConfig :: Maybe OutputConfig
notificationChannel :: Maybe NotificationChannel
kmsKeyId :: Maybe Text
jobTag :: Maybe Text
clientRequestToken :: Maybe Text
$sel:featureTypes:StartDocumentAnalysis' :: StartDocumentAnalysis -> [FeatureType]
$sel:documentLocation:StartDocumentAnalysis' :: StartDocumentAnalysis -> DocumentLocation
$sel:queriesConfig:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe QueriesConfig
$sel:outputConfig:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe OutputConfig
$sel:notificationChannel:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe NotificationChannel
$sel:kmsKeyId:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
$sel:jobTag:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
$sel:clientRequestToken:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientRequestToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobTag
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
kmsKeyId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe NotificationChannel
notificationChannel
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe OutputConfig
outputConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe QueriesConfig
queriesConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DocumentLocation
documentLocation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [FeatureType]
featureTypes

instance Data.ToHeaders StartDocumentAnalysis where
  toHeaders :: StartDocumentAnalysis -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Textract.StartDocumentAnalysis" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StartDocumentAnalysis where
  toJSON :: StartDocumentAnalysis -> Value
toJSON StartDocumentAnalysis' {[FeatureType]
Maybe Text
Maybe NotificationChannel
Maybe OutputConfig
Maybe QueriesConfig
DocumentLocation
featureTypes :: [FeatureType]
documentLocation :: DocumentLocation
queriesConfig :: Maybe QueriesConfig
outputConfig :: Maybe OutputConfig
notificationChannel :: Maybe NotificationChannel
kmsKeyId :: Maybe Text
jobTag :: Maybe Text
clientRequestToken :: Maybe Text
$sel:featureTypes:StartDocumentAnalysis' :: StartDocumentAnalysis -> [FeatureType]
$sel:documentLocation:StartDocumentAnalysis' :: StartDocumentAnalysis -> DocumentLocation
$sel:queriesConfig:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe QueriesConfig
$sel:outputConfig:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe OutputConfig
$sel:notificationChannel:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe NotificationChannel
$sel:kmsKeyId:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
$sel:jobTag:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
$sel:clientRequestToken:StartDocumentAnalysis' :: StartDocumentAnalysis -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"ClientRequestToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientRequestToken,
            (Key
"JobTag" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
jobTag,
            (Key
"KMSKeyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKeyId,
            (Key
"NotificationChannel" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe NotificationChannel
notificationChannel,
            (Key
"OutputConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OutputConfig
outputConfig,
            (Key
"QueriesConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe QueriesConfig
queriesConfig,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DocumentLocation" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= DocumentLocation
documentLocation),
            forall a. a -> Maybe a
Prelude.Just (Key
"FeatureTypes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [FeatureType]
featureTypes)
          ]
      )

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

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

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

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

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

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

instance Prelude.NFData StartDocumentAnalysisResponse where
  rnf :: StartDocumentAnalysisResponse -> ()
rnf StartDocumentAnalysisResponse' {Int
Maybe Text
httpStatus :: Int
jobId :: Maybe Text
$sel:httpStatus:StartDocumentAnalysisResponse' :: StartDocumentAnalysisResponse -> Int
$sel:jobId:StartDocumentAnalysisResponse' :: StartDocumentAnalysisResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus