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

    public abstract class PoliciesClient

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

Policies client wrapper, for convenient use.

## Inheritance

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

## 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)

## Derived Types

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

## 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

## Remarks

An interface for managing Identity and Access Management (IAM) policies.

## Properties

### CreatePolicyOperationsClient

    public virtual OperationsClient CreatePolicyOperationsClient { get; }

The long-running operations client for `CreatePolicy`.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.OperationsClient.html` |   |

### DefaultEndpoint

    public static string DefaultEndpoint { get; }

The default endpoint for the Policies service, which is a host of "iam.googleapis.com" and a port of 443.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.string` |   |

### DefaultScopes

    public static IReadOnlyList<string> DefaultScopes { get; }

The default Policies scopes.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.collections.generic.ireadonlylist-1https://learn.microsoft.com/dotnet/api/system.string` |   |

**Remarks** The default Policies scopes are:

- <https://www.googleapis.com/auth/cloud-platform>

<br />

### DeletePolicyOperationsClient

    public virtual OperationsClient DeletePolicyOperationsClient { get; }

The long-running operations client for `DeletePolicy`.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.OperationsClient.html` |   |

### GrpcClient

    public virtual Policies.PoliciesClient GrpcClient { get; }

The underlying gRPC Policies client

| **Property Value** ||
|---|---|
| **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` |   |

### ServiceMetadata

    public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.ServiceMetadata.html` |   |

### UpdatePolicyOperationsClient

    public virtual OperationsClient UpdatePolicyOperationsClient { get; }

The long-running operations client for `UpdatePolicy`.

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.OperationsClient.html` |   |

## Methods

### Create()

    public static PoliciesClient Create()

Synchronously creates a [PoliciesClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient) using the default credentials, endpoint and settings.
To specify custom credentials or other settings, use [PoliciesClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClientBuilder).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient` | The created [PoliciesClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient). |

### CreateAsync(CancellationToken)

    public static Task<PoliciesClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a [PoliciesClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient) using the default credentials, endpoint and settings.
To specify custom credentials or other settings, use [PoliciesClientBuilder](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClientBuilder).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` The [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use while creating the client. |

| **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.PoliciesClient` | The task representing the created [PoliciesClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient). |

### CreatePolicy(CreatePolicyRequest, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> CreatePolicy(CreatePolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    CreatePolicyRequest request = new CreatePolicyRequest
    {
        Parent = "",
        Policy = new Policy(),
        PolicyId = "",
    };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = policiesClient.CreatePolicy(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = response.PollUntilCompleted();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = policiesClient.PollOnceCreatePolicy(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### CreatePolicy(string, Policy, string, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> CreatePolicy(string parent, Policy policy, string policyId, CallSettings callSettings = null)

Creates a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource that the policy is attached to, along with the kind of policy to create. Format: `policies/{attachment_point}/denypolicies` The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `policy` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` Required. The policy to create. |
| `policyId` | `https://learn.microsoft.com/dotnet/api/system.string` The ID to use for this policy, which will become the final component of the policy's resource name. The ID must contain 3 to 63 characters. It can contain lowercase letters and numbers, as well as dashes (`-`) and periods (`.`). The first character must be a lowercase letter. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    string parent = "";
    Policy policy = new Policy();
    string policyId = "";
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = policiesClient.CreatePolicy(parent, policy, policyId);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = response.PollUntilCompleted();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = policiesClient.PollOnceCreatePolicy(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### CreatePolicyAsync(CreatePolicyRequest, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> CreatePolicyAsync(CreatePolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    CreatePolicyRequest request = new CreatePolicyRequest
    {
        Parent = "",
        Policy = new Policy(),
        PolicyId = "",
    };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.CreatePolicyAsync(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceCreatePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### CreatePolicyAsync(CreatePolicyRequest, CancellationToken)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> CreatePolicyAsync(CreatePolicyRequest request, CancellationToken cancellationToken)

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 object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    CreatePolicyRequest request = new CreatePolicyRequest
    {
        Parent = "",
        Policy = new Policy(),
        PolicyId = "",
    };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.CreatePolicyAsync(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceCreatePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### CreatePolicyAsync(string, Policy, string, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> CreatePolicyAsync(string parent, Policy policy, string policyId, CallSettings callSettings = null)

Creates a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource that the policy is attached to, along with the kind of policy to create. Format: `policies/{attachment_point}/denypolicies` The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `policy` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` Required. The policy to create. |
| `policyId` | `https://learn.microsoft.com/dotnet/api/system.string` The ID to use for this policy, which will become the final component of the policy's resource name. The ID must contain 3 to 63 characters. It can contain lowercase letters and numbers, as well as dashes (`-`) and periods (`.`). The first character must be a lowercase letter. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    string parent = "";
    Policy policy = new Policy();
    string policyId = "";
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.CreatePolicyAsync(parent, policy, policyId);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceCreatePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### CreatePolicyAsync(string, Policy, string, CancellationToken)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> CreatePolicyAsync(string parent, Policy policy, string policyId, CancellationToken cancellationToken)

Creates a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `parent` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource that the policy is attached to, along with the kind of policy to create. Format: `policies/{attachment_point}/denypolicies` The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `policy` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` Required. The policy to create. |
| `policyId` | `https://learn.microsoft.com/dotnet/api/system.string` The ID to use for this policy, which will become the final component of the policy's resource name. The ID must contain 3 to 63 characters. It can contain lowercase letters and numbers, as well as dashes (`-`) and periods (`.`). The first character must be a lowercase letter. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    string parent = "";
    Policy policy = new Policy();
    string policyId = "";
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.CreatePolicyAsync(parent, policy, policyId);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceCreatePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### DeletePolicy(DeletePolicyRequest, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> DeletePolicy(DeletePolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    DeletePolicyRequest request = new DeletePolicyRequest { Name = "", Etag = "", };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = policiesClient.DeletePolicy(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = response.PollUntilCompleted();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = policiesClient.PollOnceDeletePolicy(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### DeletePolicy(string, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> DeletePolicy(string name, CallSettings callSettings = null)

Deletes a policy. This action is permanent.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the policy to delete. Format: `policies/{attachment_point}/denypolicies/{policy_id}` Use the URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    string name = "";
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = policiesClient.DeletePolicy(name);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = response.PollUntilCompleted();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = policiesClient.PollOnceDeletePolicy(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### DeletePolicyAsync(DeletePolicyRequest, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> DeletePolicyAsync(DeletePolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    DeletePolicyRequest request = new DeletePolicyRequest { Name = "", Etag = "", };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.DeletePolicyAsync(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceDeletePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### DeletePolicyAsync(DeletePolicyRequest, CancellationToken)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> DeletePolicyAsync(DeletePolicyRequest request, CancellationToken cancellationToken)

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 object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    DeletePolicyRequest request = new DeletePolicyRequest { Name = "", Etag = "", };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.DeletePolicyAsync(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceDeletePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### DeletePolicyAsync(string, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> DeletePolicyAsync(string name, CallSettings callSettings = null)

Deletes a policy. This action is permanent.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the policy to delete. Format: `policies/{attachment_point}/denypolicies/{policy_id}` Use the URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    string name = "";
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.DeletePolicyAsync(name);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceDeletePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### DeletePolicyAsync(string, CancellationToken)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> DeletePolicyAsync(string name, CancellationToken cancellationToken)

Deletes a policy. This action is permanent.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the policy to delete. Format: `policies/{attachment_point}/denypolicies/{policy_id}` Use the URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    string name = "";
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.DeletePolicyAsync(name);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceDeletePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### GetPolicy(GetPolicyRequest, CallSettings)

    public virtual Policy GetPolicy(GetPolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

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

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    GetPolicyRequest request = new GetPolicyRequest { Name = "", };
    // Make the request
    Policy response = policiesClient.GetPolicy(request);

### GetPolicy(string, CallSettings)

    public virtual Policy GetPolicy(string name, CallSettings callSettings = null)

Gets a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the policy to retrieve. Format: `policies/{attachment_point}/denypolicies/{policy_id}` Use the URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

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

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    string name = "";
    // Make the request
    Policy response = policiesClient.GetPolicy(name);

### GetPolicyAsync(GetPolicyRequest, CallSettings)

    public virtual Task<Policy> GetPolicyAsync(GetPolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    GetPolicyRequest request = new GetPolicyRequest { Name = "", };
    // Make the request
    Policy response = await policiesClient.GetPolicyAsync(request);

### GetPolicyAsync(GetPolicyRequest, CancellationToken)

    public virtual Task<Policy> GetPolicyAsync(GetPolicyRequest request, CancellationToken cancellationToken)

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 object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **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` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    GetPolicyRequest request = new GetPolicyRequest { Name = "", };
    // Make the request
    Policy response = await policiesClient.GetPolicyAsync(request);

### GetPolicyAsync(string, CallSettings)

    public virtual Task<Policy> GetPolicyAsync(string name, CallSettings callSettings = null)

Gets a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the policy to retrieve. Format: `policies/{attachment_point}/denypolicies/{policy_id}` Use the URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    string name = "";
    // Make the request
    Policy response = await policiesClient.GetPolicyAsync(name);

### GetPolicyAsync(string, CancellationToken)

    public virtual Task<Policy> GetPolicyAsync(string name, CancellationToken cancellationToken)

Gets a policy.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `name` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource name of the policy to retrieve. Format: `policies/{attachment_point}/denypolicies/{policy_id}` Use the URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies/my-policy`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **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` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    string name = "";
    // Make the request
    Policy response = await policiesClient.GetPolicyAsync(name);

### ListPolicies(ListPoliciesRequest, CallSettings)

    public virtual PagedEnumerable<ListPoliciesResponse, Policy> ListPolicies(ListPoliciesRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | A pageable sequence of [Policy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy) resources. |

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    ListPoliciesRequest request = new ListPoliciesRequest { Parent = "", };
    // Make the request
    PagedEnumerable<ListPoliciesResponse, Policy> response = policiesClient.ListPolicies(request);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (Policy item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListPoliciesResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Policy item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Policy> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Policy item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListPolicies(string, string, int?, CallSettings)

    public virtual PagedEnumerable<ListPoliciesResponse, Policy> ListPolicies(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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** |
| `parent` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource that the policy is attached to, along with the kind of policy to list. Format: `policies/{attachment_point}/denypolicies` The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | A pageable sequence of [Policy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy) resources. |

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    string parent = "";
    // Make the request
    PagedEnumerable<ListPoliciesResponse, Policy> response = policiesClient.ListPolicies(parent);

    // Iterate over all response items, lazily performing RPCs as required
    foreach (Policy item in response)
    {
        // Do something with each item
        Console.WriteLine(item);
    }

    // Or iterate over pages (of server-defined size), performing one RPC per page
    foreach (ListPoliciesResponse page in response.AsRawResponses())
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Policy item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    }

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Policy> singlePage = response.ReadPage(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Policy item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListPoliciesAsync(ListPoliciesRequest, CallSettings)

    public virtual PagedAsyncEnumerable<ListPoliciesResponse, Policy> ListPoliciesAsync(ListPoliciesRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | A pageable asynchronous sequence of [Policy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy) resources. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    ListPoliciesRequest request = new ListPoliciesRequest { Parent = "", };
    // Make the request
    PagedAsyncEnumerable<ListPoliciesResponse, Policy> response = policiesClient.ListPoliciesAsync(request);

    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((Policy item) =>
    {
        // Do something with each item
        Console.WriteLine(item);
    });

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await response.AsRawResponses().ForEachAsync((ListPoliciesResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Policy item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    });

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Policy> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Policy item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### ListPoliciesAsync(string, string, int?, CallSettings)

    public virtual PagedAsyncEnumerable<ListPoliciesResponse, Policy> ListPoliciesAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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** |
| `parent` | `https://learn.microsoft.com/dotnet/api/system.string` Required. The resource that the policy is attached to, along with the kind of policy to list. Format: `policies/{attachment_point}/denypolicies` The attachment point is identified by its URL-encoded full resource name, which means that the forward-slash character, `/`, must be written as `%2F`. For example, `policies/cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project/denypolicies`. For organizations and folders, use the numeric ID in the full resource name. For projects, you can use the alphanumeric or the numeric ID. |
| `pageToken` | `https://learn.microsoft.com/dotnet/api/system.string` The token returned from the previous request. A value of `null` or an empty string retrieves the first page. |
| `pageSize` | `https://learn.microsoft.com/dotnet/api/system.int32` The size of page to request. The response will not be larger than this, but may be smaller. A value of `null` or `0` uses a server-defined page size. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.PagedAsyncEnumerable-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.ListPoliciesResponsehttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy` | A pageable asynchronous sequence of [Policy](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policy) resources. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    string parent = "";
    // Make the request
    PagedAsyncEnumerable<ListPoliciesResponse, Policy> response = policiesClient.ListPoliciesAsync(parent);

    // Iterate over all response items, lazily performing RPCs as required
    await response.ForEachAsync((Policy item) =>
    {
        // Do something with each item
        Console.WriteLine(item);
    });

    // Or iterate over pages (of server-defined size), performing one RPC per page
    await response.AsRawResponses().ForEachAsync((ListPoliciesResponse page) =>
    {
        // Do something with each page of items
        Console.WriteLine("A page of results:");
        foreach (Policy item in page)
        {
            // Do something with each item
            Console.WriteLine(item);
        }
    });

    // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
    int pageSize = 10;
    Page<Policy> singlePage = await response.ReadPageAsync(pageSize);
    // Do something with the page of items
    Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
    foreach (Policy item in singlePage)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
    // Store the pageToken, for when the next page is required.
    string nextPageToken = singlePage.NextPageToken;

### PollOnceCreatePolicy(string, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> PollOnceCreatePolicy(string operationName, CallSettings callSettings = null)

Poll an operation once, using an `operationName` from a previous invocation of `CreatePolicy`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `operationName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of a previously invoked operation. Must not be `null` or empty. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The result of polling the operation. |

### PollOnceCreatePolicyAsync(string, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> PollOnceCreatePolicyAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an `operationName` from a previous invocation of
`CreatePolicy`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `operationName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of a previously invoked operation. Must not be `null` or empty. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A task representing the result of polling the operation. |

### PollOnceDeletePolicy(string, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> PollOnceDeletePolicy(string operationName, CallSettings callSettings = null)

Poll an operation once, using an `operationName` from a previous invocation of `DeletePolicy`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `operationName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of a previously invoked operation. Must not be `null` or empty. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The result of polling the operation. |

### PollOnceDeletePolicyAsync(string, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> PollOnceDeletePolicyAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an `operationName` from a previous invocation of
`DeletePolicy`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `operationName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of a previously invoked operation. Must not be `null` or empty. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A task representing the result of polling the operation. |

### PollOnceUpdatePolicy(string, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> PollOnceUpdatePolicy(string operationName, CallSettings callSettings = null)

Poll an operation once, using an `operationName` from a previous invocation of `UpdatePolicy`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `operationName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of a previously invoked operation. Must not be `null` or empty. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The result of polling the operation. |

### PollOnceUpdatePolicyAsync(string, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> PollOnceUpdatePolicyAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an `operationName` from a previous invocation of
`UpdatePolicy`.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `operationName` | `https://learn.microsoft.com/dotnet/api/system.string` The name of a previously invoked operation. Must not be `null` or empty. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A task representing the result of polling the operation. |

### ShutdownDefaultChannelsAsync()

    public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient#Google_Cloud_Iam_V2_PoliciesClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient#Google_Cloud_Iam_V2_PoliciesClient_CreateAsync_System_Threading_CancellationToken_). Channels which weren't automatically created are not
affected.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://learn.microsoft.com/dotnet/api/system.threading.tasks.task` | A task representing the asynchronous shutdown operation. |

**Remarks** After calling this method, further calls to [Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient#Google_Cloud_Iam_V2_PoliciesClient_Create) and
[CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PoliciesClient#Google_Cloud_Iam_V2_PoliciesClient_CreateAsync_System_Threading_CancellationToken_) will create new channels, which could in turn be shut down
by another call to this method.

### UpdatePolicy(UpdatePolicyRequest, CallSettings)

    public virtual Operation<Policy, PolicyOperationMetadata> UpdatePolicy(UpdatePolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.LongRunning/latest/Google.LongRunning.Operation-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | The RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = PoliciesClient.Create();
    // Initialize request argument(s)
    UpdatePolicyRequest request = new UpdatePolicyRequest
    {
        Policy = new Policy(),
    };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = policiesClient.UpdatePolicy(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = response.PollUntilCompleted();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = policiesClient.PollOnceUpdatePolicy(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### UpdatePolicyAsync(UpdatePolicyRequest, CallSettings)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> UpdatePolicyAsync(UpdatePolicyRequest request, CallSettings callSettings = null)

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 object containing all of the parameters for the API call. |
| `callSettings` | `https://cloud.google.com/dotnet/docs/reference/Google.Api.Gax/latest/Google.Api.Gax.Grpc.CallSettings.html` If not null, applies overrides to this RPC call. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    UpdatePolicyRequest request = new UpdatePolicyRequest
    {
        Policy = new Policy(),
    };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.UpdatePolicyAsync(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceUpdatePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }

### UpdatePolicyAsync(UpdatePolicyRequest, CancellationToken)

    public virtual Task<Operation<Policy, PolicyOperationMetadata>> UpdatePolicyAsync(UpdatePolicyRequest request, CancellationToken cancellationToken)

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 object containing all of the parameters for the API call. |
| `cancellationToken` | `https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken` A [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken) to use for this RPC. |

| **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-2.htmlhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.Policyhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.Iam.V2/latest/Google.Cloud.Iam.V2.PolicyOperationMetadata` | A Task containing the RPC response. |

**Example**

    // Create client
    PoliciesClient policiesClient = await PoliciesClient.CreateAsync();
    // Initialize request argument(s)
    UpdatePolicyRequest request = new UpdatePolicyRequest
    {
        Policy = new Policy(),
    };
    // Make the request
    Operation<Policy, PolicyOperationMetadata> response = await policiesClient.UpdatePolicyAsync(request);

    // Poll until the returned long-running operation is complete
    Operation<Policy, PolicyOperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
    // Retrieve the operation result
    Policy result = completedResponse.Result;

    // Or get the name of the operation
    string operationName = response.Name;
    // This name can be stored, then the long-running operation retrieved later by name
    Operation<Policy, PolicyOperationMetadata> retrievedResponse = await policiesClient.PollOnceUpdatePolicyAsync(operationName);
    // Check if the retrieved long-running operation has completed
    if (retrievedResponse.IsCompleted)
    {
        // If it has completed, then access the result
        Policy retrievedResult = retrievedResponse.Result;
    }