# Google Cloud Identity and Access Management (IAM) v2 API - Class Policies.PoliciesClient (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.PoliciesClient)
- [1.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.3.0/Google.Cloud.Iam.V2.Policies.PoliciesClient)
- [1.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.2.0/Google.Cloud.Iam.V2.Policies.PoliciesClient)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.1.0/Google.Cloud.Iam.V2.Policies.PoliciesClient)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/1.0.0/Google.Cloud.Iam.V2.Policies.PoliciesClient)

    public class Policies.PoliciesClient : ClientBase<Policies.PoliciesClient>

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

Client for Policies

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [ClientBase](https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.html) \> [ClientBase](https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase-1.html)[Policies](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policies)[PoliciesClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policies.PoliciesClient) \> Policies.PoliciesClient

## Inherited Members

[ClientBase\<Policies.PoliciesClient\>.WithHost(string)](https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase-1.html#Grpc_Core_ClientBase_1_WithHost_System_String_) [ClientBase.CallInvoker](https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.html#Grpc_Core_ClientBase_CallInvoker) [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

## Constructors

### PoliciesClient()

    protected PoliciesClient()

Protected parameterless constructor to allow creation of test doubles.

### PoliciesClient(CallInvoker)

    public PoliciesClient(CallInvoker callInvoker)

Creates a new client for Policies that uses a custom `CallInvoker`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `callInvoker` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallInvoker.html` The callInvoker to use to make remote calls. |

### PoliciesClient(ChannelBase)

    public PoliciesClient(ChannelBase channel)

Creates a new client for Policies

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `channel` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ChannelBase.html` The channel to use to make remote calls. |

### PoliciesClient(ClientBaseConfiguration)

    protected PoliciesClient(ClientBase.ClientBaseConfiguration configuration)

Protected constructor to allow creation of configured clients.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `configuration` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.htmlhttps://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.ClientBaseConfiguration.html` The client configuration. |

## Methods

### CreateOperationsClient()

    public virtual Operations.OperationsClient CreateOperationsClient()

Creates a new instance of [Operations.OperationsClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operations.OperationsClient.html) using the same call invoker as
this client.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operations.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operations.OperationsClient.html` | A new Operations client for the same target as this client. |

### CreatePolicy(CreatePolicyRequest, CallOptions)

    public virtual Operation CreatePolicy(CreatePolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response received from the server. |

### CreatePolicy(CreatePolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual Operation CreatePolicy(CreatePolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response received from the server. |

### CreatePolicyAsync(CreatePolicyRequest, CallOptions)

    public virtual AsyncUnaryCall<Operation> CreatePolicyAsync(CreatePolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The call object. |

### CreatePolicyAsync(CreatePolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual AsyncUnaryCall<Operation> CreatePolicyAsync(CreatePolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The call object. |

### DeletePolicy(DeletePolicyRequest, CallOptions)

    public virtual Operation DeletePolicy(DeletePolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response received from the server. |

### DeletePolicy(DeletePolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual Operation DeletePolicy(DeletePolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response received from the server. |

### DeletePolicyAsync(DeletePolicyRequest, CallOptions)

    public virtual AsyncUnaryCall<Operation> DeletePolicyAsync(DeletePolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The call object. |

### DeletePolicyAsync(DeletePolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual AsyncUnaryCall<Operation> DeletePolicyAsync(DeletePolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The call object. |

### GetPolicy(GetPolicyRequest, CallOptions)

    public virtual Policy GetPolicy(GetPolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | The response received from the server. |

### GetPolicy(GetPolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual Policy GetPolicy(GetPolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | The response received from the server. |

### GetPolicyAsync(GetPolicyRequest, CallOptions)

    public virtual AsyncUnaryCall<Policy> GetPolicyAsync(GetPolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | The call object. |

### GetPolicyAsync(GetPolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual AsyncUnaryCall<Policy> GetPolicyAsync(GetPolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | The call object. |

### ListPolicies(ListPoliciesRequest, CallOptions)

    public virtual ListPoliciesResponse ListPolicies(ListPoliciesRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponse` | The response received from the server. |

### ListPolicies(ListPoliciesRequest, Metadata, DateTime?, CancellationToken)

    public virtual ListPoliciesResponse ListPolicies(ListPoliciesRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponse` | The response received from the server. |

### ListPoliciesAsync(ListPoliciesRequest, CallOptions)

    public virtual AsyncUnaryCall<ListPoliciesResponse> ListPoliciesAsync(ListPoliciesRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponse` | The call object. |

### ListPoliciesAsync(ListPoliciesRequest, Metadata, DateTime?, CancellationToken)

    public virtual AsyncUnaryCall<ListPoliciesResponse> ListPoliciesAsync(ListPoliciesRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponse` | The call object. |

### NewInstance(ClientBaseConfiguration)

    protected override Policies.PoliciesClient NewInstance(ClientBase.ClientBaseConfiguration configuration)

Creates a new instance of client from given `ClientBaseConfiguration`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `configuration` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.htmlhttps://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.ClientBase.ClientBaseConfiguration.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policieshttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policies.PoliciesClient` |   |

**Overrides** Grpc.Core.ClientBase\<Google.Cloud.Iam.V2.Policies.PoliciesClient\>.NewInstance(Grpc.Core.ClientBase.ClientBaseConfiguration)

### UpdatePolicy(UpdatePolicyRequest, CallOptions)

    public virtual Operation UpdatePolicy(UpdatePolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response received from the server. |

### UpdatePolicy(UpdatePolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual Operation UpdatePolicy(UpdatePolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The response received from the server. |

### UpdatePolicyAsync(UpdatePolicyRequest, CallOptions)

    public virtual AsyncUnaryCall<Operation> UpdatePolicyAsync(UpdatePolicyRequest request, CallOptions options)

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 to send to the server. |
| `options` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.CallOptions.html` The options for the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The call object. |

### UpdatePolicyAsync(UpdatePolicyRequest, Metadata, DateTime?, CancellationToken)

    public virtual AsyncUnaryCall<Operation> UpdatePolicyAsync(UpdatePolicyRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default)

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 to send to the server. |
| `headers` | `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.Metadata.html` The initial metadata to send with the call. This parameter is optional. |
| `deadline` | `System.DateTime` An optional deadline for the call. The call will be cancelled if deadline is hit. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` An optional token for canceling the call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.AsyncUnaryCall-1.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation.html` | The call object. |