check method

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

Private Preview.

This feature is only available for approved services. This method provides admission control for services that are integrated with Service Infrastructure. It checks whether an operation should be allowed based on the service configuration and relevant policies. It must be called before the operation is executed. For more information, see Admission Control. NOTE: The admission control has an expected policy propagation delay of 60s. The caller must not depend on the most recent policy changes. NOTE: The admission control has a hard limit of 1 referenced resources per call. If an operation refers to more than 1 resources, the caller must call the Check method multiple times. This method requires the servicemanagement.services.check permission on the specified service. For more information, see Service Control API Access Control.

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_ =
      'v2/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>);
}