create_view
async
¶
create_view(
name: ViewName,
definition: ViewDefinition,
*,
config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
description: Optional[ViewDescription] = None,
tags: Optional[TagMap] = None,
client_token: Optional[str] = None,
) -> CreateViewResponse
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.
Parameters:
-
name(ViewName) –The name of the view. Must begin with the "view." prefix. View names must be unique within the account and region.
-
definition(ViewDefinition) –The SQL query that defines the view.
-
description(Optional[ViewDescription], default:None) –A description of the view.
-
tags(Optional[TagMap], default:None) –Resource tags.
-
client_token(Optional[str], default:None) –Idempotency token for safe retries. Retrying with the same token returns the original view instead of creating a duplicate.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
ConflictException–The operation could not be completed because of a conflict with the current state of the resource.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Create a view 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.
>>> await client.create_view(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={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 | |