{-# 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.DescribeEventsDetectionJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the status and details of an events detection job.
module Amazonka.Comprehend.DescribeEventsDetectionJob
  ( -- * Creating a Request
    DescribeEventsDetectionJob (..),
    newDescribeEventsDetectionJob,

    -- * Request Lenses
    describeEventsDetectionJob_jobId,

    -- * Destructuring the Response
    DescribeEventsDetectionJobResponse (..),
    newDescribeEventsDetectionJobResponse,

    -- * Response Lenses
    describeEventsDetectionJobResponse_eventsDetectionJobProperties,
    describeEventsDetectionJobResponse_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:/ 'newDescribeEventsDetectionJob' smart constructor.
data DescribeEventsDetectionJob = DescribeEventsDetectionJob'
  { -- | The identifier of the events detection job.
    DescribeEventsDetectionJob -> Text
jobId :: Prelude.Text
  }
  deriving (DescribeEventsDetectionJob -> DescribeEventsDetectionJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventsDetectionJob -> DescribeEventsDetectionJob -> Bool
$c/= :: DescribeEventsDetectionJob -> DescribeEventsDetectionJob -> Bool
== :: DescribeEventsDetectionJob -> DescribeEventsDetectionJob -> Bool
$c== :: DescribeEventsDetectionJob -> DescribeEventsDetectionJob -> Bool
Prelude.Eq, ReadPrec [DescribeEventsDetectionJob]
ReadPrec DescribeEventsDetectionJob
Int -> ReadS DescribeEventsDetectionJob
ReadS [DescribeEventsDetectionJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventsDetectionJob]
$creadListPrec :: ReadPrec [DescribeEventsDetectionJob]
readPrec :: ReadPrec DescribeEventsDetectionJob
$creadPrec :: ReadPrec DescribeEventsDetectionJob
readList :: ReadS [DescribeEventsDetectionJob]
$creadList :: ReadS [DescribeEventsDetectionJob]
readsPrec :: Int -> ReadS DescribeEventsDetectionJob
$creadsPrec :: Int -> ReadS DescribeEventsDetectionJob
Prelude.Read, Int -> DescribeEventsDetectionJob -> ShowS
[DescribeEventsDetectionJob] -> ShowS
DescribeEventsDetectionJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventsDetectionJob] -> ShowS
$cshowList :: [DescribeEventsDetectionJob] -> ShowS
show :: DescribeEventsDetectionJob -> String
$cshow :: DescribeEventsDetectionJob -> String
showsPrec :: Int -> DescribeEventsDetectionJob -> ShowS
$cshowsPrec :: Int -> DescribeEventsDetectionJob -> ShowS
Prelude.Show, forall x.
Rep DescribeEventsDetectionJob x -> DescribeEventsDetectionJob
forall x.
DescribeEventsDetectionJob -> Rep DescribeEventsDetectionJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventsDetectionJob x -> DescribeEventsDetectionJob
$cfrom :: forall x.
DescribeEventsDetectionJob -> Rep DescribeEventsDetectionJob x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEventsDetectionJob' 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', 'describeEventsDetectionJob_jobId' - The identifier of the events detection job.
newDescribeEventsDetectionJob ::
  -- | 'jobId'
  Prelude.Text ->
  DescribeEventsDetectionJob
newDescribeEventsDetectionJob :: Text -> DescribeEventsDetectionJob
newDescribeEventsDetectionJob Text
pJobId_ =
  DescribeEventsDetectionJob' {$sel:jobId:DescribeEventsDetectionJob' :: Text
jobId = Text
pJobId_}

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

instance Core.AWSRequest DescribeEventsDetectionJob where
  type
    AWSResponse DescribeEventsDetectionJob =
      DescribeEventsDetectionJobResponse
  request :: (Service -> Service)
-> DescribeEventsDetectionJob -> Request DescribeEventsDetectionJob
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 DescribeEventsDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEventsDetectionJob)))
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 EventsDetectionJobProperties
-> Int -> DescribeEventsDetectionJobResponse
DescribeEventsDetectionJobResponse'
            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
"EventsDetectionJobProperties")
            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 DescribeEventsDetectionJob where
  hashWithSalt :: Int -> DescribeEventsDetectionJob -> Int
hashWithSalt Int
_salt DescribeEventsDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeEventsDetectionJob' :: DescribeEventsDetectionJob -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId

instance Prelude.NFData DescribeEventsDetectionJob where
  rnf :: DescribeEventsDetectionJob -> ()
rnf DescribeEventsDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeEventsDetectionJob' :: DescribeEventsDetectionJob -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
jobId

instance Data.ToHeaders DescribeEventsDetectionJob where
  toHeaders :: DescribeEventsDetectionJob -> 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.DescribeEventsDetectionJob" ::
                          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 DescribeEventsDetectionJob where
  toJSON :: DescribeEventsDetectionJob -> Value
toJSON DescribeEventsDetectionJob' {Text
jobId :: Text
$sel:jobId:DescribeEventsDetectionJob' :: DescribeEventsDetectionJob -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"JobId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
jobId)]
      )

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

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

-- | /See:/ 'newDescribeEventsDetectionJobResponse' smart constructor.
data DescribeEventsDetectionJobResponse = DescribeEventsDetectionJobResponse'
  { -- | An object that contains the properties associated with an event
    -- detection job.
    DescribeEventsDetectionJobResponse
-> Maybe EventsDetectionJobProperties
eventsDetectionJobProperties :: Prelude.Maybe EventsDetectionJobProperties,
    -- | The response's http status code.
    DescribeEventsDetectionJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DescribeEventsDetectionJobResponse
-> DescribeEventsDetectionJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeEventsDetectionJobResponse
-> DescribeEventsDetectionJobResponse -> Bool
$c/= :: DescribeEventsDetectionJobResponse
-> DescribeEventsDetectionJobResponse -> Bool
== :: DescribeEventsDetectionJobResponse
-> DescribeEventsDetectionJobResponse -> Bool
$c== :: DescribeEventsDetectionJobResponse
-> DescribeEventsDetectionJobResponse -> Bool
Prelude.Eq, ReadPrec [DescribeEventsDetectionJobResponse]
ReadPrec DescribeEventsDetectionJobResponse
Int -> ReadS DescribeEventsDetectionJobResponse
ReadS [DescribeEventsDetectionJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeEventsDetectionJobResponse]
$creadListPrec :: ReadPrec [DescribeEventsDetectionJobResponse]
readPrec :: ReadPrec DescribeEventsDetectionJobResponse
$creadPrec :: ReadPrec DescribeEventsDetectionJobResponse
readList :: ReadS [DescribeEventsDetectionJobResponse]
$creadList :: ReadS [DescribeEventsDetectionJobResponse]
readsPrec :: Int -> ReadS DescribeEventsDetectionJobResponse
$creadsPrec :: Int -> ReadS DescribeEventsDetectionJobResponse
Prelude.Read, Int -> DescribeEventsDetectionJobResponse -> ShowS
[DescribeEventsDetectionJobResponse] -> ShowS
DescribeEventsDetectionJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeEventsDetectionJobResponse] -> ShowS
$cshowList :: [DescribeEventsDetectionJobResponse] -> ShowS
show :: DescribeEventsDetectionJobResponse -> String
$cshow :: DescribeEventsDetectionJobResponse -> String
showsPrec :: Int -> DescribeEventsDetectionJobResponse -> ShowS
$cshowsPrec :: Int -> DescribeEventsDetectionJobResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeEventsDetectionJobResponse x
-> DescribeEventsDetectionJobResponse
forall x.
DescribeEventsDetectionJobResponse
-> Rep DescribeEventsDetectionJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeEventsDetectionJobResponse x
-> DescribeEventsDetectionJobResponse
$cfrom :: forall x.
DescribeEventsDetectionJobResponse
-> Rep DescribeEventsDetectionJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribeEventsDetectionJobResponse' 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:
--
-- 'eventsDetectionJobProperties', 'describeEventsDetectionJobResponse_eventsDetectionJobProperties' - An object that contains the properties associated with an event
-- detection job.
--
-- 'httpStatus', 'describeEventsDetectionJobResponse_httpStatus' - The response's http status code.
newDescribeEventsDetectionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribeEventsDetectionJobResponse
newDescribeEventsDetectionJobResponse :: Int -> DescribeEventsDetectionJobResponse
newDescribeEventsDetectionJobResponse Int
pHttpStatus_ =
  DescribeEventsDetectionJobResponse'
    { $sel:eventsDetectionJobProperties:DescribeEventsDetectionJobResponse' :: Maybe EventsDetectionJobProperties
eventsDetectionJobProperties =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribeEventsDetectionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that contains the properties associated with an event
-- detection job.
describeEventsDetectionJobResponse_eventsDetectionJobProperties :: Lens.Lens' DescribeEventsDetectionJobResponse (Prelude.Maybe EventsDetectionJobProperties)
describeEventsDetectionJobResponse_eventsDetectionJobProperties :: Lens'
  DescribeEventsDetectionJobResponse
  (Maybe EventsDetectionJobProperties)
describeEventsDetectionJobResponse_eventsDetectionJobProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeEventsDetectionJobResponse' {Maybe EventsDetectionJobProperties
eventsDetectionJobProperties :: Maybe EventsDetectionJobProperties
$sel:eventsDetectionJobProperties:DescribeEventsDetectionJobResponse' :: DescribeEventsDetectionJobResponse
-> Maybe EventsDetectionJobProperties
eventsDetectionJobProperties} -> Maybe EventsDetectionJobProperties
eventsDetectionJobProperties) (\s :: DescribeEventsDetectionJobResponse
s@DescribeEventsDetectionJobResponse' {} Maybe EventsDetectionJobProperties
a -> DescribeEventsDetectionJobResponse
s {$sel:eventsDetectionJobProperties:DescribeEventsDetectionJobResponse' :: Maybe EventsDetectionJobProperties
eventsDetectionJobProperties = Maybe EventsDetectionJobProperties
a} :: DescribeEventsDetectionJobResponse)

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

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