{-# 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.DataExchange.CancelJob
-- 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)
--
-- This operation cancels a job. Jobs can be cancelled only when they are
-- in the WAITING state.
module Amazonka.DataExchange.CancelJob
  ( -- * Creating a Request
    CancelJob (..),
    newCancelJob,

    -- * Request Lenses
    cancelJob_jobId,

    -- * Destructuring the Response
    CancelJobResponse (..),
    newCancelJobResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataExchange.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:/ 'newCancelJob' smart constructor.
data CancelJob = CancelJob'
  { -- | The unique identifier for a job.
    CancelJob -> Text
jobId :: Prelude.Text
  }
  deriving (CancelJob -> CancelJob -> Bool
(CancelJob -> CancelJob -> Bool)
-> (CancelJob -> CancelJob -> Bool) -> Eq CancelJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CancelJob -> CancelJob -> Bool
$c/= :: CancelJob -> CancelJob -> Bool
== :: CancelJob -> CancelJob -> Bool
$c== :: CancelJob -> CancelJob -> Bool
Prelude.Eq, ReadPrec [CancelJob]
ReadPrec CancelJob
Int -> ReadS CancelJob
ReadS [CancelJob]
(Int -> ReadS CancelJob)
-> ReadS [CancelJob]
-> ReadPrec CancelJob
-> ReadPrec [CancelJob]
-> Read CancelJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CancelJob]
$creadListPrec :: ReadPrec [CancelJob]
readPrec :: ReadPrec CancelJob
$creadPrec :: ReadPrec CancelJob
readList :: ReadS [CancelJob]
$creadList :: ReadS [CancelJob]
readsPrec :: Int -> ReadS CancelJob
$creadsPrec :: Int -> ReadS CancelJob
Prelude.Read, Int -> CancelJob -> ShowS
[CancelJob] -> ShowS
CancelJob -> String
(Int -> CancelJob -> ShowS)
-> (CancelJob -> String)
-> ([CancelJob] -> ShowS)
-> Show CancelJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CancelJob] -> ShowS
$cshowList :: [CancelJob] -> ShowS
show :: CancelJob -> String
$cshow :: CancelJob -> String
showsPrec :: Int -> CancelJob -> ShowS
$cshowsPrec :: Int -> CancelJob -> ShowS
Prelude.Show, (forall x. CancelJob -> Rep CancelJob x)
-> (forall x. Rep CancelJob x -> CancelJob) -> Generic CancelJob
forall x. Rep CancelJob x -> CancelJob
forall x. CancelJob -> Rep CancelJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CancelJob x -> CancelJob
$cfrom :: forall x. CancelJob -> Rep CancelJob x
Prelude.Generic)

-- |
-- Create a value of 'CancelJob' 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', 'cancelJob_jobId' - The unique identifier for a job.
newCancelJob ::
  -- | 'jobId'
  Prelude.Text ->
  CancelJob
newCancelJob :: Text -> CancelJob
newCancelJob Text
pJobId_ = CancelJob' :: Text -> CancelJob
CancelJob' {$sel:jobId:CancelJob' :: Text
jobId = Text
pJobId_}

-- | The unique identifier for a job.
cancelJob_jobId :: Lens.Lens' CancelJob Prelude.Text
cancelJob_jobId :: (Text -> f Text) -> CancelJob -> f CancelJob
cancelJob_jobId = (CancelJob -> Text)
-> (CancelJob -> Text -> CancelJob)
-> Lens CancelJob CancelJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelJob' {Text
jobId :: Text
$sel:jobId:CancelJob' :: CancelJob -> Text
jobId} -> Text
jobId) (\s :: CancelJob
s@CancelJob' {} Text
a -> CancelJob
s {$sel:jobId:CancelJob' :: Text
jobId = Text
a} :: CancelJob)

instance Core.AWSRequest CancelJob where
  type AWSResponse CancelJob = CancelJobResponse
  request :: CancelJob -> Request CancelJob
request = Service -> CancelJob -> Request CancelJob
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy CancelJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelJob)))
response = AWSResponse CancelJob
-> Logger
-> Service
-> Proxy CancelJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelJob)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse CancelJob
CancelJobResponse
CancelJobResponse'

instance Prelude.Hashable CancelJob

instance Prelude.NFData CancelJob

instance Core.ToHeaders CancelJob where
  toHeaders :: CancelJob -> [Header]
toHeaders =
    [Header] -> CancelJob -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToPath CancelJob where
  toPath :: CancelJob -> ByteString
toPath CancelJob' {Text
jobId :: Text
$sel:jobId:CancelJob' :: CancelJob -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/v1/jobs/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
jobId]

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

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

-- |
-- Create a value of 'CancelJobResponse' 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.
newCancelJobResponse ::
  CancelJobResponse
newCancelJobResponse :: CancelJobResponse
newCancelJobResponse = CancelJobResponse
CancelJobResponse'

instance Prelude.NFData CancelJobResponse