Skip to content

confirm_subscription

confirm_subscription(
    topic_arn: topicARN,
    token: token,
    *,
    config_overrides: Optional[SNSClientConfig] = None,
    authenticate_on_unsubscribe: Optional[authenticateOnUnsubscribe] = None,
) -> ConfirmSubscriptionResponse

Verifies an endpoint owner's intent to receive messages by validating the token sent to the endpoint by an earlier Subscribe action. If the token is valid, the action creates a new subscription and returns its Amazon Resource Name (ARN). This call requires an AWS signature only when the AuthenticateOnUnsubscribe flag is set to "true".

Parameters:

  • topic_arn (topicARN) –

    The ARN of the topic for which you wish to confirm a subscription.

  • token (token) –

    Short-lived token sent to an endpoint during the Subscribe action.

  • authenticate_on_unsubscribe (Optional[authenticateOnUnsubscribe], default: None ) –

    Disallows unauthenticated unsubscribes of the subscription. If the value of this parameter is true and the request has an Amazon Web Services signature, then only the topic owner and the subscription owner can unsubscribe the endpoint. The unsubscribe action requires Amazon Web Services authentication.

Raises:

Source code in docs_src/capo_sns/_services/sns.py
def confirm_subscription(
    self,
    topic_arn: "capo_sns.types.topic_arn.topicARN",
    token: "capo_sns.types.token.token",
    *,
    config_overrides: Optional[SNSClientConfig] = None,
    authenticate_on_unsubscribe: Optional[
        "capo_sns.types.authenticate_on_unsubscribe.authenticateOnUnsubscribe"
    ] = None,
) -> "capo_sns.types.confirm_subscription_response.ConfirmSubscriptionResponse":
    """<p>Verifies an endpoint owner's intent to receive messages by validating the token sent to the endpoint by an earlier <code>Subscribe</code> action. If the token is valid, the action creates a new subscription and returns its Amazon Resource Name (ARN). This call requires an AWS signature only when the <code>AuthenticateOnUnsubscribe</code> flag is set to "true".</p>

    Args:
        topic_arn: <p>The ARN of the topic for which you wish to confirm a subscription.</p>
        token: <p>Short-lived token sent to an endpoint during the <code>Subscribe</code> action.</p>
        authenticate_on_unsubscribe: <p>Disallows unauthenticated unsubscribes of the subscription. If the value of this parameter is <code>true</code> and the request has an Amazon Web Services signature, then only the topic owner and the subscription owner can unsubscribe the endpoint. The unsubscribe action requires Amazon Web Services authentication. </p>

    Raises:
        capo_sns.errors.authorization_error_exception.AuthorizationErrorException: <p>Indicates that the user has been denied access to the requested resource.</p>
        capo_sns.errors.filter_policy_limit_exceeded_exception.FilterPolicyLimitExceededException: <p>Indicates that the number of filter polices in your Amazon Web Services account exceeds the limit. To add more filter polices, submit an Amazon SNS Limit Increase case in the Amazon Web Services Support Center.</p>
        capo_sns.errors.internal_error_exception.InternalErrorException: <p>Indicates an internal service error.</p>
        capo_sns.errors.invalid_parameter_exception.InvalidParameterException: <p>Indicates that a request parameter does not comply with the associated constraints.</p>
        capo_sns.errors.not_found_exception.NotFoundException: <p>Indicates that the requested resource does not exist.</p>
        capo_sns.errors.replay_limit_exceeded_exception.ReplayLimitExceededException: <p>Indicates that the request parameter has exceeded the maximum number of concurrent message replays.</p>
        capo_sns.errors.subscription_limit_exceeded_exception.SubscriptionLimitExceededException: <p>Indicates that the customer already owns the maximum allowed number of subscriptions.</p>
        capo_sns.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_sns.types.confirm_subscription_input.ConfirmSubscriptionInput]",
    ) -> OperationResponse[
        "capo_sns.types.confirm_subscription_response.ConfirmSubscriptionResponse"
    ]:
        import capo_sns._operations.amazon_simple_notification_service.confirm_subscription

        output, http_response = (
            capo_sns._operations.amazon_simple_notification_service.confirm_subscription.confirm_subscription(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ConfirmSubscription")
    )
    input_: capo_sns.types.confirm_subscription_input.ConfirmSubscriptionInput = {
        "topic_arn": topic_arn,
        "token": token,
    }
    if authenticate_on_unsubscribe is not None:
        input_["authenticate_on_unsubscribe"] = authenticate_on_unsubscribe

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