Skip to content

create_subscriber

create_subscriber(
    name: SubscriberName,
    event_bus_arn: EventBusArn,
    invoke_configuration: InvokeConfiguration,
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    description: Optional[Description] = None,
    filter_configuration: Optional[FilterConfiguration] = None,
    type: Optional[OrderingType] = None,
    starting_position: Optional[StartingPosition] = None,
    point_in_time_configuration: Optional[PointInTimeConfiguration] = None,
    batch_configuration: Optional[BatchConfiguration] = None,
    transformer: Optional[Transformer] = None,
    retry_policy: Optional[RetryPolicy] = None,
    on_failure_configuration: Optional[OnFailureConfiguration] = None,
    log_configuration: Optional[LogConfiguration] = None,
    state: Optional[SubscriberState] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateSubscriberResponse

Creates a subscriber on an event bus, which delivers matching events to the configured target. The bus must be ACTIVE. Retries carrying the same ClientToken are idempotent. A subscriber that targets an Amazon MSK cluster provisions its connectivity asynchronously after this call returns and begins delivering when its ConnectivityState reaches ACTIVE (see the MskSubscriberActive waiter).

Parameters:

  • name (SubscriberName) –

    Name of a subscriber. The first character must be alphanumeric; the remaining characters may also include '.', '-', and '_'.

  • event_bus_arn (EventBusArn) –

    The Amazon Resource Name (ARN) that uniquely identifies an event bus.

  • invoke_configuration (InvokeConfiguration) –

    Configuration for how the subscriber invokes its target.

  • description (Optional[Description], default: None ) –

    Free-text description. Used by every resource type that has one: event buses, subscribers, and event sources.

  • filter_configuration (Optional[FilterConfiguration], default: None ) –

    Configuration for filtering events delivered to a subscriber. On CreateSubscriber, Filters is required and must contain at least one Filter with a non-empty Pattern. On UpdateSubscriber, an empty FilterConfiguration:{} clears the existing filter. Any non-empty shape (including {Language:X} without Filters) must contain a valid Filters list — same contract as CreateSubscriber. A non-empty Filters list overwrites; an omitted FilterConfiguration preserves existing state. All Filters are implicitly ANDed — an event must match every Filter to be delivered.

  • type (Optional[OrderingType], default: None ) –

    Delivery ordering mode of a subscriber: FIFO delivers events in order within an event group; UNORDERED delivers without an ordering guarantee.

  • starting_position (Optional[StartingPosition], default: None ) –

    Starting position for a subscriber.

  • point_in_time_configuration (Optional[PointInTimeConfiguration], default: None ) –

    Point-in-time configuration for a subscriber. Only applicable when StartingPosition is POINT_IN_TIME.

  • batch_configuration (Optional[BatchConfiguration], default: None ) –

    Batching configuration for a subscriber.

  • transformer (Optional[Transformer], default: None ) –

    Transformer configuration for a subscriber.

  • retry_policy (Optional[RetryPolicy], default: None ) –

    Retry policy for a subscriber.

  • on_failure_configuration (Optional[OnFailureConfiguration], default: None ) –

    On-failure configuration: where a failed delivery is sent. Shared by the subscriber and the EventSource.

  • log_configuration (Optional[LogConfiguration], default: None ) –

    Log configuration for a subscriber.

  • state (Optional[SubscriberState], default: None ) –

    Customer-controlled run state of a subscriber, set on create or update. Distinct from the bus lifecycle vocabulary, where ACTIVE means "provisioned and healthy". Delivery requires State RUNNING on a subscriber that is not revoked.

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

    Tags attached to a resource, as key-value pairs.

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

    Unique, case-sensitive identifier that ensures the idempotency of the request. The SDK generates one automatically when the field is omitted.

Raises:

Source code in docs_src/capo_eventbridgev2/_services/event_bridge_v2.py
def create_subscriber(
    self,
    name: "capo_eventbridgev2.types.subscriber_name.SubscriberName",
    event_bus_arn: "capo_eventbridgev2.types.event_bus_arn.EventBusArn",
    invoke_configuration: "capo_eventbridgev2.types.invoke_configuration.InvokeConfiguration",
    *,
    config_overrides: Optional[EventBridgeV2ClientConfig] = None,
    description: Optional[
        "capo_eventbridgev2.types.description.Description"
    ] = None,
    filter_configuration: Optional[
        "capo_eventbridgev2.types.filter_configuration.FilterConfiguration"
    ] = None,
    type: Optional["capo_eventbridgev2.types.ordering_type.OrderingType"] = None,
    starting_position: Optional[
        "capo_eventbridgev2.types.starting_position.StartingPosition"
    ] = None,
    point_in_time_configuration: Optional[
        "capo_eventbridgev2.types.point_in_time_configuration.PointInTimeConfiguration"
    ] = None,
    batch_configuration: Optional[
        "capo_eventbridgev2.types.batch_configuration.BatchConfiguration"
    ] = None,
    transformer: Optional[
        "capo_eventbridgev2.types.transformer.Transformer"
    ] = None,
    retry_policy: Optional[
        "capo_eventbridgev2.types.retry_policy.RetryPolicy"
    ] = None,
    on_failure_configuration: Optional[
        "capo_eventbridgev2.types.on_failure_configuration.OnFailureConfiguration"
    ] = None,
    log_configuration: Optional[
        "capo_eventbridgev2.types.log_configuration.LogConfiguration"
    ] = None,
    state: Optional[
        "capo_eventbridgev2.types.subscriber_state.SubscriberState"
    ] = None,
    tags: Optional["capo_eventbridgev2.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_eventbridgev2.types.client_token.ClientToken"
    ] = None,
) -> "capo_eventbridgev2.types.create_subscriber_response.CreateSubscriberResponse":
    """<p>Creates a subscriber on an event bus, which delivers matching events to the configured target. The bus must be ACTIVE. Retries carrying the same ClientToken are idempotent. A subscriber that targets an Amazon MSK cluster provisions its connectivity asynchronously after this call returns and begins delivering when its ConnectivityState reaches ACTIVE (see the MskSubscriberActive waiter).</p>

    Args:
        name: <p>Name of a subscriber. The first character must be alphanumeric; the remaining characters may also include '.', '-', and '_'.</p>
        event_bus_arn: <p>The Amazon Resource Name (ARN) that uniquely identifies an event bus.</p>
        invoke_configuration: <p>Configuration for how the subscriber invokes its target.</p>
        description: <p>Free-text description. Used by every resource type that has one: event buses, subscribers, and event sources.</p>
        filter_configuration: <p>Configuration for filtering events delivered to a subscriber. On CreateSubscriber, Filters is required and must contain at least one Filter with a non-empty Pattern. On UpdateSubscriber, an empty <code>FilterConfiguration:{}</code> clears the existing filter. Any non-empty shape (including <code>{Language:X}</code> without Filters) must contain a valid Filters list — same contract as CreateSubscriber. A non-empty Filters list overwrites; an omitted FilterConfiguration preserves existing state. All Filters are implicitly ANDed — an event must match every Filter to be delivered.</p>
        type: <p>Delivery ordering mode of a subscriber: FIFO delivers events in order within an event group; UNORDERED delivers without an ordering guarantee.</p>
        starting_position: <p>Starting position for a subscriber.</p>
        point_in_time_configuration: <p>Point-in-time configuration for a subscriber. Only applicable when StartingPosition is POINT_IN_TIME.</p>
        batch_configuration: <p>Batching configuration for a subscriber.</p>
        transformer: <p>Transformer configuration for a subscriber.</p>
        retry_policy: <p>Retry policy for a subscriber.</p>
        on_failure_configuration: <p>On-failure configuration: where a failed delivery is sent. Shared by the subscriber and the EventSource.</p>
        log_configuration: <p>Log configuration for a subscriber.</p>
        state: <p>Customer-controlled run state of a subscriber, set on create or update. Distinct from the bus lifecycle vocabulary, where ACTIVE means "provisioned and healthy". Delivery requires State RUNNING on a subscriber that is not revoked.</p>
        tags: <p>Tags attached to a resource, as key-value pairs.</p>
        client_token: <p>Unique, case-sensitive identifier that ensures the idempotency of the request. The SDK generates one automatically when the field is omitted.</p>

    Raises:
        capo_eventbridgev2.errors.access_denied_exception.AccessDeniedException: <p>The caller does not have the permissions required to perform the operation. This error is also returned when the operation cannot use the AWS KMS key for the event bus.</p>
        capo_eventbridgev2.errors.internal_exception.InternalException: <p>The request failed because of an internal service error. Retry the request.</p>
        capo_eventbridgev2.errors.invalid_input_exception.InvalidInputException: <p>A request parameter is missing or not valid.</p>
        capo_eventbridgev2.errors.throttling_exception.ThrottlingException: <p>The request was throttled because it exceeds a request rate limit. Retry the request with backoff.</p>
        capo_eventbridgev2.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another change to the resource is already in progress. Retry the request.</p>
        capo_eventbridgev2.errors.idempotent_parameter_mismatch_exception.IdempotentParameterMismatchException: <p>The request reuses the client token of an earlier request with different parameters. Use a new client token, or resend the earlier request unchanged.</p>
        capo_eventbridgev2.errors.invalid_state_exception.InvalidStateException: <p>The resource is not in a state that allows the operation. For example, an event bus that is still being created cannot accept events.</p>
        capo_eventbridgev2.errors.limit_exceeded_exception.LimitExceededException: <p>The request would exceed a service quota for the account.</p>
        capo_eventbridgev2.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>A resource with the same name already exists.</p>
        capo_eventbridgev2.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource does not exist.</p>
        capo_eventbridgev2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_eventbridgev2.types.create_subscriber_request.CreateSubscriberRequest]",
    ) -> OperationResponse[
        "capo_eventbridgev2.types.create_subscriber_response.CreateSubscriberResponse"
    ]:
        import capo_eventbridgev2._operations.aws_events_v2.create_subscriber

        output, http_response = (
            capo_eventbridgev2._operations.aws_events_v2.create_subscriber.create_subscriber(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_eventbridgev2.types.create_subscriber_request.CreateSubscriberRequest",
    ) -> dict[str, Any]:
        import capo_eventbridgev2.types.create_subscriber_request

        return capo_eventbridgev2.types.create_subscriber_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateSubscriber", redact_input=_redact_input),
    )
    input_: capo_eventbridgev2.types.create_subscriber_request.CreateSubscriberRequest = {
        "name": name,
        "event_bus_arn": event_bus_arn,
        "invoke_configuration": invoke_configuration,
    }
    if description is not None:
        input_["description"] = description
    if filter_configuration is not None:
        input_["filter_configuration"] = filter_configuration
    if type is not None:
        input_["type"] = type
    if starting_position is not None:
        input_["starting_position"] = starting_position
    if point_in_time_configuration is not None:
        input_["point_in_time_configuration"] = point_in_time_configuration
    if batch_configuration is not None:
        input_["batch_configuration"] = batch_configuration
    if transformer is not None:
        input_["transformer"] = transformer
    if retry_policy is not None:
        input_["retry_policy"] = retry_policy
    if on_failure_configuration is not None:
        input_["on_failure_configuration"] = on_failure_configuration
    if log_configuration is not None:
        input_["log_configuration"] = log_configuration
    if state is not None:
        input_["state"] = state
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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