report method

Future<ReportResponse> report(
  1. ReportRequest request,
  2. String serviceName, {
  3. String? $fields,
})

This method provides telemetry reporting for services that are integrated with Service Infrastructure.

It reports a list of operations that have occurred on a service. It must be called after the operations have been executed. For more information, see Telemetry Reporting. NOTE: The telemetry reporting has a hard limit of 100 operations and 1MB per Report call. This method requires the servicemanagement.services.report 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 ReportResponse.

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<ReportResponse> report(
  ReportRequest 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') + ':report';

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