{-# 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.Comprehend.StopPiiEntitiesDetectionJob
-- 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 PII entities detection job in progress.
module Amazonka.Comprehend.StopPiiEntitiesDetectionJob
  ( -- * Creating a Request
    StopPiiEntitiesDetectionJob (..),
    newStopPiiEntitiesDetectionJob,

    -- * Request Lenses
    stopPiiEntitiesDetectionJob_jobId,

    -- * Destructuring the Response
    StopPiiEntitiesDetectionJobResponse (..),
    newStopPiiEntitiesDetectionJobResponse,

    -- * Response Lenses
    stopPiiEntitiesDetectionJobResponse_jobId,
    stopPiiEntitiesDetectionJobResponse_jobStatus,
    stopPiiEntitiesDetectionJobResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'StopPiiEntitiesDetectionJob' 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', 'stopPiiEntitiesDetectionJob_jobId' - The identifier of the PII entities detection job to stop.
newStopPiiEntitiesDetectionJob ::
  -- | 'jobId'
  Prelude.Text ->
  StopPiiEntitiesDetectionJob
newStopPiiEntitiesDetectionJob :: Text -> StopPiiEntitiesDetectionJob
newStopPiiEntitiesDetectionJob Text
pJobId_ =
  StopPiiEntitiesDetectionJob' {$sel:jobId:StopPiiEntitiesDetectionJob' :: Text
jobId = Text
pJobId_}

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

instance Core.AWSRequest StopPiiEntitiesDetectionJob where
  type
    AWSResponse StopPiiEntitiesDetectionJob =
      StopPiiEntitiesDetectionJobResponse
  request :: (Service -> Service)
-> StopPiiEntitiesDetectionJob
-> Request StopPiiEntitiesDetectionJob
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 StopPiiEntitiesDetectionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopPiiEntitiesDetectionJob)))
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
-> Maybe JobStatus -> Int -> StopPiiEntitiesDetectionJobResponse
StopPiiEntitiesDetectionJobResponse'
            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"JobStatus")
            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 StopPiiEntitiesDetectionJob where
  hashWithSalt :: Int -> StopPiiEntitiesDetectionJob -> Int
hashWithSalt Int
_salt StopPiiEntitiesDetectionJob' {Text
jobId :: Text
$sel:jobId:StopPiiEntitiesDetectionJob' :: StopPiiEntitiesDetectionJob -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId

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

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

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

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

-- |
-- Create a value of 'StopPiiEntitiesDetectionJobResponse' 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', 'stopPiiEntitiesDetectionJobResponse_jobId' - The identifier of the PII entities detection job to stop.
--
-- 'jobStatus', 'stopPiiEntitiesDetectionJobResponse_jobStatus' - The status of the PII entities detection job.
--
-- 'httpStatus', 'stopPiiEntitiesDetectionJobResponse_httpStatus' - The response's http status code.
newStopPiiEntitiesDetectionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopPiiEntitiesDetectionJobResponse
newStopPiiEntitiesDetectionJobResponse :: Int -> StopPiiEntitiesDetectionJobResponse
newStopPiiEntitiesDetectionJobResponse Int
pHttpStatus_ =
  StopPiiEntitiesDetectionJobResponse'
    { $sel:jobId:StopPiiEntitiesDetectionJobResponse' :: Maybe Text
jobId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:jobStatus:StopPiiEntitiesDetectionJobResponse' :: Maybe JobStatus
jobStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StopPiiEntitiesDetectionJobResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

-- | The status of the PII entities detection job.
stopPiiEntitiesDetectionJobResponse_jobStatus :: Lens.Lens' StopPiiEntitiesDetectionJobResponse (Prelude.Maybe JobStatus)
stopPiiEntitiesDetectionJobResponse_jobStatus :: Lens' StopPiiEntitiesDetectionJobResponse (Maybe JobStatus)
stopPiiEntitiesDetectionJobResponse_jobStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopPiiEntitiesDetectionJobResponse' {Maybe JobStatus
jobStatus :: Maybe JobStatus
$sel:jobStatus:StopPiiEntitiesDetectionJobResponse' :: StopPiiEntitiesDetectionJobResponse -> Maybe JobStatus
jobStatus} -> Maybe JobStatus
jobStatus) (\s :: StopPiiEntitiesDetectionJobResponse
s@StopPiiEntitiesDetectionJobResponse' {} Maybe JobStatus
a -> StopPiiEntitiesDetectionJobResponse
s {$sel:jobStatus:StopPiiEntitiesDetectionJobResponse' :: Maybe JobStatus
jobStatus = Maybe JobStatus
a} :: StopPiiEntitiesDetectionJobResponse)

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

instance
  Prelude.NFData
    StopPiiEntitiesDetectionJobResponse
  where
  rnf :: StopPiiEntitiesDetectionJobResponse -> ()
rnf StopPiiEntitiesDetectionJobResponse' {Int
Maybe Text
Maybe JobStatus
httpStatus :: Int
jobStatus :: Maybe JobStatus
jobId :: Maybe Text
$sel:httpStatus:StopPiiEntitiesDetectionJobResponse' :: StopPiiEntitiesDetectionJobResponse -> Int
$sel:jobStatus:StopPiiEntitiesDetectionJobResponse' :: StopPiiEntitiesDetectionJobResponse -> Maybe JobStatus
$sel:jobId:StopPiiEntitiesDetectionJobResponse' :: StopPiiEntitiesDetectionJobResponse -> 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 Maybe JobStatus
jobStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus