testIamPermissions method

  1. @override
Future<TestIamPermissionsResponse> testIamPermissions(
  1. TestIamPermissionsRequest request
)
override

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

@override
Future<TestIamPermissionsResponse> testIamPermissions(
  TestIamPermissionsRequest request,
) async {
  if (isClosed) throw StateError('Service is closed');

  if (_testIamPermissions case final testIamPermissions?) {
    return testIamPermissions(request);
  }
  throw UnsupportedError('testIamPermissions');
}