public sealed class Policy.Types.BooleanPolicy : IMessage<Policy.Types.BooleanPolicy>, IEquatable<Policy.Types.BooleanPolicy>, IDeepCloneable<Policy.Types.BooleanPolicy>, IBufferMessage, IMessage
Reference documentation and code samples for the Google.Cloud.OrgPolicy.V1 class Policy.Types.BooleanPolicy.
Used in policy_type to specify how boolean_policy will behave at this
resource.
If true, then the Policy is enforced. If false, then any
configuration is acceptable.
Suppose you have a Constraintconstraints/compute.disableSerialPortAccess with constraint_default
set to ALLOW. A Policy for that Constraint exhibits the following
behavior:
If the Policy at this resource has enforced set to false, serial
port connection attempts will be allowed.
If the Policy at this resource has enforced set to true, serial
port connection attempts will be refused.
If the Policy at this resource is RestoreDefault, serial port
connection attempts will be allowed.
If no Policy is set at this resource or anywhere higher in the
resource hierarchy, serial port connection attempts will be allowed.
If no Policy is set at this resource, but one exists higher in the
resource hierarchy, the behavior is as if thePolicy were set at
this resource.
The following examples demonstrate the different possible layerings:
Example 1 (nearest Constraint wins):
organizations/foo has a Policy with:
{enforced: false}
projects/bar has no Policy set.
The constraint at projects/bar and organizations/foo will not be
enforced.
Example 2 (enforcement gets replaced):
organizations/foo has a Policy with:
{enforced: false}
projects/bar has a Policy with:
{enforced: true}
The constraint at organizations/foo is not enforced.
The constraint at projects/bar is enforced.
Example 3 (RestoreDefault):
organizations/foo has a Policy with:
{enforced: true}
projects/bar has a Policy with:
{RestoreDefault: {}}
The constraint at organizations/foo is enforced.
The constraint at projects/bar is not enforced, because
constraint_default for the Constraint is ALLOW.
[[["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 latest version of the \u003ccode\u003ePolicy.Types.BooleanPolicy\u003c/code\u003e class is 3.2.0, with previous versions including 3.1.0, 3.0.0, and 2.2.0 also being documented.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003ePolicy.Types.BooleanPolicy\u003c/code\u003e is a class within the Google.Cloud.OrgPolicy.V1 namespace, designed to manage boolean policy settings.\u003c/p\u003e\n"],["\u003cp\u003eThis class implements multiple interfaces including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, allowing it to be used in various contexts.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBooleanPolicy\u003c/code\u003e class has a property called \u003ccode\u003eEnforced\u003c/code\u003e which is of type \u003ccode\u003ebool\u003c/code\u003e that dictates whether the policy is enforced or not, influencing the behavior of associated constraints.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBooleanPolicy\u003c/code\u003e class has two constructors, a default one, and another one that takes a \u003ccode\u003ePolicy.Types.BooleanPolicy\u003c/code\u003e as a parameter.\u003c/p\u003e\n"]]],[],null,["# Google.Cloud.OrgPolicy.V1 - Class Policy.Types.BooleanPolicy (3.2.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.2.0 (latest)](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy.Types.BooleanPolicy)\n- [3.1.0](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/3.1.0/Google.Cloud.OrgPolicy.V1.Policy.Types.BooleanPolicy)\n- [3.0.0](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/3.0.0/Google.Cloud.OrgPolicy.V1.Policy.Types.BooleanPolicy)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/2.2.0/Google.Cloud.OrgPolicy.V1.Policy.Types.BooleanPolicy) \n\n public sealed class Policy.Types.BooleanPolicy : IMessage\u003cPolicy.Types.BooleanPolicy\u003e, IEquatable\u003cPolicy.Types.BooleanPolicy\u003e, IDeepCloneable\u003cPolicy.Types.BooleanPolicy\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Google.Cloud.OrgPolicy.V1 class Policy.Types.BooleanPolicy.\n\nUsed in `policy_type` to specify how `boolean_policy` will behave at this\nresource. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e Policy.Types.BooleanPolicy \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[Policy](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy)[Types](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy.Types)[BooleanPolicy](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy.Types.BooleanPolicy), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[Policy](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy)[Types](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy.Types)[BooleanPolicy](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy.Types.BooleanPolicy), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[Policy](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy)[Types](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy.Types)[BooleanPolicy](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1.Policy.Types.BooleanPolicy), [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.OrgPolicy.V1](/dotnet/docs/reference/Google.Cloud.OrgPolicy.V1/latest/Google.Cloud.OrgPolicy.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.OrgPolicy.V1.dll\n\nConstructors\n------------\n\n### BooleanPolicy()\n\n public BooleanPolicy()\n\n### BooleanPolicy(BooleanPolicy)\n\n public BooleanPolicy(Policy.Types.BooleanPolicy other)\n\nProperties\n----------\n\n### Enforced\n\n public bool Enforced { get; set; }\n\nIf `true`, then the `Policy` is enforced. If `false`, then any\nconfiguration is acceptable.\n\nSuppose you have a `Constraint`\n`constraints/compute.disableSerialPortAccess` with `constraint_default`\nset to `ALLOW`. A `Policy` for that `Constraint` exhibits the following\nbehavior:\n\n- If the `Policy` at this resource has enforced set to `false`, serial port connection attempts will be allowed.\n- If the `Policy` at this resource has enforced set to `true`, serial port connection attempts will be refused.\n- If the `Policy` at this resource is `RestoreDefault`, serial port connection attempts will be allowed.\n- If no `Policy` is set at this resource or anywhere higher in the resource hierarchy, serial port connection attempts will be allowed.\n- If no `Policy` is set at this resource, but one exists higher in the resource hierarchy, the behavior is as if the`Policy` were set at this resource.\n\nThe following examples demonstrate the different possible layerings:\n\nExample 1 (nearest `Constraint` wins):\n`organizations/foo` has a `Policy` with:\n{enforced: false}\n`projects/bar` has no `Policy` set.\nThe constraint at `projects/bar` and `organizations/foo` will not be\nenforced.\n\nExample 2 (enforcement gets replaced):\n`organizations/foo` has a `Policy` with:\n{enforced: false}\n`projects/bar` has a `Policy` with:\n{enforced: true}\nThe constraint at `organizations/foo` is not enforced.\nThe constraint at `projects/bar` is enforced.\n\nExample 3 (RestoreDefault):\n`organizations/foo` has a `Policy` with:\n{enforced: true}\n`projects/bar` has a `Policy` with:\n{RestoreDefault: {}}\nThe constraint at `organizations/foo` is enforced.\nThe constraint at `projects/bar` is not enforced, because\n`constraint_default` for the `Constraint` is `ALLOW`."]]