{-# 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.FraudDetector.CancelBatchPredictionJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Cancels the specified batch prediction job.
module Amazonka.FraudDetector.CancelBatchPredictionJob
  ( -- * Creating a Request
    CancelBatchPredictionJob (..),
    newCancelBatchPredictionJob,

    -- * Request Lenses
    cancelBatchPredictionJob_jobId,

    -- * Destructuring the Response
    CancelBatchPredictionJobResponse (..),
    newCancelBatchPredictionJobResponse,

    -- * Response Lenses
    cancelBatchPredictionJobResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FraudDetector.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCancelBatchPredictionJob' smart constructor.
data CancelBatchPredictionJob = CancelBatchPredictionJob'
  { -- | The ID of the batch prediction job to cancel.
    CancelBatchPredictionJob -> Text
jobId :: Prelude.Text
  }
  deriving (CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool
$c/= :: CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool
== :: CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool
$c== :: CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool
Prelude.Eq, ReadPrec [CancelBatchPredictionJob]
ReadPrec CancelBatchPredictionJob
Int -> ReadS CancelBatchPredictionJob
ReadS [CancelBatchPredictionJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelBatchPredictionJob]
$creadListPrec :: ReadPrec [CancelBatchPredictionJob]
readPrec :: ReadPrec CancelBatchPredictionJob
$creadPrec :: ReadPrec CancelBatchPredictionJob
readList :: ReadS [CancelBatchPredictionJob]
$creadList :: ReadS [CancelBatchPredictionJob]
readsPrec :: Int -> ReadS CancelBatchPredictionJob
$creadsPrec :: Int -> ReadS CancelBatchPredictionJob
Prelude.Read, Int -> CancelBatchPredictionJob -> ShowS
[CancelBatchPredictionJob] -> ShowS
CancelBatchPredictionJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelBatchPredictionJob] -> ShowS
$cshowList :: [CancelBatchPredictionJob] -> ShowS
show :: CancelBatchPredictionJob -> String
$cshow :: CancelBatchPredictionJob -> String
showsPrec :: Int -> CancelBatchPredictionJob -> ShowS
$cshowsPrec :: Int -> CancelBatchPredictionJob -> ShowS
Prelude.Show, forall x.
Rep CancelBatchPredictionJob x -> CancelBatchPredictionJob
forall x.
CancelBatchPredictionJob -> Rep CancelBatchPredictionJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelBatchPredictionJob x -> CancelBatchPredictionJob
$cfrom :: forall x.
CancelBatchPredictionJob -> Rep CancelBatchPredictionJob x
Prelude.Generic)

-- |
-- Create a value of 'CancelBatchPredictionJob' 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', 'cancelBatchPredictionJob_jobId' - The ID of the batch prediction job to cancel.
newCancelBatchPredictionJob ::
  -- | 'jobId'
  Prelude.Text ->
  CancelBatchPredictionJob
newCancelBatchPredictionJob :: Text -> CancelBatchPredictionJob
newCancelBatchPredictionJob Text
pJobId_ =
  CancelBatchPredictionJob' {$sel:jobId:CancelBatchPredictionJob' :: Text
jobId = Text
pJobId_}

-- | The ID of the batch prediction job to cancel.
cancelBatchPredictionJob_jobId :: Lens.Lens' CancelBatchPredictionJob Prelude.Text
cancelBatchPredictionJob_jobId :: Lens' CancelBatchPredictionJob Text
cancelBatchPredictionJob_jobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelBatchPredictionJob' {Text
jobId :: Text
$sel:jobId:CancelBatchPredictionJob' :: CancelBatchPredictionJob -> Text
jobId} -> Text
jobId) (\s :: CancelBatchPredictionJob
s@CancelBatchPredictionJob' {} Text
a -> CancelBatchPredictionJob
s {$sel:jobId:CancelBatchPredictionJob' :: Text
jobId = Text
a} :: CancelBatchPredictionJob)

instance Core.AWSRequest CancelBatchPredictionJob where
  type
    AWSResponse CancelBatchPredictionJob =
      CancelBatchPredictionJobResponse
  request :: (Service -> Service)
-> CancelBatchPredictionJob -> Request CancelBatchPredictionJob
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 CancelBatchPredictionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CancelBatchPredictionJob)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> CancelBatchPredictionJobResponse
CancelBatchPredictionJobResponse'
            forall (f :: * -> *) a b. Functor 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 CancelBatchPredictionJob where
  hashWithSalt :: Int -> CancelBatchPredictionJob -> Int
hashWithSalt Int
_salt CancelBatchPredictionJob' {Text
jobId :: Text
$sel:jobId:CancelBatchPredictionJob' :: CancelBatchPredictionJob -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
jobId

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

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

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

-- | /See:/ 'newCancelBatchPredictionJobResponse' smart constructor.
data CancelBatchPredictionJobResponse = CancelBatchPredictionJobResponse'
  { -- | The response's http status code.
    CancelBatchPredictionJobResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CancelBatchPredictionJobResponse
-> CancelBatchPredictionJobResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelBatchPredictionJobResponse
-> CancelBatchPredictionJobResponse -> Bool
$c/= :: CancelBatchPredictionJobResponse
-> CancelBatchPredictionJobResponse -> Bool
== :: CancelBatchPredictionJobResponse
-> CancelBatchPredictionJobResponse -> Bool
$c== :: CancelBatchPredictionJobResponse
-> CancelBatchPredictionJobResponse -> Bool
Prelude.Eq, ReadPrec [CancelBatchPredictionJobResponse]
ReadPrec CancelBatchPredictionJobResponse
Int -> ReadS CancelBatchPredictionJobResponse
ReadS [CancelBatchPredictionJobResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelBatchPredictionJobResponse]
$creadListPrec :: ReadPrec [CancelBatchPredictionJobResponse]
readPrec :: ReadPrec CancelBatchPredictionJobResponse
$creadPrec :: ReadPrec CancelBatchPredictionJobResponse
readList :: ReadS [CancelBatchPredictionJobResponse]
$creadList :: ReadS [CancelBatchPredictionJobResponse]
readsPrec :: Int -> ReadS CancelBatchPredictionJobResponse
$creadsPrec :: Int -> ReadS CancelBatchPredictionJobResponse
Prelude.Read, Int -> CancelBatchPredictionJobResponse -> ShowS
[CancelBatchPredictionJobResponse] -> ShowS
CancelBatchPredictionJobResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelBatchPredictionJobResponse] -> ShowS
$cshowList :: [CancelBatchPredictionJobResponse] -> ShowS
show :: CancelBatchPredictionJobResponse -> String
$cshow :: CancelBatchPredictionJobResponse -> String
showsPrec :: Int -> CancelBatchPredictionJobResponse -> ShowS
$cshowsPrec :: Int -> CancelBatchPredictionJobResponse -> ShowS
Prelude.Show, forall x.
Rep CancelBatchPredictionJobResponse x
-> CancelBatchPredictionJobResponse
forall x.
CancelBatchPredictionJobResponse
-> Rep CancelBatchPredictionJobResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CancelBatchPredictionJobResponse x
-> CancelBatchPredictionJobResponse
$cfrom :: forall x.
CancelBatchPredictionJobResponse
-> Rep CancelBatchPredictionJobResponse x
Prelude.Generic)

-- |
-- Create a value of 'CancelBatchPredictionJobResponse' 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:
--
-- 'httpStatus', 'cancelBatchPredictionJobResponse_httpStatus' - The response's http status code.
newCancelBatchPredictionJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CancelBatchPredictionJobResponse
newCancelBatchPredictionJobResponse :: Int -> CancelBatchPredictionJobResponse
newCancelBatchPredictionJobResponse Int
pHttpStatus_ =
  CancelBatchPredictionJobResponse'
    { $sel:httpStatus:CancelBatchPredictionJobResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    CancelBatchPredictionJobResponse
  where
  rnf :: CancelBatchPredictionJobResponse -> ()
rnf CancelBatchPredictionJobResponse' {Int
httpStatus :: Int
$sel:httpStatus:CancelBatchPredictionJobResponse' :: CancelBatchPredictionJobResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus