getIamPolicy method

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

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

Future<Policy> getIamPolicy(
  GetIamPolicyInstanceTemplateRequest request,
) async {
  final url = _endPoint.replace(
    path:
        '/compute/v1/projects/${request.project}/global/instanceTemplates/${request.resource}/getIamPolicy',
    queryParameters: {
      if (request.optionsRequestedPolicyVersion case final $1?)
        'optionsRequestedPolicyVersion': '${$1}',
    },
  );
  final response = await _client.get(url);
  return Policy.fromJson(response);
}