Skip to content

put_alert_manager_definition

put_alert_manager_definition(
    workspace_id: WorkspaceId,
    data: AlertManagerDefinitionData,
    *,
    config_overrides: Optional[ampClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
) -> PutAlertManagerDefinitionResponse

Updates an existing alert manager definition in a workspace. If the workspace does not already have an alert manager definition, don't use this operation to create it. Instead, use CreateAlertManagerDefinition.

Parameters:

  • workspace_id (WorkspaceId) –

    The ID of the workspace to update the alert manager definition in.

  • data (AlertManagerDefinitionData) –

    The alert manager definition to use. A base64-encoded version of the YAML alert manager definition file.

    For details about the alert manager definition, see AlertManagedDefinitionData.

  • client_token (Optional[IdempotencyToken], default: None ) –

    A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.

Raises:

Source code in docs_src/capo_amp/_services/amp.py
def put_alert_manager_definition(
    self,
    workspace_id: "capo_amp.types.workspace_id.WorkspaceId",
    data: "capo_amp.types.alert_manager_definition_data.AlertManagerDefinitionData",
    *,
    config_overrides: Optional[ampClientConfig] = None,
    client_token: Optional[
        "capo_amp.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_amp.types.put_alert_manager_definition_response.PutAlertManagerDefinitionResponse":
    """<p>Updates an existing alert manager definition in a workspace. If the workspace does not already have an alert manager definition, don't use this operation to create it. Instead, use <code>CreateAlertManagerDefinition</code>.</p>

    Args:
        workspace_id: <p>The ID of the workspace to update the alert manager definition in.</p>
        data: <p>The alert manager definition to use. A base64-encoded version of the YAML alert manager definition file.</p> <p>For details about the alert manager definition, see <a href="https://docs.aws.amazon.com/prometheus/latest/APIReference/yaml-AlertManagerDefinitionData.html">AlertManagedDefinitionData</a>.</p>
        client_token: <p>A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.</p>

    Raises:
        capo_amp.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_amp.errors.conflict_exception.ConflictException: <p>The request would cause an inconsistent state.</p>
        capo_amp.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_amp.errors.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resources that doesn't exist.</p>
        capo_amp.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Completing the request would cause a service quota to be exceeded.</p>
        capo_amp.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_amp.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_amp.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_amp.types.put_alert_manager_definition_request.PutAlertManagerDefinitionRequest]",
    ) -> OperationResponse[
        "capo_amp.types.put_alert_manager_definition_response.PutAlertManagerDefinitionResponse"
    ]:
        import capo_amp._operations.amazon_prometheus_service.put_alert_manager_definition

        output, http_response = (
            capo_amp._operations.amazon_prometheus_service.put_alert_manager_definition.put_alert_manager_definition(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutAlertManagerDefinition")
    )
    input_: capo_amp.types.put_alert_manager_definition_request.PutAlertManagerDefinitionRequest = {
        "workspace_id": workspace_id,
        "data": data,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output