createView
Creates a new SQL view. A view is a named, reusable SQL query that can be referenced from telemetry queries. View names must be unique within the account and region. Only USER views can be created — MANAGED views are provisioned by AWS.
Samples
// The following example creates a user view that saves an error count by service query. View names
// must begin with the view. prefix and be unique within the account and Region. Payloads are shown as JSON
// on the wire they are CBOR encoded.
val resp = cloudWatchOmniClient.createView {
name = "view.service_errors"
definition = "SELECT resource['attributes']['service.name'] AS service, COUNT(*) AS error_count FROM \"logs.default\" WHERE severityText = 'ERROR' GROUP BY service"
description = "Error counts by service"
tags = mapOf<String, String>(
"Team" to "observability"
)
clientToken = "3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73"
}Content copied to clipboard