list method

Future<ListUtilizationReportsResponse> list(
  1. String parent, {
  2. String? filter,
  3. String? orderBy,
  4. int? pageSize,
  5. String? pageToken,
  6. String? view,
  7. String? $fields,
})

Lists Utilization Reports of the given Source.

Request parameters:

parent - Required. The Utilization Reports parent. Value must have pattern ^projects/\[^/\]+/locations/\[^/\]+/sources/\[^/\]+$.

filter - Optional. The filter request.

orderBy - Optional. the order by fields for the result.

pageSize - Optional. The maximum number of reports to return. The service may return fewer than this value. If unspecified, at most 500 reports will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.

pageToken - Required. A page token, received from a previous ListUtilizationReports call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to ListUtilizationReports must match the call that provided the page token.

view - Optional. The level of details of each report. Defaults to BASIC. Possible string values are:

  • "UTILIZATION_REPORT_VIEW_UNSPECIFIED" : The default / unset value. The API will default to FULL on single report request and BASIC for multiple reports request.
  • "BASIC" : Get the report metadata, without the list of VMs and their utilization info.
  • "FULL" : Include everything.

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

Completes with a ListUtilizationReportsResponse.

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<ListUtilizationReportsResponse> list(
  core.String parent, {
  core.String? filter,
  core.String? orderBy,
  core.int? pageSize,
  core.String? pageToken,
  core.String? view,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (filter != null) 'filter': [filter],
    if (orderBy != null) 'orderBy': [orderBy],
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (view != null) 'view': [view],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$parent') + '/utilizationReports';

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