{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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:/ 'newStopEntitiesDetectionV2Job' smart constructor.
data StopEntitiesDetectionV2Job = StopEntitiesDetectionV2Job'
  { -- | The identifier of the medical entities job to stop.
    StopEntitiesDetectionV2Job -> Text
jobId :: Prelude.Text
  }
  deriving (StopEntitiesDetectionV2Job -> StopEntitiesDetectionV2Job -> Bool
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]
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
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.
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' {$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 :: Lens' StopEntitiesDetectionV2Job Text
stopEntitiesDetectionV2Job_jobId = 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 :: (Service -> Service)
-> StopEntitiesDetectionV2Job -> Request StopEntitiesDetectionV2Job
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 StopEntitiesDetectionV2Job
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopEntitiesDetectionV2Job)))
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 -> StopEntitiesDetectionV2JobResponse
StopEntitiesDetectionV2JobResponse'
            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 StopEntitiesDetectionV2Job where
  hashWithSalt :: Int -> StopEntitiesDetectionV2Job -> Int
hashWithSalt Int
_salt StopEntitiesDetectionV2Job' {Text
jobId :: Text
$sel:jobId:StopEntitiesDetectionV2Job' :: StopEntitiesDetectionV2Job -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId

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

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

instance Data.ToQuery StopEntitiesDetectionV2Job where
  toQuery :: StopEntitiesDetectionV2Job -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:jobId:StopEntitiesDetectionV2JobResponse' :: Maybe Text
jobId =
        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 :: Lens' StopEntitiesDetectionV2JobResponse (Maybe Text)
stopEntitiesDetectionV2JobResponse_jobId = 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 :: Lens' StopEntitiesDetectionV2JobResponse Int
stopEntitiesDetectionV2JobResponse_httpStatus = 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
  where
  rnf :: StopEntitiesDetectionV2JobResponse -> ()
rnf StopEntitiesDetectionV2JobResponse' {Int
Maybe Text
httpStatus :: Int
jobId :: Maybe Text
$sel:httpStatus:StopEntitiesDetectionV2JobResponse' :: StopEntitiesDetectionV2JobResponse -> Int
$sel:jobId:StopEntitiesDetectionV2JobResponse' :: StopEntitiesDetectionV2JobResponse -> 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