Skip to content

update_rule

update_rule(
    rule_id: RuleId,
    instance_id: InstanceId,
    name: RuleName,
    function: RuleFunction,
    actions: RuleActions,
    publish_status: RulePublishStatus,
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    pre_evaluation_filters: Optional[PreEvaluationFilters] = None,
) -> None

Updates a rule for the specified Connect Customer instance.

Use the Rules Function language to code conditions for the rule.

Parameters:

  • rule_id (RuleId) –

    A unique identifier for the rule.

  • instance_id (InstanceId) –

    The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • name (RuleName) –

    The name of the rule. You can change the name only if TriggerEventSource is one of the following values: OnZendeskTicketCreate | OnZendeskTicketStatusUpdate | OnSalesforceCaseCreate

  • function (RuleFunction) –

    The conditions of the rule.

  • actions (RuleActions) –

    A list of actions to be run when the rule is triggered.

  • publish_status (RulePublishStatus) –

    The publish status of the rule.

  • pre_evaluation_filters (Optional[PreEvaluationFilters], default: None ) –

    The pre-evaluation filters for the rule, that restrict the rule to be applied to only certain resources based on the resource's attributes, such as tags assigned to a contact. The pre-evaluation filters are applied even before rule conditions are evaluated and are used to enforce tag-based-access-control while applying rules.

Raises:

Source code in docs_src/capo_connect/_services/connect.py
def update_rule(
    self,
    rule_id: "capo_connect.types.rule_id.RuleId",
    instance_id: "capo_connect.types.instance_id.InstanceId",
    name: "capo_connect.types.rule_name.RuleName",
    function: "capo_connect.types.rule_function.RuleFunction",
    actions: "capo_connect.types.rule_actions.RuleActions",
    publish_status: "capo_connect.types.rule_publish_status.RulePublishStatus",
    *,
    config_overrides: Optional[ConnectClientConfig] = None,
    pre_evaluation_filters: Optional[
        "capo_connect.types.pre_evaluation_filters.PreEvaluationFilters"
    ] = None,
) -> None:
    """<p>Updates a rule for the specified Connect Customer instance.</p> <p>Use the <a href="https://docs.aws.amazon.com/connect/latest/APIReference/connect-rules-language.html">Rules Function language</a> to code conditions for the rule. </p>

    Args:
        rule_id: <p>A unique identifier for the rule.</p>
        instance_id: <p>The identifier of the Connect Customer instance. You can <a href="https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html">find the instance ID</a> in the Amazon Resource Name (ARN) of the instance.</p>
        name: <p>The name of the rule. You can change the name only if <code>TriggerEventSource</code> is one of the following values: <code>OnZendeskTicketCreate</code> | <code>OnZendeskTicketStatusUpdate</code> | <code>OnSalesforceCaseCreate</code> </p>
        function: <p>The conditions of the rule.</p>
        actions: <p>A list of actions to be run when the rule is triggered.</p>
        publish_status: <p>The publish status of the rule.</p>
        pre_evaluation_filters: <p>The pre-evaluation filters for the rule, that restrict the rule to be applied to only certain resources based on the resource's attributes, such as tags assigned to a contact. The pre-evaluation filters are applied even before rule conditions are evaluated and are used to enforce tag-based-access-control while applying rules.</p>

    Raises:
        capo_connect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action.</p>
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.resource_conflict_exception.ResourceConflictException: <p>A resource already has that name.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_connect.types.update_rule_request.UpdateRuleRequest]",
    ) -> OperationResponse[None]:
        import capo_connect._operations.amazon_connect_service.update_rule

        output, http_response = (
            capo_connect._operations.amazon_connect_service.update_rule.update_rule(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateRule")
    )
    input_: capo_connect.types.update_rule_request.UpdateRuleRequest = {
        "rule_id": rule_id,
        "instance_id": instance_id,
        "name": name,
        "function": function,
        "actions": actions,
        "publish_status": publish_status,
    }
    if pre_evaluation_filters is not None:
        input_["pre_evaluation_filters"] = pre_evaluation_filters

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