packages feed

unkai-storage-0.1.0.1: gen/Unkai/Storage/Buckets/Delete.hs

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- |
-- Module      : Unkai.Storage.Buckets.Delete
-- Copyright   : (c) 2015-2025 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Nadeem Bitar <nadeem@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes an empty bucket. Deletions are permanent unless soft delete is enabled on the bucket.
--
-- /See:/ <https://developers.google.com/storage/docs/json_api/ Cloud Storage JSON API Reference> for @storage.buckets.delete@.
module Unkai.Storage.Buckets.Delete
  ( -- * Resource
    StorageBucketsDeleteResource,

    -- ** Constructing a Request
    StorageBucketsDelete (..),
    newStorageBucketsDelete,
  )
where

import Unkai.Prelude qualified as Core
import Unkai.Storage.Types

-- | A resource alias for @storage.buckets.delete@ method which the
-- 'StorageBucketsDelete' request conforms to.
type StorageBucketsDeleteResource =
  "storage"
    Core.:> "v1"
    Core.:> "b"
    Core.:> Core.Capture "bucket" Core.Text
    Core.:> Core.QueryParam "ifMetagenerationMatch" Core.Int64
    Core.:> Core.QueryParam "ifMetagenerationNotMatch" Core.Int64
    Core.:> Core.QueryParam "userProject" Core.Text
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.Delete '[Core.JSON] ()

-- | Deletes an empty bucket. Deletions are permanent unless soft delete is enabled on the bucket.
--
-- /See:/ 'newStorageBucketsDelete' smart constructor.
data StorageBucketsDelete = StorageBucketsDelete
  { -- | Name of a bucket.
    bucket :: Core.Text,
    -- | If set, only deletes the bucket if its metageneration matches this value.
    ifMetagenerationMatch :: (Core.Maybe Core.Int64),
    -- | If set, only deletes the bucket if its metageneration does not match this value.
    ifMetagenerationNotMatch :: (Core.Maybe Core.Int64),
    -- | The project to be billed for this request. Required for Requester Pays buckets.
    userProject :: (Core.Maybe Core.Text)
  }
  deriving stock (Core.Eq, Core.Show, Core.Generic)

-- | Creates a value of 'StorageBucketsDelete' with the minimum fields required to make a request.
newStorageBucketsDelete ::
  -- |  Name of a bucket. See 'bucket'.
  Core.Text ->
  StorageBucketsDelete
newStorageBucketsDelete bucket =
  StorageBucketsDelete
    { bucket = bucket,
      ifMetagenerationMatch = Core.Nothing,
      ifMetagenerationNotMatch = Core.Nothing,
      userProject = Core.Nothing
    }

instance Core.GoogleRequest StorageBucketsDelete where
  type Rs StorageBucketsDelete = ()
  type
    Scopes StorageBucketsDelete =
      '[ CloudPlatform'FullControl,
         Devstorage'FullControl,
         Devstorage'ReadWrite
       ]
  requestClient StorageBucketsDelete {..} =
    go
      bucket
      ifMetagenerationMatch
      ifMetagenerationNotMatch
      userProject
      (Core.Just Core.AltJSON)
      storageService
    where
      go =
        Core.buildClient
          (Core.Proxy :: Core.Proxy StorageBucketsDeleteResource)
          Core.mempty