def ExecuteRequest(
    client: 'googleapiclient.discovery.Resource',
    func: str,
    kwargs: Dict[str, Any],
    throttle: bool = False) -> List[Dict[str, Any]]:
  """Execute a request to the GCP API.

  Args:
    client (googleapiclient.discovery.Resource): A GCP client object.
    func (str): A GCP function to query from the client.
    kwargs (Dict): A dictionary of parameters for the function func.
    throttle (bool): A boolean indicating if requests should be throttled. This
        is necessary for some APIs (e.g. list logs) as there is an API rate
        limit. Default is False, i.e. requests are not throttled.

  Returns:
    List[Dict]: A List of dictionaries (responses from the request).

  Raises:
    CredentialsConfigurationError: If the request to the GCP API could not
        complete.
  """

  responses = []
  next_token = None
  while True:
    if throttle:
      # https://cloud.google.com/logging/quotas#api-limits
      # 1 call per second per project
      time.sleep(1.5)
    if next_token:
      if 'body' in kwargs:
        kwargs['body']['pageToken'] = next_token
      else:
        kwargs['pageToken'] = next_token
    try:
      request = getattr(client, func)
      response = request(**kwargs).execute()
    except (RefreshError, DefaultCredentialsError) as exception:
      raise errors.CredentialsConfigurationError(
          ': {0!s}. Something is wrong with your Application Default '
          'Credentials. Try running: $ gcloud auth application-default '
          'login'.format(exception),
          __name__) from exception
    responses.append(response)
    next_token = response.get('nextPageToken')
    if not next_token:
      return responses
Execute a request to the GCP API.

Args:
client (googleapiclient.discovery.Resource): A GCP client object.
func (str): A GCP function to query from the client.
kwargs (Dict): A dictionary of parameters for the function func.
throttle (bool): A boolean indicating if requests should be throttled. This
is necessary for some APIs (e.g. list logs) as there is an API rate
limit. Default is False, i.e. requests are not throttled.

Returns:
List[Dict]: A List of dictionaries (responses from the request).

Raises:
CredentialsConfigurationError: If the request to the GCP API could not
complete.
libcloudforensics/providers/gcp/internal/common.py