{-# 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.Comprehend.StartEventsDetectionJob
-- 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 an asynchronous event detection job for a collection of
-- documents.
module Amazonka.Comprehend.StartEventsDetectionJob
  ( -- * Creating a Request
    StartEventsDetectionJob (..),
    newStartEventsDetectionJob,

    -- * Request Lenses
    startEventsDetectionJob_clientRequestToken,
    startEventsDetectionJob_jobName,
    startEventsDetectionJob_tags,
    startEventsDetectionJob_inputDataConfig,
    startEventsDetectionJob_outputDataConfig,
    startEventsDetectionJob_dataAccessRoleArn,
    startEventsDetectionJob_languageCode,
    startEventsDetectionJob_targetEventTypes,

    -- * Destructuring the Response
    StartEventsDetectionJobResponse (..),
    newStartEventsDetectionJobResponse,

    -- * Response Lenses
    startEventsDetectionJobResponse_jobArn,
    startEventsDetectionJobResponse_jobId,
    startEventsDetectionJobResponse_jobStatus,
    startEventsDetectionJobResponse_httpStatus,
  )
where

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

-- | /See:/ 'newStartEventsDetectionJob' smart constructor.
data StartEventsDetectionJob = StartEventsDetectionJob'
  { -- | An unique identifier for the request. If you don\'t set the client
    -- request token, Amazon Comprehend generates one.
    StartEventsDetectionJob -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the events detection job.
    StartEventsDetectionJob -> Maybe Text
jobName :: Prelude.Maybe Prelude.Text,
    -- | Tags to be associated with the events detection job. A tag is a
    -- key-value pair that adds metadata to a resource used by Amazon
    -- Comprehend. For example, a tag with \"Sales\" as the key might be added
    -- to a resource to indicate its use by the sales department.
    StartEventsDetectionJob -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | Specifies the format and location of the input data for the job.
    StartEventsDetectionJob -> InputDataConfig
inputDataConfig :: InputDataConfig,
    -- | Specifies where to send the output files.
    StartEventsDetectionJob -> OutputDataConfig
outputDataConfig :: OutputDataConfig,
    -- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
    -- (IAM) role that grants Amazon Comprehend read access to your input data.
    StartEventsDetectionJob -> Text
dataAccessRoleArn :: Prelude.Text,
    -- | The language code of the input documents.
    StartEventsDetectionJob -> LanguageCode
languageCode :: LanguageCode,
    -- | The types of events to detect in the input documents.
    StartEventsDetectionJob -> NonEmpty Text
targetEventTypes :: Prelude.NonEmpty Prelude.Text
  }
  deriving (StartEventsDetectionJob -> StartEventsDetectionJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartEventsDetectionJob -> StartEventsDetectionJob -> Bool
$c/= :: StartEventsDetectionJob -> StartEventsDetectionJob -> Bool
== :: StartEventsDetectionJob -> StartEventsDetectionJob -> Bool
$c== :: StartEventsDetectionJob -> StartEventsDetectionJob -> Bool
Prelude.Eq, ReadPrec [StartEventsDetectionJob]
ReadPrec StartEventsDetectionJob
Int -> ReadS StartEventsDetectionJob
ReadS [StartEventsDetectionJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartEventsDetectionJob]
$creadListPrec :: ReadPrec [StartEventsDetectionJob]
readPrec :: ReadPrec StartEventsDetectionJob
$creadPrec :: ReadPrec StartEventsDetectionJob
readList :: ReadS [StartEventsDetectionJob]
$creadList :: ReadS [StartEventsDetectionJob]
readsPrec :: Int -> ReadS StartEventsDetectionJob
$creadsPrec :: Int -> ReadS StartEventsDetectionJob
Prelude.Read, Int -> StartEventsDetectionJob -> ShowS
[StartEventsDetectionJob] -> ShowS
StartEventsDetectionJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartEventsDetectionJob] -> ShowS
$cshowList :: [StartEventsDetectionJob] -> ShowS
show :: StartEventsDetectionJob -> String
$cshow :: StartEventsDetectionJob -> String
showsPrec :: Int -> StartEventsDetectionJob -> ShowS
$cshowsPrec :: Int -> StartEventsDetectionJob -> ShowS
Prelude.Show, forall x. Rep StartEventsDetectionJob x -> StartEventsDetectionJob
forall x. StartEventsDetectionJob -> Rep StartEventsDetectionJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartEventsDetectionJob x -> StartEventsDetectionJob
$cfrom :: forall x. StartEventsDetectionJob -> Rep StartEventsDetectionJob x
Prelude.Generic)

-- |
-- Create a value of 'StartEventsDetectionJob' 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', 'startEventsDetectionJob_clientRequestToken' - An unique identifier for the request. If you don\'t set the client
-- request token, Amazon Comprehend generates one.
--
-- 'jobName', 'startEventsDetectionJob_jobName' - The identifier of the events detection job.
--
-- 'tags', 'startEventsDetectionJob_tags' - Tags to be associated with the events detection job. A tag is a
-- key-value pair that adds metadata to a resource used by Amazon
-- Comprehend. For example, a tag with \"Sales\" as the key might be added
-- to a resource to indicate its use by the sales department.
--
-- 'inputDataConfig', 'startEventsDetectionJob_inputDataConfig' - Specifies the format and location of the input data for the job.
--
-- 'outputDataConfig', 'startEventsDetectionJob_outputDataConfig' - Specifies where to send the output files.
--
-- 'dataAccessRoleArn', 'startEventsDetectionJob_dataAccessRoleArn' - The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that grants Amazon Comprehend read access to your input data.
--
-- 'languageCode', 'startEventsDetectionJob_languageCode' - The language code of the input documents.
--
-- 'targetEventTypes', 'startEventsDetectionJob_targetEventTypes' - The types of events to detect in the input documents.
newStartEventsDetectionJob ::
  -- | 'inputDataConfig'
  InputDataConfig ->
  -- | 'outputDataConfig'
  OutputDataConfig ->
  -- | 'dataAccessRoleArn'
  Prelude.Text ->
  -- | 'languageCode'
  LanguageCode ->
  -- | 'targetEventTypes'
  Prelude.NonEmpty Prelude.Text ->
  StartEventsDetectionJob
newStartEventsDetectionJob :: InputDataConfig
-> OutputDataConfig
-> Text
-> LanguageCode
-> NonEmpty Text
-> StartEventsDetectionJob
newStartEventsDetectionJob
  InputDataConfig
pInputDataConfig_
  OutputDataConfig
pOutputDataConfig_
  Text
pDataAccessRoleArn_
  LanguageCode
pLanguageCode_
  NonEmpty Text
pTargetEventTypes_ =
    StartEventsDetectionJob'
      { $sel:clientRequestToken:StartEventsDetectionJob' :: Maybe Text
clientRequestToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:jobName:StartEventsDetectionJob' :: Maybe Text
jobName = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:StartEventsDetectionJob' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:inputDataConfig:StartEventsDetectionJob' :: InputDataConfig
inputDataConfig = InputDataConfig
pInputDataConfig_,
        $sel:outputDataConfig:StartEventsDetectionJob' :: OutputDataConfig
outputDataConfig = OutputDataConfig
pOutputDataConfig_,
        $sel:dataAccessRoleArn:StartEventsDetectionJob' :: Text
dataAccessRoleArn = Text
pDataAccessRoleArn_,
        $sel:languageCode:StartEventsDetectionJob' :: LanguageCode
languageCode = LanguageCode
pLanguageCode_,
        $sel:targetEventTypes:StartEventsDetectionJob' :: NonEmpty Text
targetEventTypes =
          forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTargetEventTypes_
      }

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

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

-- | Tags to be associated with the events detection job. A tag is a
-- key-value pair that adds metadata to a resource used by Amazon
-- Comprehend. For example, a tag with \"Sales\" as the key might be added
-- to a resource to indicate its use by the sales department.
startEventsDetectionJob_tags :: Lens.Lens' StartEventsDetectionJob (Prelude.Maybe [Tag])
startEventsDetectionJob_tags :: Lens' StartEventsDetectionJob (Maybe [Tag])
startEventsDetectionJob_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEventsDetectionJob' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:StartEventsDetectionJob' :: StartEventsDetectionJob -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: StartEventsDetectionJob
s@StartEventsDetectionJob' {} Maybe [Tag]
a -> StartEventsDetectionJob
s {$sel:tags:StartEventsDetectionJob' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: StartEventsDetectionJob) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

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

-- | The Amazon Resource Name (ARN) of the AWS Identity and Access Management
-- (IAM) role that grants Amazon Comprehend read access to your input data.
startEventsDetectionJob_dataAccessRoleArn :: Lens.Lens' StartEventsDetectionJob Prelude.Text
startEventsDetectionJob_dataAccessRoleArn :: Lens' StartEventsDetectionJob Text
startEventsDetectionJob_dataAccessRoleArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEventsDetectionJob' {Text
dataAccessRoleArn :: Text
$sel:dataAccessRoleArn:StartEventsDetectionJob' :: StartEventsDetectionJob -> Text
dataAccessRoleArn} -> Text
dataAccessRoleArn) (\s :: StartEventsDetectionJob
s@StartEventsDetectionJob' {} Text
a -> StartEventsDetectionJob
s {$sel:dataAccessRoleArn:StartEventsDetectionJob' :: Text
dataAccessRoleArn = Text
a} :: StartEventsDetectionJob)

-- | The language code of the input documents.
startEventsDetectionJob_languageCode :: Lens.Lens' StartEventsDetectionJob LanguageCode
startEventsDetectionJob_languageCode :: Lens' StartEventsDetectionJob LanguageCode
startEventsDetectionJob_languageCode = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEventsDetectionJob' {LanguageCode
languageCode :: LanguageCode
$sel:languageCode:StartEventsDetectionJob' :: StartEventsDetectionJob -> LanguageCode
languageCode} -> LanguageCode
languageCode) (\s :: StartEventsDetectionJob
s@StartEventsDetectionJob' {} LanguageCode
a -> StartEventsDetectionJob
s {$sel:languageCode:StartEventsDetectionJob' :: LanguageCode
languageCode = LanguageCode
a} :: StartEventsDetectionJob)

-- | The types of events to detect in the input documents.
startEventsDetectionJob_targetEventTypes :: Lens.Lens' StartEventsDetectionJob (Prelude.NonEmpty Prelude.Text)
startEventsDetectionJob_targetEventTypes :: Lens' StartEventsDetectionJob (NonEmpty Text)
startEventsDetectionJob_targetEventTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEventsDetectionJob' {NonEmpty Text
targetEventTypes :: NonEmpty Text
$sel:targetEventTypes:StartEventsDetectionJob' :: StartEventsDetectionJob -> NonEmpty Text
targetEventTypes} -> NonEmpty Text
targetEventTypes) (\s :: StartEventsDetectionJob
s@StartEventsDetectionJob' {} NonEmpty Text
a -> StartEventsDetectionJob
s {$sel:targetEventTypes:StartEventsDetectionJob' :: NonEmpty Text
targetEventTypes = NonEmpty Text
a} :: StartEventsDetectionJob) 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 StartEventsDetectionJob where
  type
    AWSResponse StartEventsDetectionJob =
      StartEventsDetectionJobResponse
  request :: (Service -> Service)
-> StartEventsDetectionJob -> Request StartEventsDetectionJob
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 StartEventsDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StartEventsDetectionJob)))
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
-> Maybe Text
-> Maybe JobStatus
-> Int
-> StartEventsDetectionJobResponse
StartEventsDetectionJobResponse'
            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
"JobArn")
            forall (f :: * -> *) a b. Applicative f => 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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"JobStatus")
            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 StartEventsDetectionJob where
  hashWithSalt :: Int -> StartEventsDetectionJob -> Int
hashWithSalt Int
_salt StartEventsDetectionJob' {Maybe [Tag]
Maybe Text
NonEmpty Text
Text
InputDataConfig
LanguageCode
OutputDataConfig
targetEventTypes :: NonEmpty Text
languageCode :: LanguageCode
dataAccessRoleArn :: Text
outputDataConfig :: OutputDataConfig
inputDataConfig :: InputDataConfig
tags :: Maybe [Tag]
jobName :: Maybe Text
clientRequestToken :: Maybe Text
$sel:targetEventTypes:StartEventsDetectionJob' :: StartEventsDetectionJob -> NonEmpty Text
$sel:languageCode:StartEventsDetectionJob' :: StartEventsDetectionJob -> LanguageCode
$sel:dataAccessRoleArn:StartEventsDetectionJob' :: StartEventsDetectionJob -> Text
$sel:outputDataConfig:StartEventsDetectionJob' :: StartEventsDetectionJob -> OutputDataConfig
$sel:inputDataConfig:StartEventsDetectionJob' :: StartEventsDetectionJob -> InputDataConfig
$sel:tags:StartEventsDetectionJob' :: StartEventsDetectionJob -> Maybe [Tag]
$sel:jobName:StartEventsDetectionJob' :: StartEventsDetectionJob -> Maybe Text
$sel:clientRequestToken:StartEventsDetectionJob' :: StartEventsDetectionJob -> 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
jobName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` InputDataConfig
inputDataConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` OutputDataConfig
outputDataConfig
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
dataAccessRoleArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` LanguageCode
languageCode
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
targetEventTypes

instance Prelude.NFData StartEventsDetectionJob where
  rnf :: StartEventsDetectionJob -> ()
rnf StartEventsDetectionJob' {Maybe [Tag]
Maybe Text
NonEmpty Text
Text
InputDataConfig
LanguageCode
OutputDataConfig
targetEventTypes :: NonEmpty Text
languageCode :: LanguageCode
dataAccessRoleArn :: Text
outputDataConfig :: OutputDataConfig
inputDataConfig :: InputDataConfig
tags :: Maybe [Tag]
jobName :: Maybe Text
clientRequestToken :: Maybe Text
$sel:targetEventTypes:StartEventsDetectionJob' :: StartEventsDetectionJob -> NonEmpty Text
$sel:languageCode:StartEventsDetectionJob' :: StartEventsDetectionJob -> LanguageCode
$sel:dataAccessRoleArn:StartEventsDetectionJob' :: StartEventsDetectionJob -> Text
$sel:outputDataConfig:StartEventsDetectionJob' :: StartEventsDetectionJob -> OutputDataConfig
$sel:inputDataConfig:StartEventsDetectionJob' :: StartEventsDetectionJob -> InputDataConfig
$sel:tags:StartEventsDetectionJob' :: StartEventsDetectionJob -> Maybe [Tag]
$sel:jobName:StartEventsDetectionJob' :: StartEventsDetectionJob -> Maybe Text
$sel:clientRequestToken:StartEventsDetectionJob' :: StartEventsDetectionJob -> 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
jobName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf InputDataConfig
inputDataConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf OutputDataConfig
outputDataConfig
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
dataAccessRoleArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf LanguageCode
languageCode
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
targetEventTypes

instance Data.ToHeaders StartEventsDetectionJob where
  toHeaders :: StartEventsDetectionJob -> 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
"Comprehend_20171127.StartEventsDetectionJob" ::
                          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 StartEventsDetectionJob where
  toJSON :: StartEventsDetectionJob -> Value
toJSON StartEventsDetectionJob' {Maybe [Tag]
Maybe Text
NonEmpty Text
Text
InputDataConfig
LanguageCode
OutputDataConfig
targetEventTypes :: NonEmpty Text
languageCode :: LanguageCode
dataAccessRoleArn :: Text
outputDataConfig :: OutputDataConfig
inputDataConfig :: InputDataConfig
tags :: Maybe [Tag]
jobName :: Maybe Text
clientRequestToken :: Maybe Text
$sel:targetEventTypes:StartEventsDetectionJob' :: StartEventsDetectionJob -> NonEmpty Text
$sel:languageCode:StartEventsDetectionJob' :: StartEventsDetectionJob -> LanguageCode
$sel:dataAccessRoleArn:StartEventsDetectionJob' :: StartEventsDetectionJob -> Text
$sel:outputDataConfig:StartEventsDetectionJob' :: StartEventsDetectionJob -> OutputDataConfig
$sel:inputDataConfig:StartEventsDetectionJob' :: StartEventsDetectionJob -> InputDataConfig
$sel:tags:StartEventsDetectionJob' :: StartEventsDetectionJob -> Maybe [Tag]
$sel:jobName:StartEventsDetectionJob' :: StartEventsDetectionJob -> Maybe Text
$sel:clientRequestToken:StartEventsDetectionJob' :: StartEventsDetectionJob -> 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
"JobName" 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
jobName,
            (Key
"Tags" 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 [Tag]
tags,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"InputDataConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= InputDataConfig
inputDataConfig),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"OutputDataConfig" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= OutputDataConfig
outputDataConfig),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"DataAccessRoleArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
dataAccessRoleArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"LanguageCode" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= LanguageCode
languageCode),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"TargetEventTypes" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
targetEventTypes)
          ]
      )

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

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

-- | /See:/ 'newStartEventsDetectionJobResponse' smart constructor.
data StartEventsDetectionJobResponse = StartEventsDetectionJobResponse'
  { -- | The Amazon Resource Name (ARN) of the events detection job. It is a
    -- unique, fully qualified identifier for the job. It includes the AWS
    -- account, Region, and the job ID. The format of the ARN is as follows:
    --
    -- @arn:\<partition>:comprehend:\<region>:\<account-id>:events-detection-job\/\<job-id>@
    --
    -- The following is an example job ARN:
    --
    -- @arn:aws:comprehend:us-west-2:111122223333:events-detection-job\/1234abcd12ab34cd56ef1234567890ab@
    StartEventsDetectionJobResponse -> Maybe Text
jobArn :: Prelude.Maybe Prelude.Text,
    -- | An unique identifier for the request. If you don\'t set the client
    -- request token, Amazon Comprehend generates one.
    StartEventsDetectionJobResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The status of the events detection job.
    StartEventsDetectionJobResponse -> Maybe JobStatus
jobStatus :: Prelude.Maybe JobStatus,
    -- | The response's http status code.
    StartEventsDetectionJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StartEventsDetectionJobResponse
-> StartEventsDetectionJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartEventsDetectionJobResponse
-> StartEventsDetectionJobResponse -> Bool
$c/= :: StartEventsDetectionJobResponse
-> StartEventsDetectionJobResponse -> Bool
== :: StartEventsDetectionJobResponse
-> StartEventsDetectionJobResponse -> Bool
$c== :: StartEventsDetectionJobResponse
-> StartEventsDetectionJobResponse -> Bool
Prelude.Eq, ReadPrec [StartEventsDetectionJobResponse]
ReadPrec StartEventsDetectionJobResponse
Int -> ReadS StartEventsDetectionJobResponse
ReadS [StartEventsDetectionJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartEventsDetectionJobResponse]
$creadListPrec :: ReadPrec [StartEventsDetectionJobResponse]
readPrec :: ReadPrec StartEventsDetectionJobResponse
$creadPrec :: ReadPrec StartEventsDetectionJobResponse
readList :: ReadS [StartEventsDetectionJobResponse]
$creadList :: ReadS [StartEventsDetectionJobResponse]
readsPrec :: Int -> ReadS StartEventsDetectionJobResponse
$creadsPrec :: Int -> ReadS StartEventsDetectionJobResponse
Prelude.Read, Int -> StartEventsDetectionJobResponse -> ShowS
[StartEventsDetectionJobResponse] -> ShowS
StartEventsDetectionJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartEventsDetectionJobResponse] -> ShowS
$cshowList :: [StartEventsDetectionJobResponse] -> ShowS
show :: StartEventsDetectionJobResponse -> String
$cshow :: StartEventsDetectionJobResponse -> String
showsPrec :: Int -> StartEventsDetectionJobResponse -> ShowS
$cshowsPrec :: Int -> StartEventsDetectionJobResponse -> ShowS
Prelude.Show, forall x.
Rep StartEventsDetectionJobResponse x
-> StartEventsDetectionJobResponse
forall x.
StartEventsDetectionJobResponse
-> Rep StartEventsDetectionJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartEventsDetectionJobResponse x
-> StartEventsDetectionJobResponse
$cfrom :: forall x.
StartEventsDetectionJobResponse
-> Rep StartEventsDetectionJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StartEventsDetectionJobResponse' 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:
--
-- 'jobArn', 'startEventsDetectionJobResponse_jobArn' - The Amazon Resource Name (ARN) of the events detection job. It is a
-- unique, fully qualified identifier for the job. It includes the AWS
-- account, Region, and the job ID. The format of the ARN is as follows:
--
-- @arn:\<partition>:comprehend:\<region>:\<account-id>:events-detection-job\/\<job-id>@
--
-- The following is an example job ARN:
--
-- @arn:aws:comprehend:us-west-2:111122223333:events-detection-job\/1234abcd12ab34cd56ef1234567890ab@
--
-- 'jobId', 'startEventsDetectionJobResponse_jobId' - An unique identifier for the request. If you don\'t set the client
-- request token, Amazon Comprehend generates one.
--
-- 'jobStatus', 'startEventsDetectionJobResponse_jobStatus' - The status of the events detection job.
--
-- 'httpStatus', 'startEventsDetectionJobResponse_httpStatus' - The response's http status code.
newStartEventsDetectionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartEventsDetectionJobResponse
newStartEventsDetectionJobResponse :: Int -> StartEventsDetectionJobResponse
newStartEventsDetectionJobResponse Int
pHttpStatus_ =
  StartEventsDetectionJobResponse'
    { $sel:jobArn:StartEventsDetectionJobResponse' :: Maybe Text
jobArn =
        forall a. Maybe a
Prelude.Nothing,
      $sel:jobId:StartEventsDetectionJobResponse' :: Maybe Text
jobId = forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:StartEventsDetectionJobResponse' :: Maybe JobStatus
jobStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StartEventsDetectionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the events detection job. It is a
-- unique, fully qualified identifier for the job. It includes the AWS
-- account, Region, and the job ID. The format of the ARN is as follows:
--
-- @arn:\<partition>:comprehend:\<region>:\<account-id>:events-detection-job\/\<job-id>@
--
-- The following is an example job ARN:
--
-- @arn:aws:comprehend:us-west-2:111122223333:events-detection-job\/1234abcd12ab34cd56ef1234567890ab@
startEventsDetectionJobResponse_jobArn :: Lens.Lens' StartEventsDetectionJobResponse (Prelude.Maybe Prelude.Text)
startEventsDetectionJobResponse_jobArn :: Lens' StartEventsDetectionJobResponse (Maybe Text)
startEventsDetectionJobResponse_jobArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEventsDetectionJobResponse' {Maybe Text
jobArn :: Maybe Text
$sel:jobArn:StartEventsDetectionJobResponse' :: StartEventsDetectionJobResponse -> Maybe Text
jobArn} -> Maybe Text
jobArn) (\s :: StartEventsDetectionJobResponse
s@StartEventsDetectionJobResponse' {} Maybe Text
a -> StartEventsDetectionJobResponse
s {$sel:jobArn:StartEventsDetectionJobResponse' :: Maybe Text
jobArn = Maybe Text
a} :: StartEventsDetectionJobResponse)

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

-- | The status of the events detection job.
startEventsDetectionJobResponse_jobStatus :: Lens.Lens' StartEventsDetectionJobResponse (Prelude.Maybe JobStatus)
startEventsDetectionJobResponse_jobStatus :: Lens' StartEventsDetectionJobResponse (Maybe JobStatus)
startEventsDetectionJobResponse_jobStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartEventsDetectionJobResponse' {Maybe JobStatus
jobStatus :: Maybe JobStatus
$sel:jobStatus:StartEventsDetectionJobResponse' :: StartEventsDetectionJobResponse -> Maybe JobStatus
jobStatus} -> Maybe JobStatus
jobStatus) (\s :: StartEventsDetectionJobResponse
s@StartEventsDetectionJobResponse' {} Maybe JobStatus
a -> StartEventsDetectionJobResponse
s {$sel:jobStatus:StartEventsDetectionJobResponse' :: Maybe JobStatus
jobStatus = Maybe JobStatus
a} :: StartEventsDetectionJobResponse)

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

instance
  Prelude.NFData
    StartEventsDetectionJobResponse
  where
  rnf :: StartEventsDetectionJobResponse -> ()
rnf StartEventsDetectionJobResponse' {Int
Maybe Text
Maybe JobStatus
httpStatus :: Int
jobStatus :: Maybe JobStatus
jobId :: Maybe Text
jobArn :: Maybe Text
$sel:httpStatus:StartEventsDetectionJobResponse' :: StartEventsDetectionJobResponse -> Int
$sel:jobStatus:StartEventsDetectionJobResponse' :: StartEventsDetectionJobResponse -> Maybe JobStatus
$sel:jobId:StartEventsDetectionJobResponse' :: StartEventsDetectionJobResponse -> Maybe Text
$sel:jobArn:StartEventsDetectionJobResponse' :: StartEventsDetectionJobResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
jobArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Maybe JobStatus
jobStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus