{-# 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-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)
--
-- 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 Amazonka.FraudDetector.Types
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:/ 'newCancelBatchPredictionJob' smart constructor.
data CancelBatchPredictionJob = CancelBatchPredictionJob'
  { -- | The ID of the batch prediction job to cancel.
    CancelBatchPredictionJob -> Text
jobId :: Prelude.Text
  }
  deriving (CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool
(CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool)
-> (CancelBatchPredictionJob -> CancelBatchPredictionJob -> Bool)
-> Eq CancelBatchPredictionJob
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]
(Int -> ReadS CancelBatchPredictionJob)
-> ReadS [CancelBatchPredictionJob]
-> ReadPrec CancelBatchPredictionJob
-> ReadPrec [CancelBatchPredictionJob]
-> Read 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
(Int -> CancelBatchPredictionJob -> ShowS)
-> (CancelBatchPredictionJob -> String)
-> ([CancelBatchPredictionJob] -> ShowS)
-> Show CancelBatchPredictionJob
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.
 CancelBatchPredictionJob -> Rep CancelBatchPredictionJob x)
-> (forall x.
    Rep CancelBatchPredictionJob x -> CancelBatchPredictionJob)
-> Generic CancelBatchPredictionJob
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' :: Text -> CancelBatchPredictionJob
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 :: (Text -> f Text)
-> CancelBatchPredictionJob -> f CancelBatchPredictionJob
cancelBatchPredictionJob_jobId = (CancelBatchPredictionJob -> Text)
-> (CancelBatchPredictionJob -> Text -> CancelBatchPredictionJob)
-> Lens CancelBatchPredictionJob CancelBatchPredictionJob Text Text
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 :: CancelBatchPredictionJob -> Request CancelBatchPredictionJob
request = Service
-> CancelBatchPredictionJob -> Request CancelBatchPredictionJob
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CancelBatchPredictionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CancelBatchPredictionJob)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse CancelBatchPredictionJob))
-> Logger
-> Service
-> Proxy CancelBatchPredictionJob
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CancelBatchPredictionJob)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> CancelBatchPredictionJobResponse
CancelBatchPredictionJobResponse'
            (Int -> CancelBatchPredictionJobResponse)
-> Either String Int
-> Either String CancelBatchPredictionJobResponse
forall (f :: * -> *) a b. Functor 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 CancelBatchPredictionJob

instance Prelude.NFData CancelBatchPredictionJob

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

instance Core.ToQuery CancelBatchPredictionJob where
  toQuery :: CancelBatchPredictionJob -> QueryString
toQuery = QueryString -> CancelBatchPredictionJob -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(CancelBatchPredictionJobResponse
 -> CancelBatchPredictionJobResponse -> Bool)
-> (CancelBatchPredictionJobResponse
    -> CancelBatchPredictionJobResponse -> Bool)
-> Eq CancelBatchPredictionJobResponse
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]
(Int -> ReadS CancelBatchPredictionJobResponse)
-> ReadS [CancelBatchPredictionJobResponse]
-> ReadPrec CancelBatchPredictionJobResponse
-> ReadPrec [CancelBatchPredictionJobResponse]
-> Read 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
(Int -> CancelBatchPredictionJobResponse -> ShowS)
-> (CancelBatchPredictionJobResponse -> String)
-> ([CancelBatchPredictionJobResponse] -> ShowS)
-> Show CancelBatchPredictionJobResponse
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.
 CancelBatchPredictionJobResponse
 -> Rep CancelBatchPredictionJobResponse x)
-> (forall x.
    Rep CancelBatchPredictionJobResponse x
    -> CancelBatchPredictionJobResponse)
-> Generic CancelBatchPredictionJobResponse
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' :: Int -> CancelBatchPredictionJobResponse
CancelBatchPredictionJobResponse'
    { $sel:httpStatus:CancelBatchPredictionJobResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
cancelBatchPredictionJobResponse_httpStatus :: Lens.Lens' CancelBatchPredictionJobResponse Prelude.Int
cancelBatchPredictionJobResponse_httpStatus :: (Int -> f Int)
-> CancelBatchPredictionJobResponse
-> f CancelBatchPredictionJobResponse
cancelBatchPredictionJobResponse_httpStatus = (CancelBatchPredictionJobResponse -> Int)
-> (CancelBatchPredictionJobResponse
    -> Int -> CancelBatchPredictionJobResponse)
-> Lens
     CancelBatchPredictionJobResponse
     CancelBatchPredictionJobResponse
     Int
     Int
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