{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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 fails with the HTTP status code
    -- @403 Forbidden@ (access denied).
    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
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]
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
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.
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 fails with the HTTP status code
-- @403 Forbidden@ (access denied).
--
-- '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'
    { $sel:expectedBucketOwner:DeleteBucketInventoryConfiguration' :: Maybe Text
expectedBucketOwner =
        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 fails with the HTTP status code
-- @403 Forbidden@ (access denied).
deleteBucketInventoryConfiguration_expectedBucketOwner :: Lens.Lens' DeleteBucketInventoryConfiguration (Prelude.Maybe Prelude.Text)
deleteBucketInventoryConfiguration_expectedBucketOwner :: Lens' DeleteBucketInventoryConfiguration (Maybe Text)
deleteBucketInventoryConfiguration_expectedBucketOwner = 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 :: Lens' DeleteBucketInventoryConfiguration BucketName
deleteBucketInventoryConfiguration_bucket = 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 :: Lens' DeleteBucketInventoryConfiguration Text
deleteBucketInventoryConfiguration_id = 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 :: (Service -> Service)
-> DeleteBucketInventoryConfiguration
-> Request DeleteBucketInventoryConfiguration
request Service -> Service
overrides =
    forall a. Request a -> Request a
Request.s3vhost
      forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteBucketInventoryConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DeleteBucketInventoryConfiguration)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      DeleteBucketInventoryConfigurationResponse
DeleteBucketInventoryConfigurationResponse'

instance
  Prelude.Hashable
    DeleteBucketInventoryConfiguration
  where
  hashWithSalt :: Int -> DeleteBucketInventoryConfiguration -> Int
hashWithSalt
    Int
_salt
    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
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expectedBucketOwner
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BucketName
bucket
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id

instance
  Prelude.NFData
    DeleteBucketInventoryConfiguration
  where
  rnf :: DeleteBucketInventoryConfiguration -> ()
rnf 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
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expectedBucketOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BucketName
bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
id

instance
  Data.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
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"x-amz-expected-bucket-owner"
          forall a. ToHeader a => HeaderName -> a -> [Header]
Data.=# Maybe Text
expectedBucketOwner
      ]

instance
  Data.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
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", forall a. ToByteString a => a -> ByteString
Data.toBS BucketName
bucket]

instance
  Data.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
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"id" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
id, QueryString
"inventory"]

-- | /See:/ 'newDeleteBucketInventoryConfigurationResponse' smart constructor.
data DeleteBucketInventoryConfigurationResponse = DeleteBucketInventoryConfigurationResponse'
  {
  }
  deriving (DeleteBucketInventoryConfigurationResponse
-> DeleteBucketInventoryConfigurationResponse -> Bool
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]
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
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.
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
  where
  rnf :: DeleteBucketInventoryConfigurationResponse -> ()
rnf DeleteBucketInventoryConfigurationResponse
_ = ()