Skip to content

update_view async

update_view(
    name: ViewName,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    definition: Optional[ViewDefinition] = None,
    description: Optional[ViewDescription] = None,
) -> UpdateViewResponse

Updates an existing view's definition and/or description. Only the fields you provide are changed. Managed views cannot be updated.

Parameters:

  • name (ViewName) –

    The name of the view to update.

  • definition (Optional[ViewDefinition], default: None ) –

    The new SQL query that defines the view. Omit to leave unchanged.

  • description (Optional[ViewDescription], default: None ) –

    The new description of the view. Omit to leave unchanged.

Raises:

Examples:

Update a view's definition The following example changes only the definition; the omitted description is left unchanged. Managed views cannot be updated. The response carries the view's effective configuration. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.update_view(name='view.service_errors', definition='SELECT resource[\'attributes\'][\'service.name\'] AS service, COUNT(*) AS error_count FROM "logs.default" WHERE status[\'code\'] IN (\'2\', \'ERROR\') GROUP BY service')
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def update_view(
    self,
    name: "capo_cloudwatchomni.types.view_name.ViewName",
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    definition: Optional[
        "capo_cloudwatchomni.types.view_definition.ViewDefinition"
    ] = None,
    description: Optional[
        "capo_cloudwatchomni.types.view_description.ViewDescription"
    ] = None,
) -> "capo_cloudwatchomni.types.update_view_response.UpdateViewResponse":
    r"""Updates an existing view's definition and/or description. Only the fields you provide are changed. Managed views cannot be updated.

    Args:
        name: The name of the view to update.
        definition: The new SQL query that defines the view. Omit to leave unchanged.
        description: The new description of the view. Omit to leave unchanged.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Update a view's definition
        The following example changes only the definition; the omitted description is left unchanged. Managed views cannot be updated. The response carries the view's effective configuration. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.update_view(name='view.service_errors', definition='SELECT resource[\'attributes\'][\'service.name\'] AS service, COUNT(*) AS error_count FROM "logs.default" WHERE status[\'code\'] IN (\'2\', \'ERROR\') GROUP BY service')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.update_view_request.UpdateViewRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.update_view_response.UpdateViewResponse"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.update_view

        (
            output,
            http_response,
        ) = await capo_cloudwatchomni._operations.cloud_watch_omni_frontend.update_view.async_update_view(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateView")
    )
    input_: capo_cloudwatchomni.types.update_view_request.UpdateViewRequest = {
        "name": name
    }
    if definition is not None:
        input_["definition"] = definition
    if description is not None:
        input_["description"] = description

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output