Class QuotaControllerClient

public abstract class QuotaControllerClient

QuotaController client wrapper, for convenient use.

Inheritance

Object > QuotaControllerClient

Namespace

Google.Cloud.ServiceControl.V1

Assembly

Google.Cloud.ServiceControl.V1.dll

Remarks

Google Quota Control API

Allows clients to allocate and release quota against a managed service.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default QuotaController scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual QuotaController.QuotaControllerClient GrpcClient { get; }

The underlying gRPC QuotaController client

Property Value
TypeDescription
QuotaController.QuotaControllerClient

Methods

AllocateQuota(AllocateQuotaRequest, CallSettings)

public virtual 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.

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
TypeNameDescription
AllocateQuotaRequestrequest

The request object containing all of the parameters for the API call.

CallSettingscallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
AllocateQuotaResponse

The RPC response.

Example
// Create client
QuotaControllerClient quotaControllerClient = QuotaControllerClient.Create();
// Initialize request argument(s)
AllocateQuotaRequest request = new AllocateQuotaRequest
{
    ServiceName = "",
    AllocateOperation = new QuotaOperation(),
    ServiceConfigId = "",
};
// Make the request
AllocateQuotaResponse response = quotaControllerClient.AllocateQuota(request);

AllocateQuotaAsync(AllocateQuotaRequest, CallSettings)

public virtual 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.

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
TypeNameDescription
AllocateQuotaRequestrequest

The request object containing all of the parameters for the API call.

CallSettingscallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<AllocateQuotaResponse>

A Task containing the RPC response.

Example
// Create client
QuotaControllerClient quotaControllerClient = await QuotaControllerClient.CreateAsync();
// Initialize request argument(s)
AllocateQuotaRequest request = new AllocateQuotaRequest
{
    ServiceName = "",
    AllocateOperation = new QuotaOperation(),
    ServiceConfigId = "",
};
// Make the request
AllocateQuotaResponse response = await quotaControllerClient.AllocateQuotaAsync(request);

AllocateQuotaAsync(AllocateQuotaRequest, CancellationToken)

public virtual Task<AllocateQuotaResponse> AllocateQuotaAsync(AllocateQuotaRequest request, CancellationToken cancellationToken)

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.

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
TypeNameDescription
AllocateQuotaRequestrequest

The request object containing all of the parameters for the API call.

CancellationTokencancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AllocateQuotaResponse>

A Task containing the RPC response.

Example
// Create client
QuotaControllerClient quotaControllerClient = await QuotaControllerClient.CreateAsync();
// Initialize request argument(s)
AllocateQuotaRequest request = new AllocateQuotaRequest
{
    ServiceName = "",
    AllocateOperation = new QuotaOperation(),
    ServiceConfigId = "",
};
// Make the request
AllocateQuotaResponse response = await quotaControllerClient.AllocateQuotaAsync(request);

Create()

public static QuotaControllerClient Create()

Synchronously creates a QuotaControllerClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use QuotaControllerClientBuilder.

Returns
TypeDescription
QuotaControllerClient

The created QuotaControllerClient.

CreateAsync(CancellationToken)

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

Asynchronously creates a QuotaControllerClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use QuotaControllerClientBuilder.

Parameter
TypeNameDescription
CancellationTokencancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<QuotaControllerClient>

The task representing the created QuotaControllerClient.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.