{-# 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.StopPHIDetectionJob
-- 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 protected health information (PHI) detection job in progress.
module Amazonka.ComprehendMedical.StopPHIDetectionJob
  ( -- * Creating a Request
    StopPHIDetectionJob (..),
    newStopPHIDetectionJob,

    -- * Request Lenses
    stopPHIDetectionJob_jobId,

    -- * Destructuring the Response
    StopPHIDetectionJobResponse (..),
    newStopPHIDetectionJobResponse,

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

-- |
-- Create a value of 'StopPHIDetectionJob' 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', 'stopPHIDetectionJob_jobId' - The identifier of the PHI detection job to stop.
newStopPHIDetectionJob ::
  -- | 'jobId'
  Prelude.Text ->
  StopPHIDetectionJob
newStopPHIDetectionJob :: Text -> StopPHIDetectionJob
newStopPHIDetectionJob Text
pJobId_ =
  StopPHIDetectionJob' {$sel:jobId:StopPHIDetectionJob' :: Text
jobId = Text
pJobId_}

-- | The identifier of the PHI detection job to stop.
stopPHIDetectionJob_jobId :: Lens.Lens' StopPHIDetectionJob Prelude.Text
stopPHIDetectionJob_jobId :: Lens' StopPHIDetectionJob Text
stopPHIDetectionJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopPHIDetectionJob' {Text
jobId :: Text
$sel:jobId:StopPHIDetectionJob' :: StopPHIDetectionJob -> Text
jobId} -> Text
jobId) (\s :: StopPHIDetectionJob
s@StopPHIDetectionJob' {} Text
a -> StopPHIDetectionJob
s {$sel:jobId:StopPHIDetectionJob' :: Text
jobId = Text
a} :: StopPHIDetectionJob)

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

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

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

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

-- | /See:/ 'newStopPHIDetectionJobResponse' smart constructor.
data StopPHIDetectionJobResponse = StopPHIDetectionJobResponse'
  { -- | The identifier of the PHI detection job that was stopped.
    StopPHIDetectionJobResponse -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    StopPHIDetectionJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StopPHIDetectionJobResponse -> StopPHIDetectionJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopPHIDetectionJobResponse -> StopPHIDetectionJobResponse -> Bool
$c/= :: StopPHIDetectionJobResponse -> StopPHIDetectionJobResponse -> Bool
== :: StopPHIDetectionJobResponse -> StopPHIDetectionJobResponse -> Bool
$c== :: StopPHIDetectionJobResponse -> StopPHIDetectionJobResponse -> Bool
Prelude.Eq, ReadPrec [StopPHIDetectionJobResponse]
ReadPrec StopPHIDetectionJobResponse
Int -> ReadS StopPHIDetectionJobResponse
ReadS [StopPHIDetectionJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopPHIDetectionJobResponse]
$creadListPrec :: ReadPrec [StopPHIDetectionJobResponse]
readPrec :: ReadPrec StopPHIDetectionJobResponse
$creadPrec :: ReadPrec StopPHIDetectionJobResponse
readList :: ReadS [StopPHIDetectionJobResponse]
$creadList :: ReadS [StopPHIDetectionJobResponse]
readsPrec :: Int -> ReadS StopPHIDetectionJobResponse
$creadsPrec :: Int -> ReadS StopPHIDetectionJobResponse
Prelude.Read, Int -> StopPHIDetectionJobResponse -> ShowS
[StopPHIDetectionJobResponse] -> ShowS
StopPHIDetectionJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopPHIDetectionJobResponse] -> ShowS
$cshowList :: [StopPHIDetectionJobResponse] -> ShowS
show :: StopPHIDetectionJobResponse -> String
$cshow :: StopPHIDetectionJobResponse -> String
showsPrec :: Int -> StopPHIDetectionJobResponse -> ShowS
$cshowsPrec :: Int -> StopPHIDetectionJobResponse -> ShowS
Prelude.Show, forall x.
Rep StopPHIDetectionJobResponse x -> StopPHIDetectionJobResponse
forall x.
StopPHIDetectionJobResponse -> Rep StopPHIDetectionJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopPHIDetectionJobResponse x -> StopPHIDetectionJobResponse
$cfrom :: forall x.
StopPHIDetectionJobResponse -> Rep StopPHIDetectionJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopPHIDetectionJobResponse' 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', 'stopPHIDetectionJobResponse_jobId' - The identifier of the PHI detection job that was stopped.
--
-- 'httpStatus', 'stopPHIDetectionJobResponse_httpStatus' - The response's http status code.
newStopPHIDetectionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopPHIDetectionJobResponse
newStopPHIDetectionJobResponse :: Int -> StopPHIDetectionJobResponse
newStopPHIDetectionJobResponse Int
pHttpStatus_ =
  StopPHIDetectionJobResponse'
    { $sel:jobId:StopPHIDetectionJobResponse' :: Maybe Text
jobId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StopPHIDetectionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The identifier of the PHI detection job that was stopped.
stopPHIDetectionJobResponse_jobId :: Lens.Lens' StopPHIDetectionJobResponse (Prelude.Maybe Prelude.Text)
stopPHIDetectionJobResponse_jobId :: Lens' StopPHIDetectionJobResponse (Maybe Text)
stopPHIDetectionJobResponse_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopPHIDetectionJobResponse' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StopPHIDetectionJobResponse' :: StopPHIDetectionJobResponse -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StopPHIDetectionJobResponse
s@StopPHIDetectionJobResponse' {} Maybe Text
a -> StopPHIDetectionJobResponse
s {$sel:jobId:StopPHIDetectionJobResponse' :: Maybe Text
jobId = Maybe Text
a} :: StopPHIDetectionJobResponse)

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

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