{-# 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.DeleteBackupVault
-- 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)
--
-- Deletes the backup vault identified by its name. A vault can be deleted
-- only if it is empty.
module Amazonka.Backup.DeleteBackupVault
  ( -- * Creating a Request
    DeleteBackupVault (..),
    newDeleteBackupVault,

    -- * Request Lenses
    deleteBackupVault_backupVaultName,

    -- * Destructuring the Response
    DeleteBackupVaultResponse (..),
    newDeleteBackupVaultResponse,
  )
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:/ 'newDeleteBackupVault' smart constructor.
data DeleteBackupVault = DeleteBackupVault'
  { -- | The name of a logical container where backups are stored. Backup vaults
    -- are identified by names that are unique to the account used to create
    -- them and the Amazon Web Services Region where they are created. They
    -- consist of lowercase letters, numbers, and hyphens.
    DeleteBackupVault -> Text
backupVaultName :: Prelude.Text
  }
  deriving (DeleteBackupVault -> DeleteBackupVault -> Bool
(DeleteBackupVault -> DeleteBackupVault -> Bool)
-> (DeleteBackupVault -> DeleteBackupVault -> Bool)
-> Eq DeleteBackupVault
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBackupVault -> DeleteBackupVault -> Bool
$c/= :: DeleteBackupVault -> DeleteBackupVault -> Bool
== :: DeleteBackupVault -> DeleteBackupVault -> Bool
$c== :: DeleteBackupVault -> DeleteBackupVault -> Bool
Prelude.Eq, ReadPrec [DeleteBackupVault]
ReadPrec DeleteBackupVault
Int -> ReadS DeleteBackupVault
ReadS [DeleteBackupVault]
(Int -> ReadS DeleteBackupVault)
-> ReadS [DeleteBackupVault]
-> ReadPrec DeleteBackupVault
-> ReadPrec [DeleteBackupVault]
-> Read DeleteBackupVault
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBackupVault]
$creadListPrec :: ReadPrec [DeleteBackupVault]
readPrec :: ReadPrec DeleteBackupVault
$creadPrec :: ReadPrec DeleteBackupVault
readList :: ReadS [DeleteBackupVault]
$creadList :: ReadS [DeleteBackupVault]
readsPrec :: Int -> ReadS DeleteBackupVault
$creadsPrec :: Int -> ReadS DeleteBackupVault
Prelude.Read, Int -> DeleteBackupVault -> ShowS
[DeleteBackupVault] -> ShowS
DeleteBackupVault -> String
(Int -> DeleteBackupVault -> ShowS)
-> (DeleteBackupVault -> String)
-> ([DeleteBackupVault] -> ShowS)
-> Show DeleteBackupVault
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBackupVault] -> ShowS
$cshowList :: [DeleteBackupVault] -> ShowS
show :: DeleteBackupVault -> String
$cshow :: DeleteBackupVault -> String
showsPrec :: Int -> DeleteBackupVault -> ShowS
$cshowsPrec :: Int -> DeleteBackupVault -> ShowS
Prelude.Show, (forall x. DeleteBackupVault -> Rep DeleteBackupVault x)
-> (forall x. Rep DeleteBackupVault x -> DeleteBackupVault)
-> Generic DeleteBackupVault
forall x. Rep DeleteBackupVault x -> DeleteBackupVault
forall x. DeleteBackupVault -> Rep DeleteBackupVault x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBackupVault x -> DeleteBackupVault
$cfrom :: forall x. DeleteBackupVault -> Rep DeleteBackupVault x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBackupVault' 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:
--
-- 'backupVaultName', 'deleteBackupVault_backupVaultName' - The name of a logical container where backups are stored. Backup vaults
-- are identified by names that are unique to the account used to create
-- them and the Amazon Web Services Region where they are created. They
-- consist of lowercase letters, numbers, and hyphens.
newDeleteBackupVault ::
  -- | 'backupVaultName'
  Prelude.Text ->
  DeleteBackupVault
newDeleteBackupVault :: Text -> DeleteBackupVault
newDeleteBackupVault Text
pBackupVaultName_ =
  DeleteBackupVault' :: Text -> DeleteBackupVault
DeleteBackupVault'
    { $sel:backupVaultName:DeleteBackupVault' :: Text
backupVaultName =
        Text
pBackupVaultName_
    }

-- | The name of a logical container where backups are stored. Backup vaults
-- are identified by names that are unique to the account used to create
-- them and the Amazon Web Services Region where they are created. They
-- consist of lowercase letters, numbers, and hyphens.
deleteBackupVault_backupVaultName :: Lens.Lens' DeleteBackupVault Prelude.Text
deleteBackupVault_backupVaultName :: (Text -> f Text) -> DeleteBackupVault -> f DeleteBackupVault
deleteBackupVault_backupVaultName = (DeleteBackupVault -> Text)
-> (DeleteBackupVault -> Text -> DeleteBackupVault)
-> Lens DeleteBackupVault DeleteBackupVault Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBackupVault' {Text
backupVaultName :: Text
$sel:backupVaultName:DeleteBackupVault' :: DeleteBackupVault -> Text
backupVaultName} -> Text
backupVaultName) (\s :: DeleteBackupVault
s@DeleteBackupVault' {} Text
a -> DeleteBackupVault
s {$sel:backupVaultName:DeleteBackupVault' :: Text
backupVaultName = Text
a} :: DeleteBackupVault)

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

instance Prelude.Hashable DeleteBackupVault

instance Prelude.NFData DeleteBackupVault

instance Core.ToHeaders DeleteBackupVault where
  toHeaders :: DeleteBackupVault -> [Header]
toHeaders =
    [Header] -> DeleteBackupVault -> [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 DeleteBackupVault where
  toPath :: DeleteBackupVault -> ByteString
toPath DeleteBackupVault' {Text
backupVaultName :: Text
$sel:backupVaultName:DeleteBackupVault' :: DeleteBackupVault -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/backup-vaults/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
backupVaultName]

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

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

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

instance Prelude.NFData DeleteBackupVaultResponse