packages feed

unkai-storage-0.1.0.1: gen/Unkai/Storage/Folders/DeleteRecursive.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.Folders.DeleteRecursive
-- 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 a folder recursively. Only applicable to buckets with hierarchical namespace enabled.
--
-- /See:/ <https://developers.google.com/storage/docs/json_api/ Cloud Storage JSON API Reference> for @storage.folders.deleteRecursive@.
module Unkai.Storage.Folders.DeleteRecursive
  ( -- * Resource
    StorageFoldersDeleteRecursiveResource,

    -- ** Constructing a Request
    StorageFoldersDeleteRecursive (..),
    newStorageFoldersDeleteRecursive,
  )
where

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

-- | A resource alias for @storage.folders.deleteRecursive@ method which the
-- 'StorageFoldersDeleteRecursive' request conforms to.
type StorageFoldersDeleteRecursiveResource =
  "storage"
    Core.:> "v1"
    Core.:> "b"
    Core.:> Core.Capture "bucket" Core.Text
    Core.:> "folders"
    Core.:> Core.Capture "folder" Core.Text
    Core.:> "deleteRecursive"
    Core.:> Core.QueryParam "ifMetagenerationMatch" Core.Int64
    Core.:> Core.QueryParam "ifMetagenerationNotMatch" Core.Int64
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.Post '[Core.JSON] GoogleLongrunningOperation

-- | Deletes a folder recursively. Only applicable to buckets with hierarchical namespace enabled.
--
-- /See:/ 'newStorageFoldersDeleteRecursive' smart constructor.
data StorageFoldersDeleteRecursive = StorageFoldersDeleteRecursive
  { -- | Name of the bucket in which the folder resides.
    bucket :: Core.Text,
    -- | Name of a folder.
    folder :: Core.Text,
    -- | If set, only deletes the folder if its metageneration matches this value.
    ifMetagenerationMatch :: (Core.Maybe Core.Int64),
    -- | If set, only deletes the folder if its metageneration does not match this value.
    ifMetagenerationNotMatch :: (Core.Maybe Core.Int64)
  }
  deriving stock (Core.Eq, Core.Show, Core.Generic)

-- | Creates a value of 'StorageFoldersDeleteRecursive' with the minimum fields required to make a request.
newStorageFoldersDeleteRecursive ::
  -- |  Name of the bucket in which the folder resides. See 'bucket'.
  Core.Text ->
  -- |  Name of a folder. See 'folder'.
  Core.Text ->
  StorageFoldersDeleteRecursive
newStorageFoldersDeleteRecursive bucket folder =
  StorageFoldersDeleteRecursive
    { bucket = bucket,
      folder = folder,
      ifMetagenerationMatch = Core.Nothing,
      ifMetagenerationNotMatch = Core.Nothing
    }

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