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
1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 | |