packages feed

unkai-storage-0.1.0.1: gen/Unkai/Storage/ManagedFolders/SetIamPolicy.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.ManagedFolders.SetIamPolicy
-- 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)
--
-- Updates an IAM policy for the specified managed folder.
--
-- /See:/ <https://developers.google.com/storage/docs/json_api/ Cloud Storage JSON API Reference> for @storage.managedFolders.setIamPolicy@.
module Unkai.Storage.ManagedFolders.SetIamPolicy
  ( -- * Resource
    StorageManagedFoldersSetIamPolicyResource,

    -- ** Constructing a Request
    StorageManagedFoldersSetIamPolicy (..),
    newStorageManagedFoldersSetIamPolicy,
  )
where

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

-- | A resource alias for @storage.managedFolders.setIamPolicy@ method which the
-- 'StorageManagedFoldersSetIamPolicy' request conforms to.
type StorageManagedFoldersSetIamPolicyResource =
  "storage"
    Core.:> "v1"
    Core.:> "b"
    Core.:> Core.Capture "bucket" Core.Text
    Core.:> "managedFolders"
    Core.:> Core.Capture "managedFolder" Core.Text
    Core.:> "iam"
    Core.:> Core.QueryParam "userProject" Core.Text
    Core.:> Core.QueryParam "alt" Core.AltJSON
    Core.:> Core.ReqBody '[Core.JSON] PolicySetIamPolicyInput
    Core.:> Core.Put '[Core.JSON] Policy

-- | Updates an IAM policy for the specified managed folder.
--
-- /See:/ 'newStorageManagedFoldersSetIamPolicy' smart constructor.
data StorageManagedFoldersSetIamPolicy = StorageManagedFoldersSetIamPolicy
  { -- | Name of the bucket containing the managed folder.
    bucket :: Core.Text,
    -- | The managed folder name\/path.
    managedFolder :: Core.Text,
    -- | Request body.
    payload :: PolicySetIamPolicyInput,
    -- | 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 'StorageManagedFoldersSetIamPolicy' with the minimum fields required to make a request.
newStorageManagedFoldersSetIamPolicy ::
  -- |  Name of the bucket containing the managed folder. See 'bucket'.
  Core.Text ->
  -- |  The managed folder name\/path. See 'managedFolder'.
  Core.Text ->
  -- |  Request body. See 'payload'.
  PolicySetIamPolicyInput ->
  StorageManagedFoldersSetIamPolicy
newStorageManagedFoldersSetIamPolicy bucket managedFolder payload =
  StorageManagedFoldersSetIamPolicy
    { bucket = bucket,
      managedFolder = managedFolder,
      payload = payload,
      userProject = Core.Nothing
    }

instance Core.GoogleRequest StorageManagedFoldersSetIamPolicy where
  type Rs StorageManagedFoldersSetIamPolicy = Policy
  type
    Scopes StorageManagedFoldersSetIamPolicy =
      '[CloudPlatform'FullControl, Devstorage'FullControl]
  requestClient StorageManagedFoldersSetIamPolicy {..} =
    go
      bucket
      managedFolder
      userProject
      (Core.Just Core.AltJSON)
      payload
      storageService
    where
      go =
        Core.buildClient
          ( Core.Proxy ::
              Core.Proxy StorageManagedFoldersSetIamPolicyResource
          )
          Core.mempty