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

-- | The identifier of the job.
stopRxNormInferenceJob_jobId :: Lens.Lens' StopRxNormInferenceJob Prelude.Text
stopRxNormInferenceJob_jobId :: (Text -> f Text)
-> StopRxNormInferenceJob -> f StopRxNormInferenceJob
stopRxNormInferenceJob_jobId = (StopRxNormInferenceJob -> Text)
-> (StopRxNormInferenceJob -> Text -> StopRxNormInferenceJob)
-> Lens StopRxNormInferenceJob StopRxNormInferenceJob Text Text
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 :: StopRxNormInferenceJob -> Request StopRxNormInferenceJob
request = Service -> StopRxNormInferenceJob -> Request StopRxNormInferenceJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopRxNormInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopRxNormInferenceJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StopRxNormInferenceJob))
-> Logger
-> Service
-> Proxy StopRxNormInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopRxNormInferenceJob)))
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 -> StopRxNormInferenceJobResponse
StopRxNormInferenceJobResponse'
            (Maybe Text -> Int -> StopRxNormInferenceJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StopRxNormInferenceJobResponse)
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 -> StopRxNormInferenceJobResponse)
-> Either String Int
-> Either String StopRxNormInferenceJobResponse
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 StopRxNormInferenceJob

instance Prelude.NFData StopRxNormInferenceJob

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

instance Core.ToQuery StopRxNormInferenceJob where
  toQuery :: StopRxNormInferenceJob -> QueryString
toQuery = QueryString -> StopRxNormInferenceJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(StopRxNormInferenceJobResponse
 -> StopRxNormInferenceJobResponse -> Bool)
-> (StopRxNormInferenceJobResponse
    -> StopRxNormInferenceJobResponse -> Bool)
-> Eq StopRxNormInferenceJobResponse
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]
(Int -> ReadS StopRxNormInferenceJobResponse)
-> ReadS [StopRxNormInferenceJobResponse]
-> ReadPrec StopRxNormInferenceJobResponse
-> ReadPrec [StopRxNormInferenceJobResponse]
-> Read 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
(Int -> StopRxNormInferenceJobResponse -> ShowS)
-> (StopRxNormInferenceJobResponse -> String)
-> ([StopRxNormInferenceJobResponse] -> ShowS)
-> Show StopRxNormInferenceJobResponse
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.
 StopRxNormInferenceJobResponse
 -> Rep StopRxNormInferenceJobResponse x)
-> (forall x.
    Rep StopRxNormInferenceJobResponse x
    -> StopRxNormInferenceJobResponse)
-> Generic StopRxNormInferenceJobResponse
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' :: Maybe Text -> Int -> StopRxNormInferenceJobResponse
StopRxNormInferenceJobResponse'
    { $sel:jobId:StopRxNormInferenceJobResponse' :: Maybe Text
jobId =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> StopRxNormInferenceJobResponse
-> f StopRxNormInferenceJobResponse
stopRxNormInferenceJobResponse_jobId = (StopRxNormInferenceJobResponse -> Maybe Text)
-> (StopRxNormInferenceJobResponse
    -> Maybe Text -> StopRxNormInferenceJobResponse)
-> Lens
     StopRxNormInferenceJobResponse
     StopRxNormInferenceJobResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int)
-> StopRxNormInferenceJobResponse
-> f StopRxNormInferenceJobResponse
stopRxNormInferenceJobResponse_httpStatus = (StopRxNormInferenceJobResponse -> Int)
-> (StopRxNormInferenceJobResponse
    -> Int -> StopRxNormInferenceJobResponse)
-> Lens
     StopRxNormInferenceJobResponse
     StopRxNormInferenceJobResponse
     Int
     Int
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