allocateQuota method
- AllocateQuotaRequest request,
- String serviceName, {
- String? $fields,
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.
request
- The metadata request object.
Request parameters:
serviceName
- Name of the service as specified in the service
configuration. For example, "pubsub.googleapis.com"
. See
google.api.Service for the definition of a service name.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a AllocateQuotaResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client
completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<AllocateQuotaResponse> allocateQuota(
AllocateQuotaRequest request,
core.String serviceName, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v1/services/' +
commons.escapeVariable('$serviceName') +
':allocateQuota';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return AllocateQuotaResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}