Skip to content

delete_topic async

delete_topic(
    cluster_arn: __string,
    topic_name: __string,
    *,
    config_overrides: Optional[AsyncKafkaClientConfig] = None,
) -> DeleteTopicResponse

Deletes a topic in the specified MSK cluster.

Parameters:

  • cluster_arn (__string) –

    The Amazon Resource Name (ARN) that uniquely identifies the cluster.

  • topic_name (__string) –

    The name of the topic to delete.

Raises:

Source code in docs_src/capo_kafka/_services/async_kafka.py
async def delete_topic(
    self,
    cluster_arn: "capo_kafka.types.__string.__string",
    topic_name: "capo_kafka.types.__string.__string",
    *,
    config_overrides: Optional[AsyncKafkaClientConfig] = None,
) -> "capo_kafka.types.delete_topic_response.DeleteTopicResponse":
    """<p>Deletes a topic in the specified MSK cluster.</p>

    Args:
        cluster_arn: <p>The Amazon Resource Name (ARN) that uniquely identifies the cluster.</p>
        topic_name: <p>The name of the topic to delete.</p>

    Raises:
        capo_kafka.errors.bad_request_exception.BadRequestException: <p>Returns information about an error.</p>
        capo_kafka.errors.cluster_connectivity_exception.ClusterConnectivityException: <p>Returns information about an error.</p>
        capo_kafka.errors.controller_moved_exception.ControllerMovedException: <p>Returns information about an error.</p>
        capo_kafka.errors.forbidden_exception.ForbiddenException: <p>Returns information about an error.</p>
        capo_kafka.errors.group_subscribed_to_topic_exception.GroupSubscribedToTopicException: <p>Returns information about an error.</p>
        capo_kafka.errors.internal_server_error_exception.InternalServerErrorException: <p>Returns information about an error.</p>
        capo_kafka.errors.kafka_request_exception.KafkaRequestException: <p>Returns information about an error.</p>
        capo_kafka.errors.kafka_timeout_exception.KafkaTimeoutException: <p>Returns information about an error.</p>
        capo_kafka.errors.not_controller_exception.NotControllerException: <p>Returns information about an error.</p>
        capo_kafka.errors.not_found_exception.NotFoundException: <p>Returns information about an error.</p>
        capo_kafka.errors.reassignment_in_progress_exception.ReassignmentInProgressException: <p>Returns information about an error.</p>
        capo_kafka.errors.unknown_topic_or_partition_exception.UnknownTopicOrPartitionException: <p>Returns information about an error.</p>
        capo_kafka.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_kafka.types.delete_topic_request.DeleteTopicRequest]",
    ) -> AsyncOperationResponse[
        "capo_kafka.types.delete_topic_response.DeleteTopicResponse"
    ]:
        import capo_kafka._operations.kafka.delete_topic

        (
            output,
            http_response,
        ) = await capo_kafka._operations.kafka.delete_topic.async_delete_topic(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteTopic")
    )
    input_: capo_kafka.types.delete_topic_request.DeleteTopicRequest = {
        "cluster_arn": cluster_arn,
        "topic_name": topic_name,
    }

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