{-# 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.DeleteBucketInventoryConfiguration
-- 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 an inventory configuration (identified by the inventory ID) from
-- the bucket.
--
-- To use this operation, you must have permissions to perform the
-- @s3:PutInventoryConfiguration@ action. The bucket owner has this
-- permission by default. The bucket owner can grant this permission to
-- others. For more information about permissions, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources Permissions Related to Bucket Subresource Operations>
-- and
-- <https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html Managing Access Permissions to Your Amazon S3 Resources>.
--
-- For information about the Amazon S3 inventory feature, see
-- <https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html Amazon S3 Inventory>.
--
-- Operations related to @DeleteBucketInventoryConfiguration@ include:
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketInventoryConfiguration.html GetBucketInventoryConfiguration>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketInventoryConfiguration.html PutBucketInventoryConfiguration>
--
-- -   <https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketInventoryConfigurations.html ListBucketInventoryConfigurations>
module Amazonka.S3.DeleteBucketInventoryConfiguration
  ( -- * Creating a Request
    DeleteBucketInventoryConfiguration (..),
    newDeleteBucketInventoryConfiguration,

    -- * Request Lenses
    deleteBucketInventoryConfiguration_expectedBucketOwner,
    deleteBucketInventoryConfiguration_bucket,
    deleteBucketInventoryConfiguration_id,

    -- * Destructuring the Response
    DeleteBucketInventoryConfigurationResponse (..),
    newDeleteBucketInventoryConfigurationResponse,
  )
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:/ 'newDeleteBucketInventoryConfiguration' smart constructor.
data DeleteBucketInventoryConfiguration = DeleteBucketInventoryConfiguration'
  { -- | 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.
    DeleteBucketInventoryConfiguration -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
    -- | The name of the bucket containing the inventory configuration to delete.
    DeleteBucketInventoryConfiguration -> BucketName
bucket :: BucketName,
    -- | The ID used to identify the inventory configuration.
    DeleteBucketInventoryConfiguration -> Text
id :: Prelude.Text
  }
  deriving (DeleteBucketInventoryConfiguration
-> DeleteBucketInventoryConfiguration -> Bool
(DeleteBucketInventoryConfiguration
 -> DeleteBucketInventoryConfiguration -> Bool)
-> (DeleteBucketInventoryConfiguration
    -> DeleteBucketInventoryConfiguration -> Bool)
-> Eq DeleteBucketInventoryConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteBucketInventoryConfiguration
-> DeleteBucketInventoryConfiguration -> Bool
$c/= :: DeleteBucketInventoryConfiguration
-> DeleteBucketInventoryConfiguration -> Bool
== :: DeleteBucketInventoryConfiguration
-> DeleteBucketInventoryConfiguration -> Bool
$c== :: DeleteBucketInventoryConfiguration
-> DeleteBucketInventoryConfiguration -> Bool
Prelude.Eq, ReadPrec [DeleteBucketInventoryConfiguration]
ReadPrec DeleteBucketInventoryConfiguration
Int -> ReadS DeleteBucketInventoryConfiguration
ReadS [DeleteBucketInventoryConfiguration]
(Int -> ReadS DeleteBucketInventoryConfiguration)
-> ReadS [DeleteBucketInventoryConfiguration]
-> ReadPrec DeleteBucketInventoryConfiguration
-> ReadPrec [DeleteBucketInventoryConfiguration]
-> Read DeleteBucketInventoryConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteBucketInventoryConfiguration]
$creadListPrec :: ReadPrec [DeleteBucketInventoryConfiguration]
readPrec :: ReadPrec DeleteBucketInventoryConfiguration
$creadPrec :: ReadPrec DeleteBucketInventoryConfiguration
readList :: ReadS [DeleteBucketInventoryConfiguration]
$creadList :: ReadS [DeleteBucketInventoryConfiguration]
readsPrec :: Int -> ReadS DeleteBucketInventoryConfiguration
$creadsPrec :: Int -> ReadS DeleteBucketInventoryConfiguration
Prelude.Read, Int -> DeleteBucketInventoryConfiguration -> ShowS
[DeleteBucketInventoryConfiguration] -> ShowS
DeleteBucketInventoryConfiguration -> String
(Int -> DeleteBucketInventoryConfiguration -> ShowS)
-> (DeleteBucketInventoryConfiguration -> String)
-> ([DeleteBucketInventoryConfiguration] -> ShowS)
-> Show DeleteBucketInventoryConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteBucketInventoryConfiguration] -> ShowS
$cshowList :: [DeleteBucketInventoryConfiguration] -> ShowS
show :: DeleteBucketInventoryConfiguration -> String
$cshow :: DeleteBucketInventoryConfiguration -> String
showsPrec :: Int -> DeleteBucketInventoryConfiguration -> ShowS
$cshowsPrec :: Int -> DeleteBucketInventoryConfiguration -> ShowS
Prelude.Show, (forall x.
 DeleteBucketInventoryConfiguration
 -> Rep DeleteBucketInventoryConfiguration x)
-> (forall x.
    Rep DeleteBucketInventoryConfiguration x
    -> DeleteBucketInventoryConfiguration)
-> Generic DeleteBucketInventoryConfiguration
forall x.
Rep DeleteBucketInventoryConfiguration x
-> DeleteBucketInventoryConfiguration
forall x.
DeleteBucketInventoryConfiguration
-> Rep DeleteBucketInventoryConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteBucketInventoryConfiguration x
-> DeleteBucketInventoryConfiguration
$cfrom :: forall x.
DeleteBucketInventoryConfiguration
-> Rep DeleteBucketInventoryConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DeleteBucketInventoryConfiguration' 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', 'deleteBucketInventoryConfiguration_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', 'deleteBucketInventoryConfiguration_bucket' - The name of the bucket containing the inventory configuration to delete.
--
-- 'id', 'deleteBucketInventoryConfiguration_id' - The ID used to identify the inventory configuration.
newDeleteBucketInventoryConfiguration ::
  -- | 'bucket'
  BucketName ->
  -- | 'id'
  Prelude.Text ->
  DeleteBucketInventoryConfiguration
newDeleteBucketInventoryConfiguration :: BucketName -> Text -> DeleteBucketInventoryConfiguration
newDeleteBucketInventoryConfiguration BucketName
pBucket_ Text
pId_ =
  DeleteBucketInventoryConfiguration' :: Maybe Text
-> BucketName -> Text -> DeleteBucketInventoryConfiguration
DeleteBucketInventoryConfiguration'
    { $sel:expectedBucketOwner:DeleteBucketInventoryConfiguration' :: Maybe Text
expectedBucketOwner =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucket:DeleteBucketInventoryConfiguration' :: BucketName
bucket = BucketName
pBucket_,
      $sel:id:DeleteBucketInventoryConfiguration' :: Text
id = Text
pId_
    }

-- | 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.
deleteBucketInventoryConfiguration_expectedBucketOwner :: Lens.Lens' DeleteBucketInventoryConfiguration (Prelude.Maybe Prelude.Text)
deleteBucketInventoryConfiguration_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> DeleteBucketInventoryConfiguration
-> f DeleteBucketInventoryConfiguration
deleteBucketInventoryConfiguration_expectedBucketOwner = (DeleteBucketInventoryConfiguration -> Maybe Text)
-> (DeleteBucketInventoryConfiguration
    -> Maybe Text -> DeleteBucketInventoryConfiguration)
-> Lens
     DeleteBucketInventoryConfiguration
     DeleteBucketInventoryConfiguration
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBucketInventoryConfiguration' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: DeleteBucketInventoryConfiguration
s@DeleteBucketInventoryConfiguration' {} Maybe Text
a -> DeleteBucketInventoryConfiguration
s {$sel:expectedBucketOwner:DeleteBucketInventoryConfiguration' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: DeleteBucketInventoryConfiguration)

-- | The name of the bucket containing the inventory configuration to delete.
deleteBucketInventoryConfiguration_bucket :: Lens.Lens' DeleteBucketInventoryConfiguration BucketName
deleteBucketInventoryConfiguration_bucket :: (BucketName -> f BucketName)
-> DeleteBucketInventoryConfiguration
-> f DeleteBucketInventoryConfiguration
deleteBucketInventoryConfiguration_bucket = (DeleteBucketInventoryConfiguration -> BucketName)
-> (DeleteBucketInventoryConfiguration
    -> BucketName -> DeleteBucketInventoryConfiguration)
-> Lens
     DeleteBucketInventoryConfiguration
     DeleteBucketInventoryConfiguration
     BucketName
     BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBucketInventoryConfiguration' {BucketName
bucket :: BucketName
$sel:bucket:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> BucketName
bucket} -> BucketName
bucket) (\s :: DeleteBucketInventoryConfiguration
s@DeleteBucketInventoryConfiguration' {} BucketName
a -> DeleteBucketInventoryConfiguration
s {$sel:bucket:DeleteBucketInventoryConfiguration' :: BucketName
bucket = BucketName
a} :: DeleteBucketInventoryConfiguration)

-- | The ID used to identify the inventory configuration.
deleteBucketInventoryConfiguration_id :: Lens.Lens' DeleteBucketInventoryConfiguration Prelude.Text
deleteBucketInventoryConfiguration_id :: (Text -> f Text)
-> DeleteBucketInventoryConfiguration
-> f DeleteBucketInventoryConfiguration
deleteBucketInventoryConfiguration_id = (DeleteBucketInventoryConfiguration -> Text)
-> (DeleteBucketInventoryConfiguration
    -> Text -> DeleteBucketInventoryConfiguration)
-> Lens
     DeleteBucketInventoryConfiguration
     DeleteBucketInventoryConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteBucketInventoryConfiguration' {Text
id :: Text
$sel:id:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> Text
id} -> Text
id) (\s :: DeleteBucketInventoryConfiguration
s@DeleteBucketInventoryConfiguration' {} Text
a -> DeleteBucketInventoryConfiguration
s {$sel:id:DeleteBucketInventoryConfiguration' :: Text
id = Text
a} :: DeleteBucketInventoryConfiguration)

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

instance
  Prelude.Hashable
    DeleteBucketInventoryConfiguration

instance
  Prelude.NFData
    DeleteBucketInventoryConfiguration

instance
  Core.ToHeaders
    DeleteBucketInventoryConfiguration
  where
  toHeaders :: DeleteBucketInventoryConfiguration -> [Header]
toHeaders DeleteBucketInventoryConfiguration' {Maybe Text
Text
BucketName
id :: Text
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:id:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> Text
$sel:bucket:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> BucketName
$sel:expectedBucketOwner:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> 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
    DeleteBucketInventoryConfiguration
  where
  toPath :: DeleteBucketInventoryConfiguration -> ByteString
toPath DeleteBucketInventoryConfiguration' {Maybe Text
Text
BucketName
id :: Text
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:id:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> Text
$sel:bucket:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> BucketName
$sel:expectedBucketOwner:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> 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
    DeleteBucketInventoryConfiguration
  where
  toQuery :: DeleteBucketInventoryConfiguration -> QueryString
toQuery DeleteBucketInventoryConfiguration' {Maybe Text
Text
BucketName
id :: Text
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:id:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> Text
$sel:bucket:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> BucketName
$sel:expectedBucketOwner:DeleteBucketInventoryConfiguration' :: DeleteBucketInventoryConfiguration -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"id" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
id, QueryString
"inventory"]

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

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

instance
  Prelude.NFData
    DeleteBucketInventoryConfigurationResponse