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

    -- * Request Lenses
    stopICD10CMInferenceJob_jobId,

    -- * Destructuring the Response
    StopICD10CMInferenceJobResponse (..),
    newStopICD10CMInferenceJobResponse,

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

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

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

instance Core.AWSRequest StopICD10CMInferenceJob where
  type
    AWSResponse StopICD10CMInferenceJob =
      StopICD10CMInferenceJobResponse
  request :: StopICD10CMInferenceJob -> Request StopICD10CMInferenceJob
request = Service
-> StopICD10CMInferenceJob -> Request StopICD10CMInferenceJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopICD10CMInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopICD10CMInferenceJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StopICD10CMInferenceJob))
-> Logger
-> Service
-> Proxy StopICD10CMInferenceJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopICD10CMInferenceJob)))
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 -> StopICD10CMInferenceJobResponse
StopICD10CMInferenceJobResponse'
            (Maybe Text -> Int -> StopICD10CMInferenceJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StopICD10CMInferenceJobResponse)
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 -> StopICD10CMInferenceJobResponse)
-> Either String Int
-> Either String StopICD10CMInferenceJobResponse
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 StopICD10CMInferenceJob

instance Prelude.NFData StopICD10CMInferenceJob

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

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

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

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

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

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

instance
  Prelude.NFData
    StopICD10CMInferenceJobResponse