testIamPermissions method

Future<TestIamPermissionsResponse> testIamPermissions(
  1. TestIamPermissionsRequest request
)

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 StatusException if the API failed with a Status message. Throws a ServiceException for any other failure.

Implementation

Future<TestIamPermissionsResponse> testIamPermissions(
  TestIamPermissionsRequest request,
) async {
  final url = Uri.https(_host, '/v2/${request.resource}:testIamPermissions');
  final response = await _client.post(url, body: request);
  return TestIamPermissionsResponse.fromJson(response);
}