Skip to content

subscribe

subscribe(
    arn: NotificationRuleArn,
    target: Target,
    *,
    config_overrides: Optional[codestarnotificationsClientConfig] = None,
    client_request_token: Optional[ClientRequestToken] = None,
) -> SubscribeResult

Creates an association between a notification rule and an Amazon Q Developer in chat applications topic or Amazon Q Developer in chat applications client so that the associated target can receive notifications when the events described in the rule are triggered.

Parameters:

  • arn (NotificationRuleArn) –

    The Amazon Resource Name (ARN) of the notification rule for which you want to create the association.

  • client_request_token (Optional[ClientRequestToken], default: None ) –

    An enumeration token that, when provided in a request, returns the next batch of the results.

Raises:

Source code in docs_src/capo_codestar_notifications/_services/codestarnotifications.py
def subscribe(
    self,
    arn: "capo_codestar_notifications.types.notification_rule_arn.NotificationRuleArn",
    target: "capo_codestar_notifications.types.target.Target",
    *,
    config_overrides: Optional[codestarnotificationsClientConfig] = None,
    client_request_token: Optional[
        "capo_codestar_notifications.types.client_request_token.ClientRequestToken"
    ] = None,
) -> "capo_codestar_notifications.types.subscribe_result.SubscribeResult":
    """<p>Creates an association between a notification rule and an Amazon Q Developer in chat applications topic or Amazon Q Developer in chat applications client so that the associated target can receive notifications when the events described in the rule are triggered.</p>

    Args:
        arn: <p>The Amazon Resource Name (ARN) of the notification rule for which you want to create the association.</p>
        client_request_token: <p>An enumeration token that, when provided in a request, returns the next batch of the results.</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.subscribe_request.SubscribeRequest]",
    ) -> OperationResponse[
        "capo_codestar_notifications.types.subscribe_result.SubscribeResult"
    ]:
        import capo_codestar_notifications._operations.code_star_notifications_20191015.subscribe

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

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

        return capo_codestar_notifications.types.subscribe_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("Subscribe", redact_input=_redact_input)
    )
    input_: capo_codestar_notifications.types.subscribe_request.SubscribeRequest = {
        "arn": arn,
        "target": target,
    }
    if client_request_token is not None:
        input_["client_request_token"] = client_request_token

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