{-# 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.StopRxNormInferenceJob
-- 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 an InferRxNorm inference job in progress.
module Amazonka.ComprehendMedical.StopRxNormInferenceJob
  ( -- * Creating a Request
    StopRxNormInferenceJob (..),
    newStopRxNormInferenceJob,

    -- * Request Lenses
    stopRxNormInferenceJob_jobId,

    -- * Destructuring the Response
    StopRxNormInferenceJobResponse (..),
    newStopRxNormInferenceJobResponse,

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

-- |
-- Create a value of 'StopRxNormInferenceJob' 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', 'stopRxNormInferenceJob_jobId' - The identifier of the job.
newStopRxNormInferenceJob ::
  -- | 'jobId'
  Prelude.Text ->
  StopRxNormInferenceJob
newStopRxNormInferenceJob :: Text -> StopRxNormInferenceJob
newStopRxNormInferenceJob Text
pJobId_ =
  StopRxNormInferenceJob' {$sel:jobId:StopRxNormInferenceJob' :: Text
jobId = Text
pJobId_}

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

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

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

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

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

-- | /See:/ 'newStopRxNormInferenceJobResponse' smart constructor.
data StopRxNormInferenceJobResponse = StopRxNormInferenceJobResponse'
  { -- | The identifier generated for the job. To get the status of job, use this
    -- identifier with the @DescribeRxNormInferenceJob@ operation.
    StopRxNormInferenceJobResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StopRxNormInferenceJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StopRxNormInferenceJobResponse
-> StopRxNormInferenceJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopRxNormInferenceJobResponse
-> StopRxNormInferenceJobResponse -> Bool
$c/= :: StopRxNormInferenceJobResponse
-> StopRxNormInferenceJobResponse -> Bool
== :: StopRxNormInferenceJobResponse
-> StopRxNormInferenceJobResponse -> Bool
$c== :: StopRxNormInferenceJobResponse
-> StopRxNormInferenceJobResponse -> Bool
Prelude.Eq, ReadPrec [StopRxNormInferenceJobResponse]
ReadPrec StopRxNormInferenceJobResponse
Int -> ReadS StopRxNormInferenceJobResponse
ReadS [StopRxNormInferenceJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopRxNormInferenceJobResponse]
$creadListPrec :: ReadPrec [StopRxNormInferenceJobResponse]
readPrec :: ReadPrec StopRxNormInferenceJobResponse
$creadPrec :: ReadPrec StopRxNormInferenceJobResponse
readList :: ReadS [StopRxNormInferenceJobResponse]
$creadList :: ReadS [StopRxNormInferenceJobResponse]
readsPrec :: Int -> ReadS StopRxNormInferenceJobResponse
$creadsPrec :: Int -> ReadS StopRxNormInferenceJobResponse
Prelude.Read, Int -> StopRxNormInferenceJobResponse -> ShowS
[StopRxNormInferenceJobResponse] -> ShowS
StopRxNormInferenceJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopRxNormInferenceJobResponse] -> ShowS
$cshowList :: [StopRxNormInferenceJobResponse] -> ShowS
show :: StopRxNormInferenceJobResponse -> String
$cshow :: StopRxNormInferenceJobResponse -> String
showsPrec :: Int -> StopRxNormInferenceJobResponse -> ShowS
$cshowsPrec :: Int -> StopRxNormInferenceJobResponse -> ShowS
Prelude.Show, forall x.
Rep StopRxNormInferenceJobResponse x
-> StopRxNormInferenceJobResponse
forall x.
StopRxNormInferenceJobResponse
-> Rep StopRxNormInferenceJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopRxNormInferenceJobResponse x
-> StopRxNormInferenceJobResponse
$cfrom :: forall x.
StopRxNormInferenceJobResponse
-> Rep StopRxNormInferenceJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopRxNormInferenceJobResponse' 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', 'stopRxNormInferenceJobResponse_jobId' - The identifier generated for the job. To get the status of job, use this
-- identifier with the @DescribeRxNormInferenceJob@ operation.
--
-- 'httpStatus', 'stopRxNormInferenceJobResponse_httpStatus' - The response's http status code.
newStopRxNormInferenceJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopRxNormInferenceJobResponse
newStopRxNormInferenceJobResponse :: Int -> StopRxNormInferenceJobResponse
newStopRxNormInferenceJobResponse Int
pHttpStatus_ =
  StopRxNormInferenceJobResponse'
    { $sel:jobId:StopRxNormInferenceJobResponse' :: Maybe Text
jobId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StopRxNormInferenceJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier generated for the job. To get the status of job, use this
-- identifier with the @DescribeRxNormInferenceJob@ operation.
stopRxNormInferenceJobResponse_jobId :: Lens.Lens' StopRxNormInferenceJobResponse (Prelude.Maybe Prelude.Text)
stopRxNormInferenceJobResponse_jobId :: Lens' StopRxNormInferenceJobResponse (Maybe Text)
stopRxNormInferenceJobResponse_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopRxNormInferenceJobResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StopRxNormInferenceJobResponse' :: StopRxNormInferenceJobResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StopRxNormInferenceJobResponse
s@StopRxNormInferenceJobResponse' {} Maybe Text
a -> StopRxNormInferenceJobResponse
s {$sel:jobId:StopRxNormInferenceJobResponse' :: Maybe Text
jobId = Maybe Text
a} :: StopRxNormInferenceJobResponse)

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

instance
  Prelude.NFData
    StopRxNormInferenceJobResponse
  where
  rnf :: StopRxNormInferenceJobResponse -> ()
rnf StopRxNormInferenceJobResponse' {Int
Maybe Text
httpStatus :: Int
jobId :: Maybe Text
$sel:httpStatus:StopRxNormInferenceJobResponse' :: StopRxNormInferenceJobResponse -> Int
$sel:jobId:StopRxNormInferenceJobResponse' :: StopRxNormInferenceJobResponse -> 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