{-# 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-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)
--
-- 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.Lens as Lens
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
(DescribeEventsDetectionJob -> DescribeEventsDetectionJob -> Bool)
-> (DescribeEventsDetectionJob
    -> DescribeEventsDetectionJob -> Bool)
-> Eq DescribeEventsDetectionJob
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]
(Int -> ReadS DescribeEventsDetectionJob)
-> ReadS [DescribeEventsDetectionJob]
-> ReadPrec DescribeEventsDetectionJob
-> ReadPrec [DescribeEventsDetectionJob]
-> Read 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
(Int -> DescribeEventsDetectionJob -> ShowS)
-> (DescribeEventsDetectionJob -> String)
-> ([DescribeEventsDetectionJob] -> ShowS)
-> Show DescribeEventsDetectionJob
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.
 DescribeEventsDetectionJob -> Rep DescribeEventsDetectionJob x)
-> (forall x.
    Rep DescribeEventsDetectionJob x -> DescribeEventsDetectionJob)
-> Generic DescribeEventsDetectionJob
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' :: Text -> DescribeEventsDetectionJob
DescribeEventsDetectionJob' {$sel:jobId:DescribeEventsDetectionJob' :: Text
jobId = Text
pJobId_}

-- | The identifier of the events detection job.
describeEventsDetectionJob_jobId :: Lens.Lens' DescribeEventsDetectionJob Prelude.Text
describeEventsDetectionJob_jobId :: (Text -> f Text)
-> DescribeEventsDetectionJob -> f DescribeEventsDetectionJob
describeEventsDetectionJob_jobId = (DescribeEventsDetectionJob -> Text)
-> (DescribeEventsDetectionJob
    -> Text -> DescribeEventsDetectionJob)
-> Lens
     DescribeEventsDetectionJob DescribeEventsDetectionJob Text Text
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 :: DescribeEventsDetectionJob -> Request DescribeEventsDetectionJob
request = Service
-> DescribeEventsDetectionJob -> Request DescribeEventsDetectionJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeEventsDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEventsDetectionJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeEventsDetectionJob))
-> Logger
-> Service
-> Proxy DescribeEventsDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribeEventsDetectionJob)))
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 EventsDetectionJobProperties
-> Int -> DescribeEventsDetectionJobResponse
DescribeEventsDetectionJobResponse'
            (Maybe EventsDetectionJobProperties
 -> Int -> DescribeEventsDetectionJobResponse)
-> Either String (Maybe EventsDetectionJobProperties)
-> Either String (Int -> DescribeEventsDetectionJobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Either String (Maybe EventsDetectionJobProperties)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EventsDetectionJobProperties")
            Either String (Int -> DescribeEventsDetectionJobResponse)
-> Either String Int
-> Either String DescribeEventsDetectionJobResponse
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 DescribeEventsDetectionJob

instance Prelude.NFData DescribeEventsDetectionJob

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

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

instance Core.ToQuery DescribeEventsDetectionJob where
  toQuery :: DescribeEventsDetectionJob -> QueryString
toQuery = QueryString -> DescribeEventsDetectionJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DescribeEventsDetectionJobResponse
 -> DescribeEventsDetectionJobResponse -> Bool)
-> (DescribeEventsDetectionJobResponse
    -> DescribeEventsDetectionJobResponse -> Bool)
-> Eq DescribeEventsDetectionJobResponse
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]
(Int -> ReadS DescribeEventsDetectionJobResponse)
-> ReadS [DescribeEventsDetectionJobResponse]
-> ReadPrec DescribeEventsDetectionJobResponse
-> ReadPrec [DescribeEventsDetectionJobResponse]
-> Read 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
(Int -> DescribeEventsDetectionJobResponse -> ShowS)
-> (DescribeEventsDetectionJobResponse -> String)
-> ([DescribeEventsDetectionJobResponse] -> ShowS)
-> Show DescribeEventsDetectionJobResponse
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.
 DescribeEventsDetectionJobResponse
 -> Rep DescribeEventsDetectionJobResponse x)
-> (forall x.
    Rep DescribeEventsDetectionJobResponse x
    -> DescribeEventsDetectionJobResponse)
-> Generic DescribeEventsDetectionJobResponse
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' :: Maybe EventsDetectionJobProperties
-> Int -> DescribeEventsDetectionJobResponse
DescribeEventsDetectionJobResponse'
    { $sel:eventsDetectionJobProperties:DescribeEventsDetectionJobResponse' :: Maybe EventsDetectionJobProperties
eventsDetectionJobProperties =
        Maybe 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 :: (Maybe EventsDetectionJobProperties
 -> f (Maybe EventsDetectionJobProperties))
-> DescribeEventsDetectionJobResponse
-> f DescribeEventsDetectionJobResponse
describeEventsDetectionJobResponse_eventsDetectionJobProperties = (DescribeEventsDetectionJobResponse
 -> Maybe EventsDetectionJobProperties)
-> (DescribeEventsDetectionJobResponse
    -> Maybe EventsDetectionJobProperties
    -> DescribeEventsDetectionJobResponse)
-> Lens
     DescribeEventsDetectionJobResponse
     DescribeEventsDetectionJobResponse
     (Maybe EventsDetectionJobProperties)
     (Maybe 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 :: (Int -> f Int)
-> DescribeEventsDetectionJobResponse
-> f DescribeEventsDetectionJobResponse
describeEventsDetectionJobResponse_httpStatus = (DescribeEventsDetectionJobResponse -> Int)
-> (DescribeEventsDetectionJobResponse
    -> Int -> DescribeEventsDetectionJobResponse)
-> Lens
     DescribeEventsDetectionJobResponse
     DescribeEventsDetectionJobResponse
     Int
     Int
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