check method

Future<CheckResponse> check(
  1. CheckRequest request,
  2. String serviceName, {
  3. String? $fields,
})

Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies.

It must be called before the operation is executed. If feasible, the client should cache the check results and reuse them for 60 seconds. In case of any server errors, the client should rely on the cached results for much longer time to avoid outage. WARNING: There is general 60s delay for the configuration and policy propagation, therefore callers MUST NOT depend on the Check method having the latest policy information. NOTE: the CheckRequest has the size limit (wire-format byte size) of 1MB. This method requires the servicemanagement.services.check permission on the specified service. For more information, see Cloud IAM.

request - The metadata request object.

Request parameters:

serviceName - The service name as specified in its 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 CheckResponse.

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<CheckResponse> check(
  CheckRequest 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') + ':check';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return CheckResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}