{-# 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.DeleteBackupVaultAccessPolicy
-- 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 policy document that manages permissions on a backup vault.
module Amazonka.Backup.DeleteBackupVaultAccessPolicy
  ( -- * Creating a Request
    DeleteBackupVaultAccessPolicy (..),
    newDeleteBackupVaultAccessPolicy,

    -- * Request Lenses
    deleteBackupVaultAccessPolicy_backupVaultName,

    -- * Destructuring the Response
    DeleteBackupVaultAccessPolicyResponse (..),
    newDeleteBackupVaultAccessPolicyResponse,
  )
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:/ 'newDeleteBackupVaultAccessPolicy' smart constructor.
data DeleteBackupVaultAccessPolicy = DeleteBackupVaultAccessPolicy'
  { -- | 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.
    DeleteBackupVaultAccessPolicy -> Text
backupVaultName :: Prelude.Text
  }
  deriving (DeleteBackupVaultAccessPolicy
-> DeleteBackupVaultAccessPolicy -> Bool
(DeleteBackupVaultAccessPolicy
 -> DeleteBackupVaultAccessPolicy -> Bool)
-> (DeleteBackupVaultAccessPolicy
    -> DeleteBackupVaultAccessPolicy -> Bool)
-> Eq DeleteBackupVaultAccessPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBackupVaultAccessPolicy
-> DeleteBackupVaultAccessPolicy -> Bool
$c/= :: DeleteBackupVaultAccessPolicy
-> DeleteBackupVaultAccessPolicy -> Bool
== :: DeleteBackupVaultAccessPolicy
-> DeleteBackupVaultAccessPolicy -> Bool
$c== :: DeleteBackupVaultAccessPolicy
-> DeleteBackupVaultAccessPolicy -> Bool
Prelude.Eq, ReadPrec [DeleteBackupVaultAccessPolicy]
ReadPrec DeleteBackupVaultAccessPolicy
Int -> ReadS DeleteBackupVaultAccessPolicy
ReadS [DeleteBackupVaultAccessPolicy]
(Int -> ReadS DeleteBackupVaultAccessPolicy)
-> ReadS [DeleteBackupVaultAccessPolicy]
-> ReadPrec DeleteBackupVaultAccessPolicy
-> ReadPrec [DeleteBackupVaultAccessPolicy]
-> Read DeleteBackupVaultAccessPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBackupVaultAccessPolicy]
$creadListPrec :: ReadPrec [DeleteBackupVaultAccessPolicy]
readPrec :: ReadPrec DeleteBackupVaultAccessPolicy
$creadPrec :: ReadPrec DeleteBackupVaultAccessPolicy
readList :: ReadS [DeleteBackupVaultAccessPolicy]
$creadList :: ReadS [DeleteBackupVaultAccessPolicy]
readsPrec :: Int -> ReadS DeleteBackupVaultAccessPolicy
$creadsPrec :: Int -> ReadS DeleteBackupVaultAccessPolicy
Prelude.Read, Int -> DeleteBackupVaultAccessPolicy -> ShowS
[DeleteBackupVaultAccessPolicy] -> ShowS
DeleteBackupVaultAccessPolicy -> String
(Int -> DeleteBackupVaultAccessPolicy -> ShowS)
-> (DeleteBackupVaultAccessPolicy -> String)
-> ([DeleteBackupVaultAccessPolicy] -> ShowS)
-> Show DeleteBackupVaultAccessPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBackupVaultAccessPolicy] -> ShowS
$cshowList :: [DeleteBackupVaultAccessPolicy] -> ShowS
show :: DeleteBackupVaultAccessPolicy -> String
$cshow :: DeleteBackupVaultAccessPolicy -> String
showsPrec :: Int -> DeleteBackupVaultAccessPolicy -> ShowS
$cshowsPrec :: Int -> DeleteBackupVaultAccessPolicy -> ShowS
Prelude.Show, (forall x.
 DeleteBackupVaultAccessPolicy
 -> Rep DeleteBackupVaultAccessPolicy x)
-> (forall x.
    Rep DeleteBackupVaultAccessPolicy x
    -> DeleteBackupVaultAccessPolicy)
-> Generic DeleteBackupVaultAccessPolicy
forall x.
Rep DeleteBackupVaultAccessPolicy x
-> DeleteBackupVaultAccessPolicy
forall x.
DeleteBackupVaultAccessPolicy
-> Rep DeleteBackupVaultAccessPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteBackupVaultAccessPolicy x
-> DeleteBackupVaultAccessPolicy
$cfrom :: forall x.
DeleteBackupVaultAccessPolicy
-> Rep DeleteBackupVaultAccessPolicy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBackupVaultAccessPolicy' 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', 'deleteBackupVaultAccessPolicy_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.
newDeleteBackupVaultAccessPolicy ::
  -- | 'backupVaultName'
  Prelude.Text ->
  DeleteBackupVaultAccessPolicy
newDeleteBackupVaultAccessPolicy :: Text -> DeleteBackupVaultAccessPolicy
newDeleteBackupVaultAccessPolicy Text
pBackupVaultName_ =
  DeleteBackupVaultAccessPolicy' :: Text -> DeleteBackupVaultAccessPolicy
DeleteBackupVaultAccessPolicy'
    { $sel:backupVaultName:DeleteBackupVaultAccessPolicy' :: 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.
deleteBackupVaultAccessPolicy_backupVaultName :: Lens.Lens' DeleteBackupVaultAccessPolicy Prelude.Text
deleteBackupVaultAccessPolicy_backupVaultName :: (Text -> f Text)
-> DeleteBackupVaultAccessPolicy -> f DeleteBackupVaultAccessPolicy
deleteBackupVaultAccessPolicy_backupVaultName = (DeleteBackupVaultAccessPolicy -> Text)
-> (DeleteBackupVaultAccessPolicy
    -> Text -> DeleteBackupVaultAccessPolicy)
-> Lens
     DeleteBackupVaultAccessPolicy
     DeleteBackupVaultAccessPolicy
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBackupVaultAccessPolicy' {Text
backupVaultName :: Text
$sel:backupVaultName:DeleteBackupVaultAccessPolicy' :: DeleteBackupVaultAccessPolicy -> Text
backupVaultName} -> Text
backupVaultName) (\s :: DeleteBackupVaultAccessPolicy
s@DeleteBackupVaultAccessPolicy' {} Text
a -> DeleteBackupVaultAccessPolicy
s {$sel:backupVaultName:DeleteBackupVaultAccessPolicy' :: Text
backupVaultName = Text
a} :: DeleteBackupVaultAccessPolicy)

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

instance
  Prelude.Hashable
    DeleteBackupVaultAccessPolicy

instance Prelude.NFData DeleteBackupVaultAccessPolicy

instance Core.ToHeaders DeleteBackupVaultAccessPolicy where
  toHeaders :: DeleteBackupVaultAccessPolicy -> [Header]
toHeaders =
    [Header] -> DeleteBackupVaultAccessPolicy -> [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 DeleteBackupVaultAccessPolicy where
  toPath :: DeleteBackupVaultAccessPolicy -> ByteString
toPath DeleteBackupVaultAccessPolicy' {Text
backupVaultName :: Text
$sel:backupVaultName:DeleteBackupVaultAccessPolicy' :: DeleteBackupVaultAccessPolicy -> 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,
        ByteString
"/access-policy"
      ]

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

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

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

instance
  Prelude.NFData
    DeleteBackupVaultAccessPolicyResponse