public sealed class SetIamPolicyRequest : IMessage<SetIamPolicyRequest>, IEquatable<SetIamPolicyRequest>, IDeepCloneable<SetIamPolicyRequest>, IBufferMessage, IMessage
Reference documentation and code samples for the Google Cloud Identity and Access Management (IAM) v1 API class SetIamPolicyRequest.
REQUIRED: The complete policy to be applied to the resource. The size of
the policy is limited to a few 10s of KB. An empty policy is a
valid policy but certain Cloud Platform services (such as Projects)
might reject them.
OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only
the fields in the mask will be modified. If no mask is provided, the
following default mask is used:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eSetIamPolicyRequest\u003c/code\u003e class is used to set the IAM policy for a given resource within the Google Cloud Identity and Access Management (IAM) v1 API.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements several interfaces including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, for varied functionality.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSetIamPolicyRequest\u003c/code\u003e class requires properties like \u003ccode\u003eResource\u003c/code\u003e and \u003ccode\u003ePolicy\u003c/code\u003e to be set, which dictate the resource the policy will be applied to, and the policy itself.\u003c/p\u003e\n"],["\u003cp\u003eThere is an optional \u003ccode\u003eUpdateMask\u003c/code\u003e property, which lets you specify specific parts of the policy that should be modified, and if not set it defaults to only modifying the bindings and etag fields.\u003c/p\u003e\n"],["\u003cp\u003eThe latest version of the \u003ccode\u003eSetIamPolicyRequest\u003c/code\u003e class available is 3.4.0, with previous versions ranging back to 2.2.0.\u003c/p\u003e\n"]]],[],null,["# Google Cloud Identity and Access Management (IAM) v1 API - Class SetIamPolicyRequest (3.4.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.4.0 (latest)](/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.SetIamPolicyRequest)\n- [3.3.0](/dotnet/docs/reference/Google.Cloud.Iam.V1/3.3.0/Google.Cloud.Iam.V1.SetIamPolicyRequest)\n- [3.2.0](/dotnet/docs/reference/Google.Cloud.Iam.V1/3.2.0/Google.Cloud.Iam.V1.SetIamPolicyRequest)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.Iam.V1/3.1.0/Google.Cloud.Iam.V1.SetIamPolicyRequest)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.Iam.V1/3.0.0/Google.Cloud.Iam.V1.SetIamPolicyRequest)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.Iam.V1/2.4.0/Google.Cloud.Iam.V1.SetIamPolicyRequest)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.Iam.V1/2.3.0/Google.Cloud.Iam.V1.SetIamPolicyRequest)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.Iam.V1/2.2.0/Google.Cloud.Iam.V1.SetIamPolicyRequest) \n\n public sealed class SetIamPolicyRequest : IMessage\u003cSetIamPolicyRequest\u003e, IEquatable\u003cSetIamPolicyRequest\u003e, IDeepCloneable\u003cSetIamPolicyRequest\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google Cloud Identity and Access Management (IAM) v1 API class SetIamPolicyRequest.\n\nRequest message for `SetIamPolicy` method. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e SetIamPolicyRequest \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[SetIamPolicyRequest](/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.SetIamPolicyRequest), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[SetIamPolicyRequest](/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.SetIamPolicyRequest), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[SetIamPolicyRequest](/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.SetIamPolicyRequest), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.Iam.V1](/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.Iam.V1.dll\n\nConstructors\n------------\n\n### SetIamPolicyRequest()\n\n public SetIamPolicyRequest()\n\n### SetIamPolicyRequest(SetIamPolicyRequest)\n\n public SetIamPolicyRequest(SetIamPolicyRequest other)\n\nProperties\n----------\n\n### Policy\n\n public Policy Policy { get; set; }\n\nREQUIRED: The complete policy to be applied to the `resource`. The size of\nthe policy is limited to a few 10s of KB. An empty policy is a\nvalid policy but certain Cloud Platform services (such as Projects)\nmight reject them.\n\n### Resource\n\n public string Resource { get; set; }\n\nREQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.\n\n### ResourceAsResourceName\n\n public IResourceName ResourceAsResourceName { get; set; }\n\n[IResourceName](https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.IResourceName.html)-typed view over the [Resource](/dotnet/docs/reference/Google.Cloud.Iam.V1/latest/Google.Cloud.Iam.V1.SetIamPolicyRequest#Google_Cloud_Iam_V1_SetIamPolicyRequest_Resource) resource name property.\n\n### UpdateMask\n\n public FieldMask UpdateMask { get; set; }\n\nOPTIONAL: A FieldMask specifying which fields of the policy to modify. Only\nthe fields in the mask will be modified. If no mask is provided, the\nfollowing default mask is used:\n\n`paths: \"bindings, etag\"`"]]