listAlerts

abstract suspend fun listAlerts(input: ListAlertsRequest): ListAlertsResponse

Lists alerts within a space, optionally filtered by exact name(s), a single name prefix, or exact alertId(s), with pagination. Use GetAlert to retrieve a single alert's full detail.

Samples

// The following example lists the first page of alerts in a space, sorted by state, and returns a
// nextToken to retrieve the next page. Payloads are shown as JSON on the wire they are CBOR encoded.
val resp = cloudWatchOmniClient.listAlerts {
    spaceId = "a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d"
    filterCriteria = AlertFilterCriteria {
        namePrefix = "service-"
        stateValue = listOf<AlertState>(
            AlertState.fromValue("WARNING"),
            AlertState.fromValue("CRITICAL")
        )
    }
    sortBy = AlertSortField.fromValue("STATE")
    sortOrder = AlertSortOrder.fromValue("DESC")
    maxResults = 50
}