{-# 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.Glacier.DeleteVaultAccessPolicy
-- 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 deletes the access policy associated with the specified
-- vault. The operation is eventually consistent; that is, it might take
-- some time for Amazon S3 Glacier to completely remove the access policy,
-- and you might still see the effect of the policy for a short time after
-- you send the delete request.
--
-- This operation is idempotent. You can invoke delete multiple times, even
-- if there is no policy associated with the vault. For more information
-- about vault access policies, see
-- <https://docs.aws.amazon.com/amazonglacier/latest/dev/vault-access-policy.html Amazon Glacier Access Control with Vault Access Policies>.
module Amazonka.Glacier.DeleteVaultAccessPolicy
  ( -- * Creating a Request
    DeleteVaultAccessPolicy (..),
    newDeleteVaultAccessPolicy,

    -- * Request Lenses
    deleteVaultAccessPolicy_accountId,
    deleteVaultAccessPolicy_vaultName,

    -- * Destructuring the Response
    DeleteVaultAccessPolicyResponse (..),
    newDeleteVaultAccessPolicyResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Glacier.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

-- | DeleteVaultAccessPolicy input.
--
-- /See:/ 'newDeleteVaultAccessPolicy' smart constructor.
data DeleteVaultAccessPolicy = DeleteVaultAccessPolicy'
  { -- | The @AccountId@ value is the AWS account ID of the account that owns the
    -- vault. You can either specify an AWS account ID or optionally a single
    -- \'@-@\' (hyphen), in which case Amazon S3 Glacier uses the AWS account
    -- ID associated with the credentials used to sign the request. If you use
    -- an account ID, do not include any hyphens (\'-\') in the ID.
    DeleteVaultAccessPolicy -> Text
accountId :: Prelude.Text,
    -- | The name of the vault.
    DeleteVaultAccessPolicy -> Text
vaultName :: Prelude.Text
  }
  deriving (DeleteVaultAccessPolicy -> DeleteVaultAccessPolicy -> Bool
(DeleteVaultAccessPolicy -> DeleteVaultAccessPolicy -> Bool)
-> (DeleteVaultAccessPolicy -> DeleteVaultAccessPolicy -> Bool)
-> Eq DeleteVaultAccessPolicy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVaultAccessPolicy -> DeleteVaultAccessPolicy -> Bool
$c/= :: DeleteVaultAccessPolicy -> DeleteVaultAccessPolicy -> Bool
== :: DeleteVaultAccessPolicy -> DeleteVaultAccessPolicy -> Bool
$c== :: DeleteVaultAccessPolicy -> DeleteVaultAccessPolicy -> Bool
Prelude.Eq, ReadPrec [DeleteVaultAccessPolicy]
ReadPrec DeleteVaultAccessPolicy
Int -> ReadS DeleteVaultAccessPolicy
ReadS [DeleteVaultAccessPolicy]
(Int -> ReadS DeleteVaultAccessPolicy)
-> ReadS [DeleteVaultAccessPolicy]
-> ReadPrec DeleteVaultAccessPolicy
-> ReadPrec [DeleteVaultAccessPolicy]
-> Read DeleteVaultAccessPolicy
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVaultAccessPolicy]
$creadListPrec :: ReadPrec [DeleteVaultAccessPolicy]
readPrec :: ReadPrec DeleteVaultAccessPolicy
$creadPrec :: ReadPrec DeleteVaultAccessPolicy
readList :: ReadS [DeleteVaultAccessPolicy]
$creadList :: ReadS [DeleteVaultAccessPolicy]
readsPrec :: Int -> ReadS DeleteVaultAccessPolicy
$creadsPrec :: Int -> ReadS DeleteVaultAccessPolicy
Prelude.Read, Int -> DeleteVaultAccessPolicy -> ShowS
[DeleteVaultAccessPolicy] -> ShowS
DeleteVaultAccessPolicy -> String
(Int -> DeleteVaultAccessPolicy -> ShowS)
-> (DeleteVaultAccessPolicy -> String)
-> ([DeleteVaultAccessPolicy] -> ShowS)
-> Show DeleteVaultAccessPolicy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVaultAccessPolicy] -> ShowS
$cshowList :: [DeleteVaultAccessPolicy] -> ShowS
show :: DeleteVaultAccessPolicy -> String
$cshow :: DeleteVaultAccessPolicy -> String
showsPrec :: Int -> DeleteVaultAccessPolicy -> ShowS
$cshowsPrec :: Int -> DeleteVaultAccessPolicy -> ShowS
Prelude.Show, (forall x.
 DeleteVaultAccessPolicy -> Rep DeleteVaultAccessPolicy x)
-> (forall x.
    Rep DeleteVaultAccessPolicy x -> DeleteVaultAccessPolicy)
-> Generic DeleteVaultAccessPolicy
forall x. Rep DeleteVaultAccessPolicy x -> DeleteVaultAccessPolicy
forall x. DeleteVaultAccessPolicy -> Rep DeleteVaultAccessPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteVaultAccessPolicy x -> DeleteVaultAccessPolicy
$cfrom :: forall x. DeleteVaultAccessPolicy -> Rep DeleteVaultAccessPolicy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVaultAccessPolicy' 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:
--
-- 'accountId', 'deleteVaultAccessPolicy_accountId' - The @AccountId@ value is the AWS account ID of the account that owns the
-- vault. You can either specify an AWS account ID or optionally a single
-- \'@-@\' (hyphen), in which case Amazon S3 Glacier uses the AWS account
-- ID associated with the credentials used to sign the request. If you use
-- an account ID, do not include any hyphens (\'-\') in the ID.
--
-- 'vaultName', 'deleteVaultAccessPolicy_vaultName' - The name of the vault.
newDeleteVaultAccessPolicy ::
  -- | 'accountId'
  Prelude.Text ->
  -- | 'vaultName'
  Prelude.Text ->
  DeleteVaultAccessPolicy
newDeleteVaultAccessPolicy :: Text -> Text -> DeleteVaultAccessPolicy
newDeleteVaultAccessPolicy Text
pAccountId_ Text
pVaultName_ =
  DeleteVaultAccessPolicy' :: Text -> Text -> DeleteVaultAccessPolicy
DeleteVaultAccessPolicy'
    { $sel:accountId:DeleteVaultAccessPolicy' :: Text
accountId = Text
pAccountId_,
      $sel:vaultName:DeleteVaultAccessPolicy' :: Text
vaultName = Text
pVaultName_
    }

-- | The @AccountId@ value is the AWS account ID of the account that owns the
-- vault. You can either specify an AWS account ID or optionally a single
-- \'@-@\' (hyphen), in which case Amazon S3 Glacier uses the AWS account
-- ID associated with the credentials used to sign the request. If you use
-- an account ID, do not include any hyphens (\'-\') in the ID.
deleteVaultAccessPolicy_accountId :: Lens.Lens' DeleteVaultAccessPolicy Prelude.Text
deleteVaultAccessPolicy_accountId :: (Text -> f Text)
-> DeleteVaultAccessPolicy -> f DeleteVaultAccessPolicy
deleteVaultAccessPolicy_accountId = (DeleteVaultAccessPolicy -> Text)
-> (DeleteVaultAccessPolicy -> Text -> DeleteVaultAccessPolicy)
-> Lens DeleteVaultAccessPolicy DeleteVaultAccessPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVaultAccessPolicy' {Text
accountId :: Text
$sel:accountId:DeleteVaultAccessPolicy' :: DeleteVaultAccessPolicy -> Text
accountId} -> Text
accountId) (\s :: DeleteVaultAccessPolicy
s@DeleteVaultAccessPolicy' {} Text
a -> DeleteVaultAccessPolicy
s {$sel:accountId:DeleteVaultAccessPolicy' :: Text
accountId = Text
a} :: DeleteVaultAccessPolicy)

-- | The name of the vault.
deleteVaultAccessPolicy_vaultName :: Lens.Lens' DeleteVaultAccessPolicy Prelude.Text
deleteVaultAccessPolicy_vaultName :: (Text -> f Text)
-> DeleteVaultAccessPolicy -> f DeleteVaultAccessPolicy
deleteVaultAccessPolicy_vaultName = (DeleteVaultAccessPolicy -> Text)
-> (DeleteVaultAccessPolicy -> Text -> DeleteVaultAccessPolicy)
-> Lens DeleteVaultAccessPolicy DeleteVaultAccessPolicy Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVaultAccessPolicy' {Text
vaultName :: Text
$sel:vaultName:DeleteVaultAccessPolicy' :: DeleteVaultAccessPolicy -> Text
vaultName} -> Text
vaultName) (\s :: DeleteVaultAccessPolicy
s@DeleteVaultAccessPolicy' {} Text
a -> DeleteVaultAccessPolicy
s {$sel:vaultName:DeleteVaultAccessPolicy' :: Text
vaultName = Text
a} :: DeleteVaultAccessPolicy)

instance Core.AWSRequest DeleteVaultAccessPolicy where
  type
    AWSResponse DeleteVaultAccessPolicy =
      DeleteVaultAccessPolicyResponse
  request :: DeleteVaultAccessPolicy -> Request DeleteVaultAccessPolicy
request =
    ByteString
-> Request DeleteVaultAccessPolicy
-> Request DeleteVaultAccessPolicy
forall a. ByteString -> Request a -> Request a
Request.glacierVersionHeader (Service -> ByteString
Core._serviceVersion Service
defaultService)
      (Request DeleteVaultAccessPolicy
 -> Request DeleteVaultAccessPolicy)
-> (DeleteVaultAccessPolicy -> Request DeleteVaultAccessPolicy)
-> DeleteVaultAccessPolicy
-> Request DeleteVaultAccessPolicy
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> DeleteVaultAccessPolicy -> Request DeleteVaultAccessPolicy
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteVaultAccessPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVaultAccessPolicy)))
response =
    AWSResponse DeleteVaultAccessPolicy
-> Logger
-> Service
-> Proxy DeleteVaultAccessPolicy
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVaultAccessPolicy)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse DeleteVaultAccessPolicy
DeleteVaultAccessPolicyResponse
DeleteVaultAccessPolicyResponse'

instance Prelude.Hashable DeleteVaultAccessPolicy

instance Prelude.NFData DeleteVaultAccessPolicy

instance Core.ToHeaders DeleteVaultAccessPolicy where
  toHeaders :: DeleteVaultAccessPolicy -> [Header]
toHeaders = [Header] -> DeleteVaultAccessPolicy -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DeleteVaultAccessPolicy where
  toPath :: DeleteVaultAccessPolicy -> ByteString
toPath DeleteVaultAccessPolicy' {Text
vaultName :: Text
accountId :: Text
$sel:vaultName:DeleteVaultAccessPolicy' :: DeleteVaultAccessPolicy -> Text
$sel:accountId:DeleteVaultAccessPolicy' :: DeleteVaultAccessPolicy -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
accountId,
        ByteString
"/vaults/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
vaultName,
        ByteString
"/access-policy"
      ]

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

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

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

instance
  Prelude.NFData
    DeleteVaultAccessPolicyResponse