{-# 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.StopSNOMEDCTInferenceJob
-- 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 InferSNOMEDCT inference job in progress.
module Amazonka.ComprehendMedical.StopSNOMEDCTInferenceJob
  ( -- * Creating a Request
    StopSNOMEDCTInferenceJob (..),
    newStopSNOMEDCTInferenceJob,

    -- * Request Lenses
    stopSNOMEDCTInferenceJob_jobId,

    -- * Destructuring the Response
    StopSNOMEDCTInferenceJobResponse (..),
    newStopSNOMEDCTInferenceJobResponse,

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

-- |
-- Create a value of 'StopSNOMEDCTInferenceJob' 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', 'stopSNOMEDCTInferenceJob_jobId' - The job id of the asynchronous InferSNOMEDCT job to be stopped.
newStopSNOMEDCTInferenceJob ::
  -- | 'jobId'
  Prelude.Text ->
  StopSNOMEDCTInferenceJob
newStopSNOMEDCTInferenceJob :: Text -> StopSNOMEDCTInferenceJob
newStopSNOMEDCTInferenceJob Text
pJobId_ =
  StopSNOMEDCTInferenceJob' {$sel:jobId:StopSNOMEDCTInferenceJob' :: Text
jobId = Text
pJobId_}

-- | The job id of the asynchronous InferSNOMEDCT job to be stopped.
stopSNOMEDCTInferenceJob_jobId :: Lens.Lens' StopSNOMEDCTInferenceJob Prelude.Text
stopSNOMEDCTInferenceJob_jobId :: Lens' StopSNOMEDCTInferenceJob Text
stopSNOMEDCTInferenceJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopSNOMEDCTInferenceJob' {Text
jobId :: Text
$sel:jobId:StopSNOMEDCTInferenceJob' :: StopSNOMEDCTInferenceJob -> Text
jobId} -> Text
jobId) (\s :: StopSNOMEDCTInferenceJob
s@StopSNOMEDCTInferenceJob' {} Text
a -> StopSNOMEDCTInferenceJob
s {$sel:jobId:StopSNOMEDCTInferenceJob' :: Text
jobId = Text
a} :: StopSNOMEDCTInferenceJob)

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

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

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

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

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

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

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

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

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