{-# 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.ComprehendMedical.StopEntitiesDetectionV2Job
-- 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)
--
-- Stops a medical entities detection job in progress.
module Amazonka.ComprehendMedical.StopEntitiesDetectionV2Job
  ( -- * Creating a Request
    StopEntitiesDetectionV2Job (..),
    newStopEntitiesDetectionV2Job,

    -- * Request Lenses
    stopEntitiesDetectionV2Job_jobId,

    -- * Destructuring the Response
    StopEntitiesDetectionV2JobResponse (..),
    newStopEntitiesDetectionV2JobResponse,

    -- * Response Lenses
    stopEntitiesDetectionV2JobResponse_jobId,
    stopEntitiesDetectionV2JobResponse_httpStatus,
  )
where

import Amazonka.ComprehendMedical.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:/ 'newStopEntitiesDetectionV2Job' smart constructor.
data StopEntitiesDetectionV2Job = StopEntitiesDetectionV2Job'
  { -- | The identifier of the medical entities job to stop.
    StopEntitiesDetectionV2Job -> Text
jobId :: Prelude.Text
  }
  deriving (StopEntitiesDetectionV2Job -> StopEntitiesDetectionV2Job -> Bool
(StopEntitiesDetectionV2Job -> StopEntitiesDetectionV2Job -> Bool)
-> (StopEntitiesDetectionV2Job
    -> StopEntitiesDetectionV2Job -> Bool)
-> Eq StopEntitiesDetectionV2Job
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopEntitiesDetectionV2Job -> StopEntitiesDetectionV2Job -> Bool
$c/= :: StopEntitiesDetectionV2Job -> StopEntitiesDetectionV2Job -> Bool
== :: StopEntitiesDetectionV2Job -> StopEntitiesDetectionV2Job -> Bool
$c== :: StopEntitiesDetectionV2Job -> StopEntitiesDetectionV2Job -> Bool
Prelude.Eq, ReadPrec [StopEntitiesDetectionV2Job]
ReadPrec StopEntitiesDetectionV2Job
Int -> ReadS StopEntitiesDetectionV2Job
ReadS [StopEntitiesDetectionV2Job]
(Int -> ReadS StopEntitiesDetectionV2Job)
-> ReadS [StopEntitiesDetectionV2Job]
-> ReadPrec StopEntitiesDetectionV2Job
-> ReadPrec [StopEntitiesDetectionV2Job]
-> Read StopEntitiesDetectionV2Job
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopEntitiesDetectionV2Job]
$creadListPrec :: ReadPrec [StopEntitiesDetectionV2Job]
readPrec :: ReadPrec StopEntitiesDetectionV2Job
$creadPrec :: ReadPrec StopEntitiesDetectionV2Job
readList :: ReadS [StopEntitiesDetectionV2Job]
$creadList :: ReadS [StopEntitiesDetectionV2Job]
readsPrec :: Int -> ReadS StopEntitiesDetectionV2Job
$creadsPrec :: Int -> ReadS StopEntitiesDetectionV2Job
Prelude.Read, Int -> StopEntitiesDetectionV2Job -> ShowS
[StopEntitiesDetectionV2Job] -> ShowS
StopEntitiesDetectionV2Job -> String
(Int -> StopEntitiesDetectionV2Job -> ShowS)
-> (StopEntitiesDetectionV2Job -> String)
-> ([StopEntitiesDetectionV2Job] -> ShowS)
-> Show StopEntitiesDetectionV2Job
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopEntitiesDetectionV2Job] -> ShowS
$cshowList :: [StopEntitiesDetectionV2Job] -> ShowS
show :: StopEntitiesDetectionV2Job -> String
$cshow :: StopEntitiesDetectionV2Job -> String
showsPrec :: Int -> StopEntitiesDetectionV2Job -> ShowS
$cshowsPrec :: Int -> StopEntitiesDetectionV2Job -> ShowS
Prelude.Show, (forall x.
 StopEntitiesDetectionV2Job -> Rep StopEntitiesDetectionV2Job x)
-> (forall x.
    Rep StopEntitiesDetectionV2Job x -> StopEntitiesDetectionV2Job)
-> Generic StopEntitiesDetectionV2Job
forall x.
Rep StopEntitiesDetectionV2Job x -> StopEntitiesDetectionV2Job
forall x.
StopEntitiesDetectionV2Job -> Rep StopEntitiesDetectionV2Job x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopEntitiesDetectionV2Job x -> StopEntitiesDetectionV2Job
$cfrom :: forall x.
StopEntitiesDetectionV2Job -> Rep StopEntitiesDetectionV2Job x
Prelude.Generic)

-- |
-- Create a value of 'StopEntitiesDetectionV2Job' 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', 'stopEntitiesDetectionV2Job_jobId' - The identifier of the medical entities job to stop.
newStopEntitiesDetectionV2Job ::
  -- | 'jobId'
  Prelude.Text ->
  StopEntitiesDetectionV2Job
newStopEntitiesDetectionV2Job :: Text -> StopEntitiesDetectionV2Job
newStopEntitiesDetectionV2Job Text
pJobId_ =
  StopEntitiesDetectionV2Job' :: Text -> StopEntitiesDetectionV2Job
StopEntitiesDetectionV2Job' {$sel:jobId:StopEntitiesDetectionV2Job' :: Text
jobId = Text
pJobId_}

-- | The identifier of the medical entities job to stop.
stopEntitiesDetectionV2Job_jobId :: Lens.Lens' StopEntitiesDetectionV2Job Prelude.Text
stopEntitiesDetectionV2Job_jobId :: (Text -> f Text)
-> StopEntitiesDetectionV2Job -> f StopEntitiesDetectionV2Job
stopEntitiesDetectionV2Job_jobId = (StopEntitiesDetectionV2Job -> Text)
-> (StopEntitiesDetectionV2Job
    -> Text -> StopEntitiesDetectionV2Job)
-> Lens
     StopEntitiesDetectionV2Job StopEntitiesDetectionV2Job Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopEntitiesDetectionV2Job' {Text
jobId :: Text
$sel:jobId:StopEntitiesDetectionV2Job' :: StopEntitiesDetectionV2Job -> Text
jobId} -> Text
jobId) (\s :: StopEntitiesDetectionV2Job
s@StopEntitiesDetectionV2Job' {} Text
a -> StopEntitiesDetectionV2Job
s {$sel:jobId:StopEntitiesDetectionV2Job' :: Text
jobId = Text
a} :: StopEntitiesDetectionV2Job)

instance Core.AWSRequest StopEntitiesDetectionV2Job where
  type
    AWSResponse StopEntitiesDetectionV2Job =
      StopEntitiesDetectionV2JobResponse
  request :: StopEntitiesDetectionV2Job -> Request StopEntitiesDetectionV2Job
request = Service
-> StopEntitiesDetectionV2Job -> Request StopEntitiesDetectionV2Job
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopEntitiesDetectionV2Job
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopEntitiesDetectionV2Job)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StopEntitiesDetectionV2Job))
-> Logger
-> Service
-> Proxy StopEntitiesDetectionV2Job
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopEntitiesDetectionV2Job)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> StopEntitiesDetectionV2JobResponse
StopEntitiesDetectionV2JobResponse'
            (Maybe Text -> Int -> StopEntitiesDetectionV2JobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StopEntitiesDetectionV2JobResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"JobId")
            Either String (Int -> StopEntitiesDetectionV2JobResponse)
-> Either String Int
-> Either String StopEntitiesDetectionV2JobResponse
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 StopEntitiesDetectionV2Job

instance Prelude.NFData StopEntitiesDetectionV2Job

instance Core.ToHeaders StopEntitiesDetectionV2Job where
  toHeaders :: StopEntitiesDetectionV2Job -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopEntitiesDetectionV2Job -> 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
"ComprehendMedical_20181030.StopEntitiesDetectionV2Job" ::
                          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 StopEntitiesDetectionV2Job where
  toJSON :: StopEntitiesDetectionV2Job -> Value
toJSON StopEntitiesDetectionV2Job' {Text
jobId :: Text
$sel:jobId:StopEntitiesDetectionV2Job' :: StopEntitiesDetectionV2Job -> 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 StopEntitiesDetectionV2Job where
  toPath :: StopEntitiesDetectionV2Job -> ByteString
toPath = ByteString -> StopEntitiesDetectionV2Job -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newStopEntitiesDetectionV2JobResponse' smart constructor.
data StopEntitiesDetectionV2JobResponse = StopEntitiesDetectionV2JobResponse'
  { -- | The identifier of the medical entities detection job that was stopped.
    StopEntitiesDetectionV2JobResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StopEntitiesDetectionV2JobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StopEntitiesDetectionV2JobResponse
-> StopEntitiesDetectionV2JobResponse -> Bool
(StopEntitiesDetectionV2JobResponse
 -> StopEntitiesDetectionV2JobResponse -> Bool)
-> (StopEntitiesDetectionV2JobResponse
    -> StopEntitiesDetectionV2JobResponse -> Bool)
-> Eq StopEntitiesDetectionV2JobResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopEntitiesDetectionV2JobResponse
-> StopEntitiesDetectionV2JobResponse -> Bool
$c/= :: StopEntitiesDetectionV2JobResponse
-> StopEntitiesDetectionV2JobResponse -> Bool
== :: StopEntitiesDetectionV2JobResponse
-> StopEntitiesDetectionV2JobResponse -> Bool
$c== :: StopEntitiesDetectionV2JobResponse
-> StopEntitiesDetectionV2JobResponse -> Bool
Prelude.Eq, ReadPrec [StopEntitiesDetectionV2JobResponse]
ReadPrec StopEntitiesDetectionV2JobResponse
Int -> ReadS StopEntitiesDetectionV2JobResponse
ReadS [StopEntitiesDetectionV2JobResponse]
(Int -> ReadS StopEntitiesDetectionV2JobResponse)
-> ReadS [StopEntitiesDetectionV2JobResponse]
-> ReadPrec StopEntitiesDetectionV2JobResponse
-> ReadPrec [StopEntitiesDetectionV2JobResponse]
-> Read StopEntitiesDetectionV2JobResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopEntitiesDetectionV2JobResponse]
$creadListPrec :: ReadPrec [StopEntitiesDetectionV2JobResponse]
readPrec :: ReadPrec StopEntitiesDetectionV2JobResponse
$creadPrec :: ReadPrec StopEntitiesDetectionV2JobResponse
readList :: ReadS [StopEntitiesDetectionV2JobResponse]
$creadList :: ReadS [StopEntitiesDetectionV2JobResponse]
readsPrec :: Int -> ReadS StopEntitiesDetectionV2JobResponse
$creadsPrec :: Int -> ReadS StopEntitiesDetectionV2JobResponse
Prelude.Read, Int -> StopEntitiesDetectionV2JobResponse -> ShowS
[StopEntitiesDetectionV2JobResponse] -> ShowS
StopEntitiesDetectionV2JobResponse -> String
(Int -> StopEntitiesDetectionV2JobResponse -> ShowS)
-> (StopEntitiesDetectionV2JobResponse -> String)
-> ([StopEntitiesDetectionV2JobResponse] -> ShowS)
-> Show StopEntitiesDetectionV2JobResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopEntitiesDetectionV2JobResponse] -> ShowS
$cshowList :: [StopEntitiesDetectionV2JobResponse] -> ShowS
show :: StopEntitiesDetectionV2JobResponse -> String
$cshow :: StopEntitiesDetectionV2JobResponse -> String
showsPrec :: Int -> StopEntitiesDetectionV2JobResponse -> ShowS
$cshowsPrec :: Int -> StopEntitiesDetectionV2JobResponse -> ShowS
Prelude.Show, (forall x.
 StopEntitiesDetectionV2JobResponse
 -> Rep StopEntitiesDetectionV2JobResponse x)
-> (forall x.
    Rep StopEntitiesDetectionV2JobResponse x
    -> StopEntitiesDetectionV2JobResponse)
-> Generic StopEntitiesDetectionV2JobResponse
forall x.
Rep StopEntitiesDetectionV2JobResponse x
-> StopEntitiesDetectionV2JobResponse
forall x.
StopEntitiesDetectionV2JobResponse
-> Rep StopEntitiesDetectionV2JobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopEntitiesDetectionV2JobResponse x
-> StopEntitiesDetectionV2JobResponse
$cfrom :: forall x.
StopEntitiesDetectionV2JobResponse
-> Rep StopEntitiesDetectionV2JobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopEntitiesDetectionV2JobResponse' 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', 'stopEntitiesDetectionV2JobResponse_jobId' - The identifier of the medical entities detection job that was stopped.
--
-- 'httpStatus', 'stopEntitiesDetectionV2JobResponse_httpStatus' - The response's http status code.
newStopEntitiesDetectionV2JobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopEntitiesDetectionV2JobResponse
newStopEntitiesDetectionV2JobResponse :: Int -> StopEntitiesDetectionV2JobResponse
newStopEntitiesDetectionV2JobResponse Int
pHttpStatus_ =
  StopEntitiesDetectionV2JobResponse' :: Maybe Text -> Int -> StopEntitiesDetectionV2JobResponse
StopEntitiesDetectionV2JobResponse'
    { $sel:jobId:StopEntitiesDetectionV2JobResponse' :: Maybe Text
jobId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StopEntitiesDetectionV2JobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of the medical entities detection job that was stopped.
stopEntitiesDetectionV2JobResponse_jobId :: Lens.Lens' StopEntitiesDetectionV2JobResponse (Prelude.Maybe Prelude.Text)
stopEntitiesDetectionV2JobResponse_jobId :: (Maybe Text -> f (Maybe Text))
-> StopEntitiesDetectionV2JobResponse
-> f StopEntitiesDetectionV2JobResponse
stopEntitiesDetectionV2JobResponse_jobId = (StopEntitiesDetectionV2JobResponse -> Maybe Text)
-> (StopEntitiesDetectionV2JobResponse
    -> Maybe Text -> StopEntitiesDetectionV2JobResponse)
-> Lens
     StopEntitiesDetectionV2JobResponse
     StopEntitiesDetectionV2JobResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopEntitiesDetectionV2JobResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StopEntitiesDetectionV2JobResponse' :: StopEntitiesDetectionV2JobResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StopEntitiesDetectionV2JobResponse
s@StopEntitiesDetectionV2JobResponse' {} Maybe Text
a -> StopEntitiesDetectionV2JobResponse
s {$sel:jobId:StopEntitiesDetectionV2JobResponse' :: Maybe Text
jobId = Maybe Text
a} :: StopEntitiesDetectionV2JobResponse)

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

instance
  Prelude.NFData
    StopEntitiesDetectionV2JobResponse