Skip to content

update_omni_slo async

update_omni_slo(
    space_id: SpaceId,
    slo_id: SloId,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    name: Optional[SloName] = None,
    description: Optional[SloDescription] = None,
    service_attributes: Optional[SloServiceAttributes] = None,
    sli: Optional[Sli] = None,
    objective: Optional[SloObjective] = None,
) -> UpdateOmniSloOutput

Updates an existing SLO. Omitted members are left unchanged, and a member that is present replaces that block whole, so read the SLO, change it, and write it back. Changing the SLI starts a new revision, which restarts the window totals.

Parameters:

  • space_id (SpaceId) –

    The unique ID of the space that owns the SLO.

  • slo_id (SloId) –

    The SLO to update.

  • name (Optional[SloName], default: None ) –

    A new display name. Renaming never changes the sloId or the ARN.

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

    A new description.

  • service_attributes (Optional[SloServiceAttributes], default: None ) –

    Replaces the whole service attributes block, so resend every member to keep. Omit it to leave the stored attributes unchanged.

  • sli (Optional[Sli], default: None ) –

    Replaces the whole SLI. Starts a new revision.

  • objective (Optional[SloObjective], default: None ) –

    Replaces the whole objective, including the time window, so resend every member to keep. The error budget is recomputed from the stored window totals; no new revision starts.

Raises:

Examples:

Lower the target of an SLO The following example lowers the target of an SLO from 99.9 to 99.5 percent. A supplied objective is replaced whole, so the warning ratio and the time window to keep are sent again. The SLI is not changed, so no new revision starts and the error budget is recomputed from the stored window totals. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.update_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='9f8e7d6c5b4a49382716051a2b3c4d5e', objective={'target': 99.5, 'warningBudgetConsumedRatio': 0.75, 'timeWindow': {'rolling': {'days': 30}}})
Change the SLI of an SLO
The following example changes the good condition of a time-slice SLI to a p99 latency of at most 250 milliseconds. A supplied SLI is replaced whole, so the period length and the query are sent again. Changing the SLI starts a new revision, and the window totals restart. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.update_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='7a6b5c4d3e2f41a0b9c8d7e6f5a4b3c2', sli={'periods': {'periodMinutes': 1, 'query': {'language': 'PROMQL', 'expression': 'histogram_quantile(0.99, sum by (le) (rate({"http.server.request.duration_bucket", "service.name"="checkout-api"}[$__interval])))'}, 'good': {'comparator': 'LTE', 'threshold': 0.25}}})
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def update_omni_slo(
    self,
    space_id: "capo_cloudwatchomni.types.space_id.SpaceId",
    slo_id: "capo_cloudwatchomni.types.slo_id.SloId",
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    name: Optional["capo_cloudwatchomni.types.slo_name.SloName"] = None,
    description: Optional[
        "capo_cloudwatchomni.types.slo_description.SloDescription"
    ] = None,
    service_attributes: Optional[
        "capo_cloudwatchomni.types.slo_service_attributes.SloServiceAttributes"
    ] = None,
    sli: Optional["capo_cloudwatchomni.types.sli.Sli"] = None,
    objective: Optional[
        "capo_cloudwatchomni.types.slo_objective.SloObjective"
    ] = None,
) -> "capo_cloudwatchomni.types.update_omni_slo_output.UpdateOmniSloOutput":
    """Updates an existing SLO. Omitted members are left unchanged, and a member that is present replaces that block whole, so read the SLO, change it, and write it back. Changing the SLI starts a new revision, which restarts the window totals.

    Args:
        space_id: The unique ID of the space that owns the SLO.
        slo_id: The SLO to update.
        name: A new display name. Renaming never changes the sloId or the ARN.
        description: A new description.
        service_attributes: Replaces the whole service attributes block, so resend every member to keep. Omit it to leave the stored attributes unchanged.
        sli: Replaces the whole SLI. Starts a new revision.
        objective: Replaces the whole objective, including the time window, so resend every member to keep. The error budget is recomputed from the stored window totals; no new revision starts.

    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:
        Lower the target of an SLO
        The following example lowers the target of an SLO from 99.9 to 99.5 percent. A supplied objective is replaced whole, so the warning ratio and the time window to keep are sent again. The SLI is not changed, so no new revision starts and the error budget is recomputed from the stored window totals. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.update_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='9f8e7d6c5b4a49382716051a2b3c4d5e', objective={'target': 99.5, 'warningBudgetConsumedRatio': 0.75, 'timeWindow': {'rolling': {'days': 30}}})
        Change the SLI of an SLO
        The following example changes the good condition of a time-slice SLI to a p99 latency of at most 250 milliseconds. A supplied SLI is replaced whole, so the period length and the query are sent again. Changing the SLI starts a new revision, and the window totals restart. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.update_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='7a6b5c4d3e2f41a0b9c8d7e6f5a4b3c2', sli={'periods': {'periodMinutes': 1, 'query': {'language': 'PROMQL', 'expression': 'histogram_quantile(0.99, sum by (le) (rate({"http.server.request.duration_bucket", "service.name"="checkout-api"}[$__interval])))'}, 'good': {'comparator': 'LTE', 'threshold': 0.25}}})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.update_omni_slo_input.UpdateOmniSloInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.update_omni_slo_output.UpdateOmniSloOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.update_omni_slo

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateOmniSlo")
    )
    input_: capo_cloudwatchomni.types.update_omni_slo_input.UpdateOmniSloInput = {
        "space_id": space_id,
        "slo_id": slo_id,
    }
    if name is not None:
        input_["name"] = name
    if description is not None:
        input_["description"] = description
    if service_attributes is not None:
        input_["service_attributes"] = service_attributes
    if sli is not None:
        input_["sli"] = sli
    if objective is not None:
        input_["objective"] = objective

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