# Google Cloud Identity and Access Management (IAM) v2 API - Class Policies.PoliciesBase (1.4.0)

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

- [1.4.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policies.PoliciesBase)
- [1.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.3.0/Google.Cloud.Iam.V2.Policies.PoliciesBase)
- [1.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.2.0/Google.Cloud.Iam.V2.Policies.PoliciesBase)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.1.0/Google.Cloud.Iam.V2.Policies.PoliciesBase)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.0.0/Google.Cloud.Iam.V2.Policies.PoliciesBase)

    [BindServiceMethod(typeof(Policies), "BindService")]
    public abstract class Policies.PoliciesBase

Reference documentation and code samples for the Google Cloud Identity and Access Management (IAM) v2 API class Policies.PoliciesBase.

Base class for server-side implementations of Policies

## Inheritance

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

## 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.Iam.V2](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2)

## Assembly

Google.Cloud.Iam.V2.dll

## Methods

### CreatePolicy(CreatePolicyRequest, ServerCallContext)

    public virtual Task<Operation> CreatePolicy(CreatePolicyRequest request, ServerCallContext context)

Creates a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.CreatePolicyRequest` The request received from the client. |
| `context` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServerCallContext.html` The context of the server-side call handler being invoked. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response to send back to the client (wrapped by a task). |

### DeletePolicy(DeletePolicyRequest, ServerCallContext)

    public virtual Task<Operation> DeletePolicy(DeletePolicyRequest request, ServerCallContext context)

Deletes a policy. This action is permanent.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.DeletePolicyRequest` The request received from the client. |
| `context` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServerCallContext.html` The context of the server-side call handler being invoked. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response to send back to the client (wrapped by a task). |

### GetPolicy(GetPolicyRequest, ServerCallContext)

    public virtual Task<Policy> GetPolicy(GetPolicyRequest request, ServerCallContext context)

Gets a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.GetPolicyRequest` The request received from the client. |
| `context` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServerCallContext.html` The context of the server-side call handler being invoked. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | The response to send back to the client (wrapped by a task). |

### ListPolicies(ListPoliciesRequest, ServerCallContext)

    public virtual Task<ListPoliciesResponse> ListPolicies(ListPoliciesRequest request, ServerCallContext context)

Retrieves the policies of the specified kind that are attached to a
resource.

The response lists only policy metadata. In particular, policy rules are
omitted.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesRequest` The request received from the client. |
| `context` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServerCallContext.html` The context of the server-side call handler being invoked. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponse` | The response to send back to the client (wrapped by a task). |

### UpdatePolicy(UpdatePolicyRequest, ServerCallContext)

    public virtual Task<Operation> UpdatePolicy(UpdatePolicyRequest request, ServerCallContext context)

Updates the specified policy.

You can update only the rules and the display name for the policy.

To update a policy, you should use a read-modify-write loop:

1. Use \[GetPolicy\]\[google.iam.v2.Policies.GetPolicy\] to read the current version of the policy.
2. Modify the policy as needed.
3. Use `UpdatePolicy` to write the updated policy.

This pattern helps prevent conflicts between concurrent updates.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.UpdatePolicyRequest` The request received from the client. |
| `context` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ServerCallContext.html` The context of the server-side call handler being invoked. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task-1https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response to send back to the client (wrapped by a task). |