Service Control v1 API - Class QuotaControllerClient (2.4.0)

public abstract class QuotaControllerClient

Reference documentation and code samples for the Service Control v1 API 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
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default QuotaController scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual QuotaController.QuotaControllerClient GrpcClient { get; }

The underlying gRPC QuotaController client

Property Value
Type Description
QuotaControllerQuotaControllerClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

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
Name Description
request AllocateQuotaRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
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
Name Description
request AllocateQuotaRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskAllocateQuotaResponse

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
Name Description
request AllocateQuotaRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskAllocateQuotaResponse

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
Type Description
QuotaControllerClient

The created QuotaControllerClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskQuotaControllerClient

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
Type Description
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.