# Service Control v1 API - Class QuotaControllerClientImpl (2.5.0)

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

- [2.5.0 (latest)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [2.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/2.4.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [2.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/2.3.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [2.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/2.2.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [2.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/2.1.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [2.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/2.0.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [1.4.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/1.4.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [1.3.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/1.3.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [1.2.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/1.2.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [1.1.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/1.1.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)
- [1.0.0](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/1.0.0/Google.Cloud.ServiceControl.V1.QuotaControllerClientImpl)

    public sealed class QuotaControllerClientImpl : QuotaControllerClient

Reference documentation and code samples for the Service Control v1 API class QuotaControllerClientImpl.

QuotaController client wrapper implementation, for convenient use.

## Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) \> [QuotaControllerClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient) \> QuotaControllerClientImpl

## Inherited Members

[QuotaControllerClient.DefaultEndpoint](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_DefaultEndpoint) [QuotaControllerClient.DefaultScopes](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_DefaultScopes) [QuotaControllerClient.ServiceMetadata](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_ServiceMetadata) [QuotaControllerClient.CreateAsync(CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_CreateAsync_System_Threading_CancellationToken_) [QuotaControllerClient.Create()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_Create) [QuotaControllerClient.ShutdownDefaultChannelsAsync()](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_ShutdownDefaultChannelsAsync) [QuotaControllerClient.AllocateQuotaAsync(AllocateQuotaRequest, CancellationToken)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_AllocateQuotaAsync_Google_Cloud_ServiceControl_V1_AllocateQuotaRequest_System_Threading_CancellationToken_) [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Namespace

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

## Assembly

Google.Cloud.ServiceControl.V1.dll

## Remarks

[Google Quota Control API](https://docs.cloud.google.com/service-control/overview)

Allows clients to allocate and release quota against a [managed
service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).

## Constructors

### QuotaControllerClientImpl(QuotaControllerClient, QuotaControllerSettings, ILogger)

    public QuotaControllerClientImpl(QuotaController.QuotaControllerClient grpcClient, QuotaControllerSettings settings, ILogger logger)

Constructs a client wrapper for the QuotaController service, with the specified gRPC client and settings.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `grpcClient` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaController.QuotaControllerClient` The underlying gRPC client. |
| `settings` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerSettings` The base [QuotaControllerSettings](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerSettings) used within this client. |
| `logger` | `https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger` Optional [ILogger](https://learn.microsoft.com/dotnet/api/microsoft.extensions.logging.ilogger) to use within this client. |

## Properties

### GrpcClient

    public override QuotaController.QuotaControllerClient GrpcClient { get; }

The underlying gRPC QuotaController client

| **Property Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerhttps://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaController.QuotaControllerClient` |   |

**Overrides** [QuotaControllerClient.GrpcClient](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_GrpcClient)

## Methods

### AllocateQuota(AllocateQuotaRequest, CallSettings)

    public override AllocateQuotaResponse AllocateQuota(AllocateQuotaRequest request, CallSettings callSettings = null)

Attempts to allocate quota for the specified consumer. It should be called
before the operation is executed.

This method requires the `servicemanagement.services.quota`
permission on the specified service. For more information, see
[Cloud IAM](https://cloud.google.com/iam).

**NOTE:** The client **must** fail-open on server errors `INTERNAL`,
`UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system
reliability, the server may inject these errors to prohibit any hard
dependency on the quota functionality.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.AllocateQuotaRequest` 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.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.AllocateQuotaResponse` | The RPC response. |

**Overrides** [QuotaControllerClient.AllocateQuota(AllocateQuotaRequest, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_AllocateQuota_Google_Cloud_ServiceControl_V1_AllocateQuotaRequest_Google_Api_Gax_Grpc_CallSettings_)

### AllocateQuotaAsync(AllocateQuotaRequest, CallSettings)

    public override Task<AllocateQuotaResponse> AllocateQuotaAsync(AllocateQuotaRequest request, CallSettings callSettings = null)

Attempts to allocate quota for the specified consumer. It should be called
before the operation is executed.

This method requires the `servicemanagement.services.quota`
permission on the specified service. For more information, see
[Cloud IAM](https://cloud.google.com/iam).

**NOTE:** The client **must** fail-open on server errors `INTERNAL`,
`UNKNOWN`, `DEADLINE_EXCEEDED`, and `UNAVAILABLE`. To ensure system
reliability, the server may inject these errors to prohibit any hard
dependency on the quota functionality.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.AllocateQuotaRequest` 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.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.AllocateQuotaResponse` | A Task containing the RPC response. |

**Overrides** [QuotaControllerClient.AllocateQuotaAsync(AllocateQuotaRequest, CallSettings)](https://docs.cloud.google.com/dotnet/docs/reference/Google.Cloud.ServiceControl.V1/latest/Google.Cloud.ServiceControl.V1.QuotaControllerClient#Google_Cloud_ServiceControl_V1_QuotaControllerClient_AllocateQuotaAsync_Google_Cloud_ServiceControl_V1_AllocateQuotaRequest_Google_Api_Gax_Grpc_CallSettings_)