# Organization Policy v2 API - Class OrgPolicy (2.9.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [2.9.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/latest/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.8.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.8.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.7.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.7.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.6.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.6.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.5.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.5.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.4.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.3.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.2.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.1.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [2.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/2.0.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [1.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/1.2.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/1.1.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/1.0.0/Google.Cloud.OrgPolicy.V2.OrgPolicy)

    public static class OrgPolicy

Reference documentation and code samples for the Organization Policy v2 API class OrgPolicy.

An interface for managing organization policies.

The Organization Policy Service provides a simple mechanism for
organizations to restrict the allowed configurations across their entire
resource hierarchy.

You can use a policy to configure restrictions on resources. For
example, you can enforce a policy that restricts which Google
Cloud APIs can be activated in a certain part of your resource
hierarchy, or prevents serial port access to VM instances in a
particular folder.

Policies are inherited down through the resource hierarchy. A policy
applied to a parent resource automatically applies to all its child resources
unless overridden with a policy lower in the hierarchy.

A constraint defines an aspect of a resource's configuration that can be
controlled by an organization's policy administrator. Policies are a
collection of constraints that defines their allowable configuration on a
particular resource and its child resources.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> OrgPolicy

## Inherited Members

[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

[Google.Cloud.OrgPolicy.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/latest/Google.Cloud.OrgPolicy.V2)

## Assembly

Google.Cloud.OrgPolicy.V2.dll

## Methods

### BindService(OrgPolicyBase)

    public static ServerServiceDefinition BindService(OrgPolicy.OrgPolicyBase serviceImpl)

Creates service definition that can be registered with a server

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `serviceImpl` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/latest/Google.Cloud.OrgPolicy.V2.OrgPolicyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/latest/Google.Cloud.OrgPolicy.V2.OrgPolicy.OrgPolicyBase` An object implementing the server-side handling logic. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServerServiceDefinition.html` |   |

### BindService(ServiceBinderBase, OrgPolicyBase)

    public static void BindService(ServiceBinderBase serviceBinder, OrgPolicy.OrgPolicyBase serviceImpl)

Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
Note: this method is part of an experimental API that can change or be removed without any prior notice.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `serviceBinder` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServiceBinderBase.html` Service methods will be bound by calling `AddMethod` on this object. |
| `serviceImpl` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/latest/Google.Cloud.OrgPolicy.V2.OrgPolicyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.OrgPolicy.V2/latest/Google.Cloud.OrgPolicy.V2.OrgPolicy.OrgPolicyBase` An object implementing the server-side handling logic. |