checkAccess method

Future<CheckAccessResponse> checkAccess(
  1. Principal request,
  2. String name, {
  3. bool? debugOptions_enableDebugging,
  4. String? $fields,
})

Checks whether an item is accessible by specified principal.

Principal must be a user; groups and domain values aren't supported. Note: This API requires an admin account to execute.

request - The metadata request object.

Request parameters:

name - Item name, format: datasources/{source_id}/items/{item_id} Value must have pattern ^datasources/\[^/\]+/items/\[^/\]+$.

debugOptions_enableDebugging - If you are asked by Google to help with debugging, set this field. Otherwise, ignore this field.

$fields - Selector specifying which fields to include in a partial response.

Completes with a CheckAccessResponse.

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<CheckAccessResponse> checkAccess(
  Principal request,
  core.String name, {
  core.bool? debugOptions_enableDebugging,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (debugOptions_enableDebugging != null)
      'debugOptions.enableDebugging': ['${debugOptions_enableDebugging}'],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/debug/' + core.Uri.encodeFull('$name') + ':checkAccess';

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