list method
Lists the existing alerts for the metrics scope of the project.
Request parameters:
parent - Required. The name of the project to list alerts for.
Value must have pattern ^projects/\[^/\]+$.
filter - Optional. An alert is returned if there is a match on any
fields belonging to the alert or its subfields.
orderBy - Optional. A comma-separated list of fields in Alert to use for
sorting. The default sort direction is ascending. To specify descending
order for a field, add a desc modifier. The following fields are
supported: open_time close_timeFor example, close_time desc, open_time
will return the alerts closed most recently, with ties broken in the order
of older alerts listed first.If the field is not set, the results are
sorted by open_time desc.
pageSize - Optional. The maximum number of results to return in a single
response. If not set to a positive number, at most 50 alerts will be
returned. The maximum value is 1000; values above 1000 will be coerced to
1000.
pageToken - Optional. If non-empty, page_token must contain a value
returned as the next_page_token in a previous response to request the next
set of results.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a ListAlertsResponse.
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<ListAlertsResponse> list(
core.String parent, {
core.String? filter,
core.String? orderBy,
core.int? pageSize,
core.String? pageToken,
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
'filter': ?filter == null ? null : [filter],
'orderBy': ?orderBy == null ? null : [orderBy],
'pageSize': ?pageSize == null ? null : ['${pageSize}'],
'pageToken': ?pageToken == null ? null : [pageToken],
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v3/' + core.Uri.encodeFull('$parent') + '/alerts';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return ListAlertsResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}