{-# 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 : Gogol.ResourceManager.Cloudresourcemanager.Projects.SetIamPolicy -- Copyright : (c) 2015-2025 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Toni Cebrián -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Sets the IAM access control policy for the specified project, in the format @projects\/{ProjectIdOrNumber}@ e.g. projects\/123. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. The following constraints apply when using @setIamPolicy()@: + Project does not support @allUsers@ and @allAuthenticatedUsers@ as @members@ in a @Binding@ of a @Policy@. + The owner role can be granted to a @user@, @serviceAccount@, or a group that is part of an organization. For example, group\@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an -- owner, a user must be invited using the Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using @setIamPolicy()@. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using @setIamPolicy()@; they must be sent only using the Cloud Platform Console. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling @setIamPolicy()@ to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. If the project is part of an organization, you can remove all owners, potentially making the organization inaccessible. -- -- /See:/ for @cloudresourcemanager.projects.setIamPolicy@. module Gogol.ResourceManager.Cloudresourcemanager.Projects.SetIamPolicy ( -- * Resource CloudresourcemanagerProjectsSetIamPolicyResource, -- ** Constructing a Request CloudresourcemanagerProjectsSetIamPolicy (..), newCloudresourcemanagerProjectsSetIamPolicy, ) where import Gogol.Prelude qualified as Core import Gogol.ResourceManager.Types -- | A resource alias for @cloudresourcemanager.projects.setIamPolicy@ method which the -- 'CloudresourcemanagerProjectsSetIamPolicy' request conforms to. type CloudresourcemanagerProjectsSetIamPolicyResource = "v3" Core.:> Core.CaptureMode "resource" "setIamPolicy" Core.Text Core.:> Core.QueryParam "$.xgafv" Xgafv Core.:> Core.QueryParam "access_token" Core.Text Core.:> Core.QueryParam "callback" Core.Text Core.:> Core.QueryParam "uploadType" Core.Text Core.:> Core.QueryParam "upload_protocol" Core.Text Core.:> Core.QueryParam "alt" Core.AltJSON Core.:> Core.ReqBody '[Core.JSON] SetIamPolicyRequest Core.:> Core.Post '[Core.JSON] Policy -- | Sets the IAM access control policy for the specified project, in the format @projects\/{ProjectIdOrNumber}@ e.g. projects\/123. CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings. Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles. The following constraints apply when using @setIamPolicy()@: + Project does not support @allUsers@ and @allAuthenticatedUsers@ as @members@ in a @Binding@ of a @Policy@. + The owner role can be granted to a @user@, @serviceAccount@, or a group that is part of an organization. For example, group\@myownpersonaldomain.com could be added as an owner to a project in the myownpersonaldomain.com organization, but not the examplepetstore.com organization. + Service accounts can be made owners of a project directly without any restrictions. However, to be added as an -- owner, a user must be invited using the Cloud Platform console and must accept the invitation. + A user cannot be granted the owner role using @setIamPolicy()@. The user must be granted the owner role using the Cloud Platform Console and must explicitly accept the invitation. + Invitations to grant the owner role cannot be sent using @setIamPolicy()@; they must be sent only using the Cloud Platform Console. + If the project is not part of an organization, there must be at least one owner who has accepted the Terms of Service (ToS) agreement in the policy. Calling @setIamPolicy()@ to remove the last ToS-accepted owner from the policy will fail. This restriction also applies to legacy projects that no longer have owners who have accepted the ToS. Edits to IAM policies will be rejected until the lack of a ToS-accepting owner is rectified. If the project is part of an organization, you can remove all owners, potentially making the organization inaccessible. -- -- /See:/ 'newCloudresourcemanagerProjectsSetIamPolicy' smart constructor. data CloudresourcemanagerProjectsSetIamPolicy = CloudresourcemanagerProjectsSetIamPolicy { -- | V1 error format. xgafv :: (Core.Maybe Xgafv), -- | OAuth access token. accessToken :: (Core.Maybe Core.Text), -- | JSONP callback :: (Core.Maybe Core.Text), -- | Multipart request metadata. payload :: SetIamPolicyRequest, -- | REQUIRED: The resource for which the policy is being specified. See for the appropriate value for this field. resource :: Core.Text, -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\"). uploadType :: (Core.Maybe Core.Text), -- | Upload protocol for media (e.g. \"raw\", \"multipart\"). uploadProtocol :: (Core.Maybe Core.Text) } deriving (Core.Eq, Core.Show, Core.Generic) -- | Creates a value of 'CloudresourcemanagerProjectsSetIamPolicy' with the minimum fields required to make a request. newCloudresourcemanagerProjectsSetIamPolicy :: -- | Multipart request metadata. See 'payload'. SetIamPolicyRequest -> -- | REQUIRED: The resource for which the policy is being specified. See for the appropriate value for this field. See 'resource'. Core.Text -> CloudresourcemanagerProjectsSetIamPolicy newCloudresourcemanagerProjectsSetIamPolicy payload resource = CloudresourcemanagerProjectsSetIamPolicy { xgafv = Core.Nothing, accessToken = Core.Nothing, callback = Core.Nothing, payload = payload, resource = resource, uploadType = Core.Nothing, uploadProtocol = Core.Nothing } instance Core.GoogleRequest CloudresourcemanagerProjectsSetIamPolicy where type Rs CloudresourcemanagerProjectsSetIamPolicy = Policy type Scopes CloudresourcemanagerProjectsSetIamPolicy = '[CloudPlatform'FullControl] requestClient CloudresourcemanagerProjectsSetIamPolicy {..} = go resource xgafv accessToken callback uploadType uploadProtocol (Core.Just Core.AltJSON) payload resourceManagerService where go = Core.buildClient ( Core.Proxy :: Core.Proxy CloudresourcemanagerProjectsSetIamPolicyResource ) Core.mempty