This topic describes how to use SDK for Python to delete an event bus.

Sample code:

# -*- coding: utf-8 -*-

from alibabacloud_eventbridge.client import Client as EventBridgeClient
from alibabacloud_eventbridge import models as event_bridge_models
from alibabacloud_tea_console.client import Client as ConsoleClient
from alibabacloud_tea_util.client import Client as UtilClient


class delete_event_bus_sample(object):
    def __init__(self):
        pass

    @staticmethod
    def create_client():
        """
        Uses the create_client() function to initialize common request parameters.
        """
        config = event_bridge_models.Config(

        )
        # Your AccessKey ID.
        config.access_key_id = "<accessKeyId>"
        # Your AccessKey secret.
        config.access_key_secret = "<accessKeySecret>"
        # Your endpoint.
        config.endpoint = "<endpoint>"
        return EventBridgeClient(config)

    @staticmethod
    def delete_event_bus_sample(client):
        try:
            # delete
            delete_event_bus_request = event_bridge_models.DeleteEventBusRequest(

            )
            delete_event_bus_request.event_bus_name = "demo-bus"
            client.delete_event_bus(delete_event_bus_request)
            ConsoleClient.log("--------------------Delete bus success --------------------")
        except Exception as error:
            ConsoleClient.log(error.message)

    @staticmethod
    def main(args):
        client = delete_event_bus_sample.create_client()
        delete_event_bus_sample.delete_event_bus_sample(client)

delete_event_bus_sample.main("")