Show / Hide Table of Contents

Class ProjectsResource.SetIamPolicyRequest

Sets the IAM access control policy for the specified Project. 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. For additional information about resource (e.g. my-project-id) structure and identification, see Resource Names. 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 via 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. + You can only grant ownership of a project to a member by using the GCP Console. Inviting a member will deliver an invitation email that they must accept. An invitation email is not generated if you are granting a role other than owner, or if both the member you are inviting and the project are part of your organization. + Membership changes that leave the project without any owners that have accepted the Terms of Service (ToS) will be rejected. + 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. Authorization requires the Google IAM permission resourcemanager.projects.setIamPolicy on the project

Inheritance
System.Object
ClientServiceRequest
ClientServiceRequest<Policy>
CloudResourceManagerBaseServiceRequest<Policy>
ProjectsResource.SetIamPolicyRequest
Implements
IClientServiceRequest<Policy>
IClientServiceRequest
Inherited Members
CloudResourceManagerBaseServiceRequest<Policy>.Xgafv
CloudResourceManagerBaseServiceRequest<Policy>.AccessToken
CloudResourceManagerBaseServiceRequest<Policy>.Alt
CloudResourceManagerBaseServiceRequest<Policy>.Callback
CloudResourceManagerBaseServiceRequest<Policy>.Fields
CloudResourceManagerBaseServiceRequest<Policy>.Key
CloudResourceManagerBaseServiceRequest<Policy>.OauthToken
CloudResourceManagerBaseServiceRequest<Policy>.PrettyPrint
CloudResourceManagerBaseServiceRequest<Policy>.QuotaUser
CloudResourceManagerBaseServiceRequest<Policy>.UploadType
CloudResourceManagerBaseServiceRequest<Policy>.UploadProtocol
ClientServiceRequest<Policy>.Execute()
ClientServiceRequest<Policy>.ExecuteAsStream()
ClientServiceRequest<Policy>.ExecuteAsync()
ClientServiceRequest<Policy>.ExecuteAsync(CancellationToken)
ClientServiceRequest<Policy>.ExecuteAsStreamAsync()
ClientServiceRequest<Policy>.ExecuteAsStreamAsync(CancellationToken)
ClientServiceRequest<Policy>.CreateRequest(Nullable<Boolean>)
ClientServiceRequest<Policy>.GenerateRequestUri()
ClientServiceRequest<Policy>.GetDefaultETagAction(String)
ClientServiceRequest<Policy>.ETagAction
ClientServiceRequest<Policy>.ModifyRequest
ClientServiceRequest<Policy>.ValidateParameters
ClientServiceRequest<Policy>.RequestParameters
ClientServiceRequest<Policy>.Service
ClientServiceRequest._unsuccessfulResponseHandlers
ClientServiceRequest._exceptionHandlers
ClientServiceRequest._executeInterceptors
ClientServiceRequest.AddUnsuccessfulResponseHandler(IHttpUnsuccessfulResponseHandler)
ClientServiceRequest.AddExceptionHandler(IHttpExceptionHandler)
ClientServiceRequest.AddExecuteInterceptor(IHttpExecuteInterceptor)
ClientServiceRequest.Credential
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Google.Apis.CloudResourceManager.v1
Assembly: Google.Apis.CloudResourceManager.v1.dll
Syntax
public class SetIamPolicyRequest : CloudResourceManagerBaseServiceRequest<Policy>, IClientServiceRequest<Policy>, IClientServiceRequest

Constructors

SetIamPolicyRequest(IClientService, SetIamPolicyRequest, String)

Constructs a new SetIamPolicy request.

Declaration
public SetIamPolicyRequest(IClientService service, SetIamPolicyRequest body, string resource)
Parameters
Type Name Description
IClientService service
SetIamPolicyRequest body
System.String resource

Properties

HttpMethod

Gets the HTTP method.

Declaration
public override string HttpMethod { get; }
Property Value
Type Description
System.String
Overrides
Google.Apis.Requests.ClientServiceRequest<Google.Apis.CloudResourceManager.v1.Data.Policy>.HttpMethod

MethodName

Gets the method name.

Declaration
public override string MethodName { get; }
Property Value
Type Description
System.String
Overrides
Google.Apis.Requests.ClientServiceRequest<Google.Apis.CloudResourceManager.v1.Data.Policy>.MethodName

Resource

REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.

Declaration
[RequestParameter("resource", RequestParameterType.Path)]
public virtual string Resource { get; }
Property Value
Type Description
System.String

RestPath

Gets the REST path.

Declaration
public override string RestPath { get; }
Property Value
Type Description
System.String
Overrides
Google.Apis.Requests.ClientServiceRequest<Google.Apis.CloudResourceManager.v1.Data.Policy>.RestPath

Methods

GetBody()

Returns the body of the request.

Declaration
protected override object GetBody()
Returns
Type Description
System.Object
Overrides
Google.Apis.Requests.ClientServiceRequest<Google.Apis.CloudResourceManager.v1.Data.Policy>.GetBody()

InitParameters()

Initializes SetIamPolicy parameter list.

Declaration
protected override void InitParameters()
Overrides
Google.Apis.CloudResourceManager.v1.CloudResourceManagerBaseServiceRequest<Google.Apis.CloudResourceManager.v1.Data.Policy>.InitParameters()

Implements

IClientServiceRequest<TResponse>
IClientServiceRequest
In This Article
Back to top