Skip to content

update_notification_rule

update_notification_rule(
    arn: NotificationRuleArn,
    *,
    config_overrides: Optional[codestarnotificationsClientConfig] = None,
    name: Optional[NotificationRuleName] = None,
    status: Optional[NotificationRuleStatus] = None,
    event_type_ids: Optional[EventTypeIds] = None,
    targets: Optional[Targets] = None,
    detail_type: Optional[DetailType] = None,
) -> UpdateNotificationRuleResult

Updates a notification rule for a resource. You can change the events that trigger the notification rule, the status of the rule, and the targets that receive the notifications.

To add or remove tags for a notification rule, you must use TagResource and UntagResource.

Parameters:

  • arn (NotificationRuleArn) –

    The Amazon Resource Name (ARN) of the notification rule.

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

    The name of the notification rule.

  • status (Optional[NotificationRuleStatus], default: None ) –

    The status of the notification rule. Valid statuses include enabled (sending notifications) or disabled (not sending notifications).

  • event_type_ids (Optional[EventTypeIds], default: None ) –

    A list of event types associated with this notification rule. For a complete list of event types and IDs, see Notification concepts in the Developer Tools Console User Guide.

  • targets (Optional[Targets], default: None ) –

    The address and type of the targets to receive notifications from this notification rule.

  • detail_type (Optional[DetailType], default: None ) –

    The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in Amazon CloudWatch. FULL will include any supplemental information provided by CodeStar Notifications and/or the service for the resource for which the notification is created.

Raises:

Source code in docs_src/capo_codestar_notifications/_services/codestarnotifications.py
def update_notification_rule(
    self,
    arn: "capo_codestar_notifications.types.notification_rule_arn.NotificationRuleArn",
    *,
    config_overrides: Optional[codestarnotificationsClientConfig] = None,
    name: Optional[
        "capo_codestar_notifications.types.notification_rule_name.NotificationRuleName"
    ] = None,
    status: Optional[
        "capo_codestar_notifications.types.notification_rule_status.NotificationRuleStatus"
    ] = None,
    event_type_ids: Optional[
        "capo_codestar_notifications.types.event_type_ids.EventTypeIds"
    ] = None,
    targets: Optional["capo_codestar_notifications.types.targets.Targets"] = None,
    detail_type: Optional[
        "capo_codestar_notifications.types.detail_type.DetailType"
    ] = None,
) -> "capo_codestar_notifications.types.update_notification_rule_result.UpdateNotificationRuleResult":
    """<p>Updates a notification rule for a resource. You can change the events that trigger the notification rule, the status of the rule, and the targets that receive the notifications.</p> <note> <p>To add or remove tags for a notification rule, you must use <a>TagResource</a> and <a>UntagResource</a>.</p> </note>

    Args:
        arn: <p>The Amazon Resource Name (ARN) of the notification rule.</p>
        name: <p>The name of the notification rule.</p>
        status: <p>The status of the notification rule. Valid statuses include enabled (sending notifications) or disabled (not sending notifications).</p>
        event_type_ids: <p>A list of event types associated with this notification rule. For a complete list of event types and IDs, see <a href="https://docs.aws.amazon.com/codestar-notifications/latest/userguide/concepts.html#concepts-api">Notification concepts</a> in the <i>Developer Tools Console User Guide</i>.</p>
        targets: <p>The address and type of the targets to receive notifications from this notification rule.</p>
        detail_type: <p>The level of detail to include in the notifications for this resource. BASIC will include only the contents of the event as it would appear in Amazon CloudWatch. FULL will include any supplemental information provided by CodeStar Notifications and/or the service for the resource for which the notification is created.</p>

    Raises:
        capo_codestar_notifications.errors.configuration_exception.ConfigurationException: <p>Some or all of the configuration is incomplete, missing, or not valid.</p>
        capo_codestar_notifications.errors.resource_not_found_exception.ResourceNotFoundException: <p>CodeStar Notifications can't find a resource that matches the provided ARN. </p>
        capo_codestar_notifications.errors.validation_exception.ValidationException: <p>One or more parameter values are not valid.</p>
        capo_codestar_notifications.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_codestar_notifications.types.update_notification_rule_request.UpdateNotificationRuleRequest]",
    ) -> OperationResponse[
        "capo_codestar_notifications.types.update_notification_rule_result.UpdateNotificationRuleResult"
    ]:
        import capo_codestar_notifications._operations.code_star_notifications_20191015.update_notification_rule

        output, http_response = (
            capo_codestar_notifications._operations.code_star_notifications_20191015.update_notification_rule.update_notification_rule(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_codestar_notifications.types.update_notification_rule_request.UpdateNotificationRuleRequest",
    ) -> dict[str, Any]:
        import capo_codestar_notifications.types.update_notification_rule_request

        return capo_codestar_notifications.types.update_notification_rule_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateNotificationRule", redact_input=_redact_input),
    )
    input_: capo_codestar_notifications.types.update_notification_rule_request.UpdateNotificationRuleRequest = {
        "arn": arn
    }
    if name is not None:
        input_["name"] = name
    if status is not None:
        input_["status"] = status
    if event_type_ids is not None:
        input_["event_type_ids"] = event_type_ids
    if targets is not None:
        input_["targets"] = targets
    if detail_type is not None:
        input_["detail_type"] = detail_type

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