describe_alarm_history(
*,
config_overrides: Optional[AsyncCloudWatchClientConfig] = None,
alarm_name: Optional[AlarmName] = None,
alarm_contributor_id: Optional[ContributorId] = None,
alarm_types: Optional[AlarmTypes] = None,
history_item_type: Optional[HistoryItemType] = None,
start_date: Optional[Timestamp] = None,
end_date: Optional[Timestamp] = None,
max_records: Optional[MaxRecords] = None,
next_token: Optional[NextToken] = None,
scan_by: Optional[ScanBy] = None,
) -> DescribeAlarmHistoryOutput
Retrieves the history for the specified alarm. You can filter the results by date range or item type. If an alarm name is not specified, the histories for either all metric alarms or all composite alarms are returned.
CloudWatch retains the history of an alarm even if you delete the alarm.
To use this operation and return information about a composite alarm, you must be signed on with the cloudwatch:DescribeAlarmHistory permission that is scoped to *. You can't return information about composite alarms if your cloudwatch:DescribeAlarmHistory permission has a narrower scope.
Parameters:
-
alarm_name
(Optional[AlarmName], default:
None
)
–
-
alarm_contributor_id
(Optional[ContributorId], default:
None
)
–
The unique identifier of a specific alarm contributor to filter the alarm history results.
-
alarm_types
(Optional[AlarmTypes], default:
None
)
–
Use this parameter to specify whether you want the operation to return metric alarms, composite alarms, or log alarms. If you omit this parameter, only metric alarms are returned.
-
history_item_type
(Optional[HistoryItemType], default:
None
)
–
The type of alarm histories to retrieve.
-
start_date
(Optional[Timestamp], default:
None
)
–
The starting date to retrieve alarm history.
-
end_date
(Optional[Timestamp], default:
None
)
–
The ending date to retrieve alarm history.
-
max_records
(Optional[MaxRecords], default:
None
)
–
The maximum number of alarm history records to retrieve.
-
next_token
(Optional[NextToken], default:
None
)
–
The token returned by a previous call to indicate that there is more data available.
-
scan_by
(Optional[ScanBy], default:
None
)
–
Specified whether to return the newest or oldest alarm history first. Specify TimestampDescending to have the newest event history returned first, and specify TimestampAscending to have the oldest history returned first.
Raises:
Source code in docs_src/capo_cloudwatch/_services/async_cloud_watch.py
| async def describe_alarm_history(
self,
*,
config_overrides: Optional[AsyncCloudWatchClientConfig] = None,
alarm_name: Optional["capo_cloudwatch.types.alarm_name.AlarmName"] = None,
alarm_contributor_id: Optional[
"capo_cloudwatch.types.contributor_id.ContributorId"
] = None,
alarm_types: Optional["capo_cloudwatch.types.alarm_types.AlarmTypes"] = None,
history_item_type: Optional[
"capo_cloudwatch.types.history_item_type.HistoryItemType"
] = None,
start_date: Optional["capo_cloudwatch.types.timestamp.Timestamp"] = None,
end_date: Optional["capo_cloudwatch.types.timestamp.Timestamp"] = None,
max_records: Optional["capo_cloudwatch.types.max_records.MaxRecords"] = None,
next_token: Optional["capo_cloudwatch.types.next_token.NextToken"] = None,
scan_by: Optional["capo_cloudwatch.types.scan_by.ScanBy"] = None,
) -> (
"capo_cloudwatch.types.describe_alarm_history_output.DescribeAlarmHistoryOutput"
):
"""<p>Retrieves the history for the specified alarm. You can filter the results by date range or item type. If an alarm name is not specified, the histories for either all metric alarms or all composite alarms are returned.</p> <p>CloudWatch retains the history of an alarm even if you delete the alarm.</p> <p>To use this operation and return information about a composite alarm, you must be signed on with the <code>cloudwatch:DescribeAlarmHistory</code> permission that is scoped to <code>*</code>. You can't return information about composite alarms if your <code>cloudwatch:DescribeAlarmHistory</code> permission has a narrower scope.</p>
Args:
alarm_name: <p>The name of the alarm.</p>
alarm_contributor_id: <p>The unique identifier of a specific alarm contributor to filter the alarm history results.</p>
alarm_types: <p>Use this parameter to specify whether you want the operation to return metric alarms, composite alarms, or log alarms. If you omit this parameter, only metric alarms are returned.</p>
history_item_type: <p>The type of alarm histories to retrieve.</p>
start_date: <p>The starting date to retrieve alarm history.</p>
end_date: <p>The ending date to retrieve alarm history.</p>
max_records: <p>The maximum number of alarm history records to retrieve.</p>
next_token: <p>The token returned by a previous call to indicate that there is more data available.</p>
scan_by: <p>Specified whether to return the newest or oldest alarm history first. Specify <code>TimestampDescending</code> to have the newest event history returned first, and specify <code>TimestampAscending</code> to have the oldest history returned first.</p>
Raises:
capo_cloudwatch.errors.invalid_next_token.InvalidNextToken: <p>The next token specified is invalid.</p>
capo_cloudwatch.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_cloudwatch.types.describe_alarm_history_input.DescribeAlarmHistoryInput]",
) -> AsyncOperationResponse[
"capo_cloudwatch.types.describe_alarm_history_output.DescribeAlarmHistoryOutput"
]:
import capo_cloudwatch._operations.granite_service_version20100801.describe_alarm_history
(
output,
http_response,
) = await capo_cloudwatch._operations.granite_service_version20100801.describe_alarm_history.async_describe_alarm_history(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DescribeAlarmHistory")
)
input_: capo_cloudwatch.types.describe_alarm_history_input.DescribeAlarmHistoryInput = {}
if alarm_name is not None:
input_["alarm_name"] = alarm_name
if alarm_contributor_id is not None:
input_["alarm_contributor_id"] = alarm_contributor_id
if alarm_types is not None:
input_["alarm_types"] = alarm_types
if history_item_type is not None:
input_["history_item_type"] = history_item_type
if start_date is not None:
input_["start_date"] = start_date
if end_date is not None:
input_["end_date"] = end_date
if max_records is not None:
input_["max_records"] = max_records
if next_token is not None:
input_["next_token"] = next_token
if scan_by is not None:
input_["scan_by"] = scan_by
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|