{-# 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.BackupStorage.DeleteObject
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete Object from the incremental base Backup.
module Amazonka.BackupStorage.DeleteObject
  ( -- * Creating a Request
    DeleteObject (..),
    newDeleteObject,

    -- * Request Lenses
    deleteObject_backupJobId,
    deleteObject_objectName,

    -- * Destructuring the Response
    DeleteObjectResponse (..),
    newDeleteObjectResponse,
  )
where

import Amazonka.BackupStorage.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:/ 'newDeleteObject' smart constructor.
data DeleteObject = DeleteObject'
  { -- | Backup job Id for the in-progress backup.
    DeleteObject -> Text
backupJobId :: Prelude.Text,
    -- | The name of the Object.
    DeleteObject -> Text
objectName :: Prelude.Text
  }
  deriving (DeleteObject -> DeleteObject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteObject -> DeleteObject -> Bool
$c/= :: DeleteObject -> DeleteObject -> Bool
== :: DeleteObject -> DeleteObject -> Bool
$c== :: DeleteObject -> DeleteObject -> Bool
Prelude.Eq, ReadPrec [DeleteObject]
ReadPrec DeleteObject
Int -> ReadS DeleteObject
ReadS [DeleteObject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteObject]
$creadListPrec :: ReadPrec [DeleteObject]
readPrec :: ReadPrec DeleteObject
$creadPrec :: ReadPrec DeleteObject
readList :: ReadS [DeleteObject]
$creadList :: ReadS [DeleteObject]
readsPrec :: Int -> ReadS DeleteObject
$creadsPrec :: Int -> ReadS DeleteObject
Prelude.Read, Int -> DeleteObject -> ShowS
[DeleteObject] -> ShowS
DeleteObject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteObject] -> ShowS
$cshowList :: [DeleteObject] -> ShowS
show :: DeleteObject -> String
$cshow :: DeleteObject -> String
showsPrec :: Int -> DeleteObject -> ShowS
$cshowsPrec :: Int -> DeleteObject -> ShowS
Prelude.Show, forall x. Rep DeleteObject x -> DeleteObject
forall x. DeleteObject -> Rep DeleteObject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteObject x -> DeleteObject
$cfrom :: forall x. DeleteObject -> Rep DeleteObject x
Prelude.Generic)

-- |
-- Create a value of 'DeleteObject' 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', 'deleteObject_backupJobId' - Backup job Id for the in-progress backup.
--
-- 'objectName', 'deleteObject_objectName' - The name of the Object.
newDeleteObject ::
  -- | 'backupJobId'
  Prelude.Text ->
  -- | 'objectName'
  Prelude.Text ->
  DeleteObject
newDeleteObject :: Text -> Text -> DeleteObject
newDeleteObject Text
pBackupJobId_ Text
pObjectName_ =
  DeleteObject'
    { $sel:backupJobId:DeleteObject' :: Text
backupJobId = Text
pBackupJobId_,
      $sel:objectName:DeleteObject' :: Text
objectName = Text
pObjectName_
    }

-- | Backup job Id for the in-progress backup.
deleteObject_backupJobId :: Lens.Lens' DeleteObject Prelude.Text
deleteObject_backupJobId :: Lens' DeleteObject Text
deleteObject_backupJobId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Text
backupJobId :: Text
$sel:backupJobId:DeleteObject' :: DeleteObject -> Text
backupJobId} -> Text
backupJobId) (\s :: DeleteObject
s@DeleteObject' {} Text
a -> DeleteObject
s {$sel:backupJobId:DeleteObject' :: Text
backupJobId = Text
a} :: DeleteObject)

-- | The name of the Object.
deleteObject_objectName :: Lens.Lens' DeleteObject Prelude.Text
deleteObject_objectName :: Lens' DeleteObject Text
deleteObject_objectName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteObject' {Text
objectName :: Text
$sel:objectName:DeleteObject' :: DeleteObject -> Text
objectName} -> Text
objectName) (\s :: DeleteObject
s@DeleteObject' {} Text
a -> DeleteObject
s {$sel:objectName:DeleteObject' :: Text
objectName = Text
a} :: DeleteObject)

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

instance Prelude.Hashable DeleteObject where
  hashWithSalt :: Int -> DeleteObject -> Int
hashWithSalt Int
_salt DeleteObject' {Text
objectName :: Text
backupJobId :: Text
$sel:objectName:DeleteObject' :: DeleteObject -> Text
$sel:backupJobId:DeleteObject' :: DeleteObject -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
backupJobId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
objectName

instance Prelude.NFData DeleteObject where
  rnf :: DeleteObject -> ()
rnf DeleteObject' {Text
objectName :: Text
backupJobId :: Text
$sel:objectName:DeleteObject' :: DeleteObject -> Text
$sel:backupJobId:DeleteObject' :: DeleteObject -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
backupJobId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
objectName

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

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

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

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

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

instance Prelude.NFData DeleteObjectResponse where
  rnf :: DeleteObjectResponse -> ()
rnf DeleteObjectResponse
_ = ()