Skip to content

register_notification_hub async

register_notification_hub(
    notification_hub_region: Region,
    *,
    config_overrides: Optional[AsyncNotificationsClientConfig] = None,
) -> RegisterNotificationHubResponse

Registers a NotificationHub in the specified Region.

There is a maximum of one NotificationHub per Region. You can have a maximum of 3 NotificationHub resources at a time.

Parameters:

  • notification_hub_region (Region) –

    The Region of the NotificationHub.

Raises:

Source code in docs_src/capo_notifications/_services/async_notifications.py
async def register_notification_hub(
    self,
    notification_hub_region: "capo_notifications.types.region.Region",
    *,
    config_overrides: Optional[AsyncNotificationsClientConfig] = None,
) -> "capo_notifications.types.register_notification_hub_response.RegisterNotificationHubResponse":
    """<p>Registers a <code>NotificationHub</code> in the specified Region.</p> <p>There is a maximum of one <code>NotificationHub</code> per Region. You can have a maximum of 3 <code>NotificationHub</code> resources at a time.</p>

    Args:
        notification_hub_region: <p>The Region of the <code>NotificationHub</code>.</p>

    Raises:
        capo_notifications.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_notifications.errors.conflict_exception.ConflictException: <p>Updating or deleting a resource can cause an inconsistent state.</p>
        capo_notifications.errors.internal_server_exception.InternalServerException: <p>Unexpected error during processing of request.</p>
        capo_notifications.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Request would cause a service quota to be exceeded.</p>
        capo_notifications.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling. </p>
        capo_notifications.errors.validation_exception.ValidationException: <p>This exception is thrown when the notification event fails validation.</p>
        capo_notifications.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_notifications.types.register_notification_hub_request.RegisterNotificationHubRequest]",
    ) -> AsyncOperationResponse[
        "capo_notifications.types.register_notification_hub_response.RegisterNotificationHubResponse"
    ]:
        import capo_notifications._operations.notifications.register_notification_hub

        (
            output,
            http_response,
        ) = await capo_notifications._operations.notifications.register_notification_hub.async_register_notification_hub(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("RegisterNotificationHub")
    )
    input_: capo_notifications.types.register_notification_hub_request.RegisterNotificationHubRequest = {
        "notification_hub_region": notification_hub_region
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output