listHealthEvents method
Lists all health events for a monitor in Amazon CloudWatch Internet Monitor. Returns information for health events including the event start and end times, and the status.
May throw AccessDeniedException.
May throw InternalServerException.
May throw ThrottlingException.
May throw ValidationException.
Parameter monitorName :
The name of the monitor.
Parameter endTime :
The time when a health event ended. If the health event is still ongoing,
then the end time is not set.
Parameter eventStatus :
The status of a health event.
Parameter linkedAccountId :
The account ID for an account that you've set up cross-account sharing for
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 health event objects that you want to return with this call.
Parameter nextToken :
The token for the next set of results. You receive this token from a
previous call.
Parameter startTime :
The time when a health event started.
Implementation
Future<ListHealthEventsOutput> listHealthEvents({
required String monitorName,
DateTime? endTime,
HealthEventStatus? eventStatus,
String? linkedAccountId,
int? maxResults,
String? nextToken,
DateTime? startTime,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
25,
);
final $query = <String, List<String>>{
if (endTime != null) 'EndTime': [_s.iso8601ToJson(endTime).toString()],
if (eventStatus != null) 'EventStatus': [eventStatus.value],
if (linkedAccountId != null) 'LinkedAccountId': [linkedAccountId],
if (maxResults != null) 'MaxResults': [maxResults.toString()],
if (nextToken != null) 'NextToken': [nextToken],
if (startTime != null)
'StartTime': [_s.iso8601ToJson(startTime).toString()],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/v20210603/Monitors/${Uri.encodeComponent(monitorName)}/HealthEvents',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListHealthEventsOutput.fromJson(response);
}