Skip to content

create_notification_configuration async

create_notification_configuration(
    name: NotificationConfigurationName,
    description: NotificationConfigurationDescription,
    *,
    config_overrides: Optional[AsyncNotificationsClientConfig] = None,
    aggregation_duration: Optional[AggregationDuration] = None,
    tags: Optional[TagMap] = None,
) -> CreateNotificationConfigurationResponse

Creates a new NotificationConfiguration.

Parameters:

  • name (NotificationConfigurationName) –

    The name of the NotificationConfiguration. Supports RFC 3986's unreserved characters.

  • description (NotificationConfigurationDescription) –

    The description of the NotificationConfiguration.

  • aggregation_duration (Optional[AggregationDuration], default: None ) –

    The aggregation preference of the NotificationConfiguration.

    • Values:

      • LONG

        • Aggregate notifications for long periods of time (12 hours).

      • SHORT

        • Aggregate notifications for short periods of time (5 minutes).

      • NONE

        • Don't aggregate notifications.

  • tags (Optional[TagMap], default: None ) –

    A map of tags assigned to a resource. A tag is a string-to-string map of key-value pairs.

Raises:

Source code in docs_src/capo_notifications/_services/async_notifications.py
async def create_notification_configuration(
    self,
    name: "capo_notifications.types.notification_configuration_name.NotificationConfigurationName",
    description: "capo_notifications.types.notification_configuration_description.NotificationConfigurationDescription",
    *,
    config_overrides: Optional[AsyncNotificationsClientConfig] = None,
    aggregation_duration: Optional[
        "capo_notifications.types.aggregation_duration.AggregationDuration"
    ] = None,
    tags: Optional["capo_notifications.types.tag_map.TagMap"] = None,
) -> "capo_notifications.types.create_notification_configuration_response.CreateNotificationConfigurationResponse":
    """<p>Creates a new <code>NotificationConfiguration</code>.</p>

    Args:
        name: <p>The name of the <code>NotificationConfiguration</code>. Supports RFC 3986's unreserved characters.</p>
        description: <p>The description of the <code>NotificationConfiguration</code>.</p>
        aggregation_duration: <p>The aggregation preference of the <code>NotificationConfiguration</code>.</p> <ul> <li> <p>Values:</p> <ul> <li> <p> <code>LONG</code> </p> <ul> <li> <p>Aggregate notifications for long periods of time (12 hours).</p> </li> </ul> </li> <li> <p> <code>SHORT</code> </p> <ul> <li> <p>Aggregate notifications for short periods of time (5 minutes).</p> </li> </ul> </li> <li> <p> <code>NONE</code> </p> <ul> <li> <p>Don't aggregate notifications.</p> </li> </ul> </li> </ul> </li> </ul>
        tags: <p>A map of tags assigned to a resource. A tag is a string-to-string map of key-value pairs.</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.create_notification_configuration_request.CreateNotificationConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_notifications.types.create_notification_configuration_response.CreateNotificationConfigurationResponse"
    ]:
        import capo_notifications._operations.notifications.create_notification_configuration

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateNotificationConfiguration")
    )
    input_: capo_notifications.types.create_notification_configuration_request.CreateNotificationConfigurationRequest = {
        "name": name,
        "description": description,
    }
    if aggregation_duration is not None:
        input_["aggregation_duration"] = aggregation_duration
    if tags is not None:
        input_["tags"] = tags

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