Skip to content

create_event_destination async

create_event_destination(
    configuration_set_name: ConfigurationSetNameOrArn,
    event_destination_name: EventDestinationName,
    matching_event_types: EventTypeList,
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    cloud_watch_logs_destination: Optional[CloudWatchLogsDestination] = None,
    kinesis_firehose_destination: Optional[KinesisFirehoseDestination] = None,
    sns_destination: Optional[SnsDestination] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateEventDestinationResult

Creates a new event destination in a configuration set.

An event destination is a location where you send message events. The event options are Amazon CloudWatch, Amazon Data Firehose, or Amazon SNS. For example, when a message is delivered successfully, you can send information about that event to an event destination, or send notifications to endpoints that are subscribed to an Amazon SNS topic.

You can only create one event destination at a time. You must provide a value for a single event destination using either CloudWatchLogsDestination, KinesisFirehoseDestination or SnsDestination. If an event destination isn't provided then an exception is returned.

Each configuration set can contain between 0 and 5 event destinations. Each event destination can contain a reference to a single destination, such as a CloudWatch or Firehose destination.

Parameters:

  • configuration_set_name (ConfigurationSetNameOrArn) –

    Either the name of the configuration set or the configuration set ARN to apply event logging to. The ConfigurateSetName and ConfigurationSetArn can be found using the DescribeConfigurationSets action.

  • event_destination_name (EventDestinationName) –

    The name that identifies the event destination.

  • matching_event_types (EventTypeList) –

    An array of event types that determine which events to log. If "ALL" is used, then End User Messaging SMS logs every event type.

    The TEXT_SENT event type is not supported.

  • cloud_watch_logs_destination (Optional[CloudWatchLogsDestination], default: None ) –

    An object that contains information about an event destination for logging to Amazon CloudWatch Logs.

  • kinesis_firehose_destination (Optional[KinesisFirehoseDestination], default: None ) –

    An object that contains information about an event destination for logging to Amazon Data Firehose.

  • sns_destination (Optional[SnsDestination], default: None ) –

    An object that contains information about an event destination for logging to Amazon SNS.

  • client_token (Optional[ClientToken], default: None ) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.

Raises:

  • AccessDeniedException –

    The request was denied because you don't have sufficient permissions to access the resource.

  • ConflictException –

    Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.

  • InternalServerException –

    The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.

  • ResourceNotFoundException –

    A requested resource couldn't be found.

  • ServiceQuotaExceededException –

    The request would cause a service quota to be exceeded.

  • ThrottlingException –

    An error that occurred because too many requests were sent during a certain amount of time.

  • ValidationException –

    A validation exception for a field.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_pinpoint_sms_voice_v2/_services/async_pinpoint_sms_voice_v2.py
async def create_event_destination(
    self,
    configuration_set_name: "capo_pinpoint_sms_voice_v2.types.configuration_set_name_or_arn.ConfigurationSetNameOrArn",
    event_destination_name: "capo_pinpoint_sms_voice_v2.types.event_destination_name.EventDestinationName",
    matching_event_types: "capo_pinpoint_sms_voice_v2.types.event_type_list.EventTypeList",
    *,
    config_overrides: Optional[AsyncPinpointSMSVoiceV2ClientConfig] = None,
    cloud_watch_logs_destination: Optional[
        "capo_pinpoint_sms_voice_v2.types.cloud_watch_logs_destination.CloudWatchLogsDestination"
    ] = None,
    kinesis_firehose_destination: Optional[
        "capo_pinpoint_sms_voice_v2.types.kinesis_firehose_destination.KinesisFirehoseDestination"
    ] = None,
    sns_destination: Optional[
        "capo_pinpoint_sms_voice_v2.types.sns_destination.SnsDestination"
    ] = None,
    client_token: Optional[
        "capo_pinpoint_sms_voice_v2.types.client_token.ClientToken"
    ] = None,
) -> "capo_pinpoint_sms_voice_v2.types.create_event_destination_result.CreateEventDestinationResult":
    """<p>Creates a new event destination in a configuration set.</p> <p>An event destination is a location where you send message events. The event options are Amazon CloudWatch, Amazon Data Firehose, or Amazon SNS. For example, when a message is delivered successfully, you can send information about that event to an event destination, or send notifications to endpoints that are subscribed to an Amazon SNS topic. </p> <p>You can only create one event destination at a time. You must provide a value for a single event destination using either <code>CloudWatchLogsDestination</code>, <code>KinesisFirehoseDestination</code> or <code>SnsDestination</code>. If an event destination isn't provided then an exception is returned.</p> <p>Each configuration set can contain between 0 and 5 event destinations. Each event destination can contain a reference to a single destination, such as a CloudWatch or Firehose destination.</p>

    Args:
        configuration_set_name: <p>Either the name of the configuration set or the configuration set ARN to apply event logging to. The ConfigurateSetName and ConfigurationSetArn can be found using the <a>DescribeConfigurationSets</a> action.</p>
        event_destination_name: <p>The name that identifies the event destination.</p>
        matching_event_types: <p>An array of event types that determine which events to log. If "ALL" is used, then End User Messaging SMS logs every event type.</p> <note> <p>The <code>TEXT_SENT</code> event type is not supported.</p> </note>
        cloud_watch_logs_destination: <p>An object that contains information about an event destination for logging to Amazon CloudWatch Logs.</p>
        kinesis_firehose_destination: <p>An object that contains information about an event destination for logging to Amazon Data Firehose.</p>
        sns_destination: <p>An object that contains information about an event destination for logging to Amazon SNS.</p>
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don't specify a client token, a randomly generated token is used for the request to ensure idempotency.</p>

    Raises:
        capo_pinpoint_sms_voice_v2.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because you don't have sufficient permissions to access the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.conflict_exception.ConflictException: <p>Your request has conflicting operations. This can occur if you're trying to perform more than one operation on the same resource at the same time or it could be that the requested action isn't valid for the current state or configuration of the resource.</p>
        capo_pinpoint_sms_voice_v2.errors.internal_server_exception.InternalServerException: <p>The API encountered an unexpected error and couldn't complete the request. You might be able to successfully issue the request again in the future.</p>
        capo_pinpoint_sms_voice_v2.errors.resource_not_found_exception.ResourceNotFoundException: <p>A requested resource couldn't be found.</p>
        capo_pinpoint_sms_voice_v2.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_pinpoint_sms_voice_v2.errors.throttling_exception.ThrottlingException: <p>An error that occurred because too many requests were sent during a certain amount of time.</p>
        capo_pinpoint_sms_voice_v2.errors.validation_exception.ValidationException: <p>A validation exception for a field.</p>
        capo_pinpoint_sms_voice_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_pinpoint_sms_voice_v2.types.create_event_destination_request.CreateEventDestinationRequest]",
    ) -> AsyncOperationResponse[
        "capo_pinpoint_sms_voice_v2.types.create_event_destination_result.CreateEventDestinationResult"
    ]:
        import capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.create_event_destination

        (
            output,
            http_response,
        ) = await capo_pinpoint_sms_voice_v2._operations.pinpoint_sms_voice_v2.create_event_destination.async_create_event_destination(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEventDestination")
    )
    input_: capo_pinpoint_sms_voice_v2.types.create_event_destination_request.CreateEventDestinationRequest = {
        "configuration_set_name": configuration_set_name,
        "event_destination_name": event_destination_name,
        "matching_event_types": matching_event_types,
    }
    if cloud_watch_logs_destination is not None:
        input_["cloud_watch_logs_destination"] = cloud_watch_logs_destination
    if kinesis_firehose_destination is not None:
        input_["kinesis_firehose_destination"] = kinesis_firehose_destination
    if sns_destination is not None:
        input_["sns_destination"] = sns_destination
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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