{-# 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.Backup.StopBackupJob
-- 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)
--
-- Attempts to cancel a job to create a one-time backup of a resource.
module Amazonka.Backup.StopBackupJob
  ( -- * Creating a Request
    StopBackupJob (..),
    newStopBackupJob,

    -- * Request Lenses
    stopBackupJob_backupJobId,

    -- * Destructuring the Response
    StopBackupJobResponse (..),
    newStopBackupJobResponse,
  )
where

import Amazonka.Backup.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:/ 'newStopBackupJob' smart constructor.
data StopBackupJob = StopBackupJob'
  { -- | Uniquely identifies a request to Backup to back up a resource.
    StopBackupJob -> Text
backupJobId :: Prelude.Text
  }
  deriving (StopBackupJob -> StopBackupJob -> Bool
(StopBackupJob -> StopBackupJob -> Bool)
-> (StopBackupJob -> StopBackupJob -> Bool) -> Eq StopBackupJob
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopBackupJob -> StopBackupJob -> Bool
$c/= :: StopBackupJob -> StopBackupJob -> Bool
== :: StopBackupJob -> StopBackupJob -> Bool
$c== :: StopBackupJob -> StopBackupJob -> Bool
Prelude.Eq, ReadPrec [StopBackupJob]
ReadPrec StopBackupJob
Int -> ReadS StopBackupJob
ReadS [StopBackupJob]
(Int -> ReadS StopBackupJob)
-> ReadS [StopBackupJob]
-> ReadPrec StopBackupJob
-> ReadPrec [StopBackupJob]
-> Read StopBackupJob
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopBackupJob]
$creadListPrec :: ReadPrec [StopBackupJob]
readPrec :: ReadPrec StopBackupJob
$creadPrec :: ReadPrec StopBackupJob
readList :: ReadS [StopBackupJob]
$creadList :: ReadS [StopBackupJob]
readsPrec :: Int -> ReadS StopBackupJob
$creadsPrec :: Int -> ReadS StopBackupJob
Prelude.Read, Int -> StopBackupJob -> ShowS
[StopBackupJob] -> ShowS
StopBackupJob -> String
(Int -> StopBackupJob -> ShowS)
-> (StopBackupJob -> String)
-> ([StopBackupJob] -> ShowS)
-> Show StopBackupJob
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopBackupJob] -> ShowS
$cshowList :: [StopBackupJob] -> ShowS
show :: StopBackupJob -> String
$cshow :: StopBackupJob -> String
showsPrec :: Int -> StopBackupJob -> ShowS
$cshowsPrec :: Int -> StopBackupJob -> ShowS
Prelude.Show, (forall x. StopBackupJob -> Rep StopBackupJob x)
-> (forall x. Rep StopBackupJob x -> StopBackupJob)
-> Generic StopBackupJob
forall x. Rep StopBackupJob x -> StopBackupJob
forall x. StopBackupJob -> Rep StopBackupJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopBackupJob x -> StopBackupJob
$cfrom :: forall x. StopBackupJob -> Rep StopBackupJob x
Prelude.Generic)

-- |
-- Create a value of 'StopBackupJob' 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:
--
-- 'backupJobId', 'stopBackupJob_backupJobId' - Uniquely identifies a request to Backup to back up a resource.
newStopBackupJob ::
  -- | 'backupJobId'
  Prelude.Text ->
  StopBackupJob
newStopBackupJob :: Text -> StopBackupJob
newStopBackupJob Text
pBackupJobId_ =
  StopBackupJob' :: Text -> StopBackupJob
StopBackupJob' {$sel:backupJobId:StopBackupJob' :: Text
backupJobId = Text
pBackupJobId_}

-- | Uniquely identifies a request to Backup to back up a resource.
stopBackupJob_backupJobId :: Lens.Lens' StopBackupJob Prelude.Text
stopBackupJob_backupJobId :: (Text -> f Text) -> StopBackupJob -> f StopBackupJob
stopBackupJob_backupJobId = (StopBackupJob -> Text)
-> (StopBackupJob -> Text -> StopBackupJob)
-> Lens StopBackupJob StopBackupJob Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopBackupJob' {Text
backupJobId :: Text
$sel:backupJobId:StopBackupJob' :: StopBackupJob -> Text
backupJobId} -> Text
backupJobId) (\s :: StopBackupJob
s@StopBackupJob' {} Text
a -> StopBackupJob
s {$sel:backupJobId:StopBackupJob' :: Text
backupJobId = Text
a} :: StopBackupJob)

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

instance Prelude.Hashable StopBackupJob

instance Prelude.NFData StopBackupJob

instance Core.ToHeaders StopBackupJob where
  toHeaders :: StopBackupJob -> [Header]
toHeaders =
    [Header] -> StopBackupJob -> [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.ToJSON StopBackupJob where
  toJSON :: StopBackupJob -> Value
toJSON = Value -> StopBackupJob -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

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

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

instance Prelude.NFData StopBackupJobResponse