{-# 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-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 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.Lens as Lens
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
(StopPHIDetectionJob -> StopPHIDetectionJob -> Bool)
-> (StopPHIDetectionJob -> StopPHIDetectionJob -> Bool)
-> Eq StopPHIDetectionJob
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]
(Int -> ReadS StopPHIDetectionJob)
-> ReadS [StopPHIDetectionJob]
-> ReadPrec StopPHIDetectionJob
-> ReadPrec [StopPHIDetectionJob]
-> Read 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
(Int -> StopPHIDetectionJob -> ShowS)
-> (StopPHIDetectionJob -> String)
-> ([StopPHIDetectionJob] -> ShowS)
-> Show StopPHIDetectionJob
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. StopPHIDetectionJob -> Rep StopPHIDetectionJob x)
-> (forall x. Rep StopPHIDetectionJob x -> StopPHIDetectionJob)
-> Generic StopPHIDetectionJob
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' :: Text -> StopPHIDetectionJob
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 :: (Text -> f Text) -> StopPHIDetectionJob -> f StopPHIDetectionJob
stopPHIDetectionJob_jobId = (StopPHIDetectionJob -> Text)
-> (StopPHIDetectionJob -> Text -> StopPHIDetectionJob)
-> Lens StopPHIDetectionJob StopPHIDetectionJob Text Text
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 :: StopPHIDetectionJob -> Request StopPHIDetectionJob
request = Service -> StopPHIDetectionJob -> Request StopPHIDetectionJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopPHIDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopPHIDetectionJob)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StopPHIDetectionJob))
-> Logger
-> Service
-> Proxy StopPHIDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopPHIDetectionJob)))
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 -> StopPHIDetectionJobResponse
StopPHIDetectionJobResponse'
            (Maybe Text -> Int -> StopPHIDetectionJobResponse)
-> Either String (Maybe Text)
-> Either String (Int -> StopPHIDetectionJobResponse)
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 -> StopPHIDetectionJobResponse)
-> Either String Int -> Either String StopPHIDetectionJobResponse
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 StopPHIDetectionJob

instance Prelude.NFData StopPHIDetectionJob

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

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