getAlarms method
Returns information about the configured alarms. Specify an alarm name in your request to return information about a specific alarm, or specify a monitored resource name to return information about all alarms for a specific resource.
An alarm is used to monitor a single metric for one of your resources. When a metric condition is met, the alarm can notify you by email, SMS text message, and a banner displayed on the Amazon Lightsail console. For more information, see Alarms in Amazon Lightsail.
May throw ServiceException. May throw InvalidInputException. May throw OperationFailureException. May throw UnauthenticatedException. May throw AccessDeniedException. May throw NotFoundException.
Parameter alarmName
:
The name of the alarm.
Specify an alarm name to return information about a specific alarm.
Parameter monitoredResourceName
:
The name of the Lightsail resource being monitored by the alarm.
Specify a monitored resource name to return information about all alarms for a specific resource.
Parameter pageToken
:
The token to advance to the next page of results from your request.
To get a page token, perform an initial GetAlarms
request. If
your results are paginated, the response will return a next page token
that you can specify as the page token in a subsequent request.
Implementation
Future<GetAlarmsResult> getAlarms({
String? alarmName,
String? monitoredResourceName,
String? pageToken,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.GetAlarms'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (alarmName != null) 'alarmName': alarmName,
if (monitoredResourceName != null)
'monitoredResourceName': monitoredResourceName,
if (pageToken != null) 'pageToken': pageToken,
},
);
return GetAlarmsResult.fromJson(jsonResponse.body);
}