listMonitors method

Future<ListMonitorsOutput> listMonitors({
  1. bool? includeLinkedAccounts,
  2. int? maxResults,
  3. String? monitorStatus,
  4. String? nextToken,
})

Lists all of your monitors for Amazon CloudWatch Internet Monitor and their statuses, along with the Amazon Resource Name (ARN) and name of each monitor.

May throw AccessDeniedException. May throw InternalServerException. May throw ThrottlingException. May throw ValidationException.

Parameter includeLinkedAccounts : A boolean option that you can set to TRUE to include monitors for linked accounts in a list of monitors, when you've set up cross-account sharing in Amazon CloudWatch Internet Monitor. You configure cross-account sharing by using Amazon CloudWatch Observability Access Manager. For more information, see Internet Monitor cross-account observability in the Amazon CloudWatch Internet Monitor User Guide.

Parameter maxResults : The number of monitor objects that you want to return with this call.

Parameter monitorStatus : The status of a monitor. This includes the status of the data processing for the monitor and the status of the monitor itself.

For information about the statuses for a monitor, see Monitor.

Parameter nextToken : The token for the next set of results. You receive this token from a previous call.

Implementation

Future<ListMonitorsOutput> listMonitors({
  bool? includeLinkedAccounts,
  int? maxResults,
  String? monitorStatus,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    25,
  );
  final $query = <String, List<String>>{
    if (includeLinkedAccounts != null)
      'IncludeLinkedAccounts': [includeLinkedAccounts.toString()],
    if (maxResults != null) 'MaxResults': [maxResults.toString()],
    if (monitorStatus != null) 'MonitorStatus': [monitorStatus],
    if (nextToken != null) 'NextToken': [nextToken],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/v20210603/Monitors',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListMonitorsOutput.fromJson(response);
}