Skip to content

delete_omni_slo async

delete_omni_slo(
    space_id: SpaceId,
    slo_id: SloId,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    force: Optional[bool] = None,
) -> DeleteOmniSloOutput

Deletes an SLO by its identifier and stops its evaluation. Idempotent: deleting an SLO that has already been removed succeeds without error. An SLO that alerts reference is refused with a ConflictException (conflictType RESOURCE_IN_USE) unless force is true. The error does not name the alerts; ListAlerts with filterCriteria.sloIds lists them. With force, the alerts are not changed: the SLO's metrics stop being published, so they report their noData state (NODATA by default) until they are deleted or pointed at another SLO.

Parameters:

  • space_id (SpaceId) –

    The unique ID of the space that owns the SLO.

  • slo_id (SloId) –

    The SLO to delete.

  • force (Optional[bool], default: None ) –

    Delete the SLO even when alerts reference it. Those alerts go to their noData state. Defaults to false.

Raises:

Examples:

Delete an SLO The following example deletes an SLO that no alert references. Deleting an SLO that has already been removed succeeds without error. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.delete_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='9f8e7d6c5b4a49382716051a2b3c4d5e')
Delete an SLO that alerts reference
The following example deletes an SLO even though alerts reference it. Because force is true, the delete succeeds; without force, it would fail with a ConflictException. The referencing alerts are not changed: they report their noData state until they are deleted or pointed at another SLO. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> await client.delete_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='7a6b5c4d3e2f41a0b9c8d7e6f5a4b3c2', force=True)
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def delete_omni_slo(
    self,
    space_id: "capo_cloudwatchomni.types.space_id.SpaceId",
    slo_id: "capo_cloudwatchomni.types.slo_id.SloId",
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    force: Optional[bool] = None,
) -> "capo_cloudwatchomni.types.delete_omni_slo_output.DeleteOmniSloOutput":
    """Deletes an SLO by its identifier and stops its evaluation. Idempotent: deleting an SLO that has already been removed succeeds without error. An SLO that alerts reference is refused with a ConflictException (conflictType RESOURCE_IN_USE) unless force is true. The error does not name the alerts; ListAlerts with filterCriteria.sloIds lists them. With force, the alerts are not changed: the SLO's metrics stop being published, so they report their noData state (NODATA by default) until they are deleted or pointed at another SLO.

    Args:
        space_id: The unique ID of the space that owns the SLO.
        slo_id: The SLO to delete.
        force: Delete the SLO even when alerts reference it. Those alerts go to their noData state. Defaults to false.

    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.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:
        Delete an SLO
        The following example deletes an SLO that no alert references. Deleting an SLO that has already been removed succeeds without error. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.delete_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='9f8e7d6c5b4a49382716051a2b3c4d5e')
        Delete an SLO that alerts reference
        The following example deletes an SLO even though alerts reference it. Because force is true, the delete succeeds; without force, it would fail with a ConflictException. The referencing alerts are not changed: they report their noData state until they are deleted or pointed at another SLO. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.delete_omni_slo(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', slo_id='7a6b5c4d3e2f41a0b9c8d7e6f5a4b3c2', force=True)
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.delete_omni_slo_input.DeleteOmniSloInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.delete_omni_slo_output.DeleteOmniSloOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.delete_omni_slo

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteOmniSlo")
    )
    input_: capo_cloudwatchomni.types.delete_omni_slo_input.DeleteOmniSloInput = {
        "space_id": space_id,
        "slo_id": slo_id,
    }
    if force is not None:
        input_["force"] = force

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