{-# 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.S3.DeleteBucketTagging
-- 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 tags from the bucket.
--
-- To use this operation, you must have permission to perform the
-- @s3:PutBucketTagging@ action. By default, the bucket owner has this
-- permission and can grant this permission to others.
--
-- The following operations are related to @DeleteBucketTagging@:
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html GetBucketTagging>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketTagging.html PutBucketTagging>
module Amazonka.S3.DeleteBucketTagging
  ( -- * Creating a Request
    DeleteBucketTagging (..),
    newDeleteBucketTagging,

    -- * Request Lenses
    deleteBucketTagging_expectedBucketOwner,
    deleteBucketTagging_bucket,

    -- * Destructuring the Response
    DeleteBucketTaggingResponse (..),
    newDeleteBucketTaggingResponse,
  )
where

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
import Amazonka.S3.Types

-- | /See:/ 'newDeleteBucketTagging' smart constructor.
data DeleteBucketTagging = DeleteBucketTagging'
  { -- | The account ID of the expected bucket owner. If the bucket is owned by a
    -- different account, the request will fail with an HTTP
    -- @403 (Access Denied)@ error.
    DeleteBucketTagging -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The bucket that has the tag set to be removed.
    DeleteBucketTagging -> BucketName
bucket :: BucketName
  }
  deriving (DeleteBucketTagging -> DeleteBucketTagging -> Bool
(DeleteBucketTagging -> DeleteBucketTagging -> Bool)
-> (DeleteBucketTagging -> DeleteBucketTagging -> Bool)
-> Eq DeleteBucketTagging
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBucketTagging -> DeleteBucketTagging -> Bool
$c/= :: DeleteBucketTagging -> DeleteBucketTagging -> Bool
== :: DeleteBucketTagging -> DeleteBucketTagging -> Bool
$c== :: DeleteBucketTagging -> DeleteBucketTagging -> Bool
Prelude.Eq, ReadPrec [DeleteBucketTagging]
ReadPrec DeleteBucketTagging
Int -> ReadS DeleteBucketTagging
ReadS [DeleteBucketTagging]
(Int -> ReadS DeleteBucketTagging)
-> ReadS [DeleteBucketTagging]
-> ReadPrec DeleteBucketTagging
-> ReadPrec [DeleteBucketTagging]
-> Read DeleteBucketTagging
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBucketTagging]
$creadListPrec :: ReadPrec [DeleteBucketTagging]
readPrec :: ReadPrec DeleteBucketTagging
$creadPrec :: ReadPrec DeleteBucketTagging
readList :: ReadS [DeleteBucketTagging]
$creadList :: ReadS [DeleteBucketTagging]
readsPrec :: Int -> ReadS DeleteBucketTagging
$creadsPrec :: Int -> ReadS DeleteBucketTagging
Prelude.Read, Int -> DeleteBucketTagging -> ShowS
[DeleteBucketTagging] -> ShowS
DeleteBucketTagging -> String
(Int -> DeleteBucketTagging -> ShowS)
-> (DeleteBucketTagging -> String)
-> ([DeleteBucketTagging] -> ShowS)
-> Show DeleteBucketTagging
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBucketTagging] -> ShowS
$cshowList :: [DeleteBucketTagging] -> ShowS
show :: DeleteBucketTagging -> String
$cshow :: DeleteBucketTagging -> String
showsPrec :: Int -> DeleteBucketTagging -> ShowS
$cshowsPrec :: Int -> DeleteBucketTagging -> ShowS
Prelude.Show, (forall x. DeleteBucketTagging -> Rep DeleteBucketTagging x)
-> (forall x. Rep DeleteBucketTagging x -> DeleteBucketTagging)
-> Generic DeleteBucketTagging
forall x. Rep DeleteBucketTagging x -> DeleteBucketTagging
forall x. DeleteBucketTagging -> Rep DeleteBucketTagging x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteBucketTagging x -> DeleteBucketTagging
$cfrom :: forall x. DeleteBucketTagging -> Rep DeleteBucketTagging x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBucketTagging' 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:
--
-- 'expectedBucketOwner', 'deleteBucketTagging_expectedBucketOwner' - The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
--
-- 'bucket', 'deleteBucketTagging_bucket' - The bucket that has the tag set to be removed.
newDeleteBucketTagging ::
  -- | 'bucket'
  BucketName ->
  DeleteBucketTagging
newDeleteBucketTagging :: BucketName -> DeleteBucketTagging
newDeleteBucketTagging BucketName
pBucket_ =
  DeleteBucketTagging' :: Maybe Text -> BucketName -> DeleteBucketTagging
DeleteBucketTagging'
    { $sel:expectedBucketOwner:DeleteBucketTagging' :: Maybe Text
expectedBucketOwner =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:DeleteBucketTagging' :: BucketName
bucket = BucketName
pBucket_
    }

-- | The account ID of the expected bucket owner. If the bucket is owned by a
-- different account, the request will fail with an HTTP
-- @403 (Access Denied)@ error.
deleteBucketTagging_expectedBucketOwner :: Lens.Lens' DeleteBucketTagging (Prelude.Maybe Prelude.Text)
deleteBucketTagging_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> DeleteBucketTagging -> f DeleteBucketTagging
deleteBucketTagging_expectedBucketOwner = (DeleteBucketTagging -> Maybe Text)
-> (DeleteBucketTagging -> Maybe Text -> DeleteBucketTagging)
-> Lens
     DeleteBucketTagging DeleteBucketTagging (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBucketTagging' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:DeleteBucketTagging' :: DeleteBucketTagging -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: DeleteBucketTagging
s@DeleteBucketTagging' {} Maybe Text
a -> DeleteBucketTagging
s {$sel:expectedBucketOwner:DeleteBucketTagging' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: DeleteBucketTagging)

-- | The bucket that has the tag set to be removed.
deleteBucketTagging_bucket :: Lens.Lens' DeleteBucketTagging BucketName
deleteBucketTagging_bucket :: (BucketName -> f BucketName)
-> DeleteBucketTagging -> f DeleteBucketTagging
deleteBucketTagging_bucket = (DeleteBucketTagging -> BucketName)
-> (DeleteBucketTagging -> BucketName -> DeleteBucketTagging)
-> Lens
     DeleteBucketTagging DeleteBucketTagging BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBucketTagging' {BucketName
bucket :: BucketName
$sel:bucket:DeleteBucketTagging' :: DeleteBucketTagging -> BucketName
bucket} -> BucketName
bucket) (\s :: DeleteBucketTagging
s@DeleteBucketTagging' {} BucketName
a -> DeleteBucketTagging
s {$sel:bucket:DeleteBucketTagging' :: BucketName
bucket = BucketName
a} :: DeleteBucketTagging)

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

instance Prelude.Hashable DeleteBucketTagging

instance Prelude.NFData DeleteBucketTagging

instance Core.ToHeaders DeleteBucketTagging where
  toHeaders :: DeleteBucketTagging -> [Header]
toHeaders DeleteBucketTagging' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:DeleteBucketTagging' :: DeleteBucketTagging -> BucketName
$sel:expectedBucketOwner:DeleteBucketTagging' :: DeleteBucketTagging -> Maybe Text
..} =
    [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-expected-bucket-owner"
          HeaderName -> Maybe Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Text
expectedBucketOwner
      ]

instance Core.ToPath DeleteBucketTagging where
  toPath :: DeleteBucketTagging -> ByteString
toPath DeleteBucketTagging' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:DeleteBucketTagging' :: DeleteBucketTagging -> BucketName
$sel:expectedBucketOwner:DeleteBucketTagging' :: DeleteBucketTagging -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket]

instance Core.ToQuery DeleteBucketTagging where
  toQuery :: DeleteBucketTagging -> QueryString
toQuery = QueryString -> DeleteBucketTagging -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"tagging"])

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

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

instance Prelude.NFData DeleteBucketTaggingResponse