Skip to content

Protobuf definition:

syntax = "proto3";
package broker.mqtt.admin;
service MQTTBrokerAdminService {
    // cluster
    rpc cluster_status(ClusterStatusRequest) returns(ClusterStatusReply){}

    // user
    rpc mqtt_broker_create_user(CreateUserRequest) returns(CreateUserReply){}

    rpc mqtt_broker_delete_user(DeleteUserRequest) returns(DeleteUserReply){}

    rpc mqtt_broker_list_user(ListUserRequest) returns(ListUserReply){}

    // acl
    rpc mqtt_broker_list_acl(ListAclRequest) returns(ListAclReply){}

    rpc mqtt_broker_create_acl(CreateAclRequest) returns(CreateAclReply){}

    rpc mqtt_broker_delete_acl(DeleteAclRequest) returns(DeleteAclReply){}

    // blacklist
    rpc mqtt_broker_list_blacklist(ListBlacklistRequest) returns(ListBlacklistReply) {}

    rpc mqtt_broker_delete_blacklist(DeleteBlacklistRequest) returns(DeleteBlacklistReply) {}

    rpc mqtt_broker_create_blacklist(CreateBlacklistRequest) returns(CreateBlacklistReply) {}

    // flapping detect
    rpc mqtt_broker_enable_flapping_detect(EnableFlappingDetectRequest) returns(EnableFlappingDetectReply) {}

    // connection
    rpc mqtt_broker_list_connection(ListConnectionRequest) returns(ListConnectionReply){}

    // observability: slow-sub
    rpc mqtt_broker_enable_slow_subscribe(EnableSlowSubscribeRequest) returns(EnableSlowSubScribeReply) {}
    rpc mqtt_broker_list_slow_subscribe(ListSlowSubscribeRequest) returns(ListSlowSubscribeReply){}
    rpc mqtt_broker_list_topic(ListTopicRequest) returns(ListTopicReply){}

    // topic rewrite rule
    rpc mqtt_broker_delete_topic_rewrite_rule(DeleteTopicRewriteRuleRequest) returns(DeleteTopicRewriteRuleReply) {}
    rpc mqtt_broker_create_topic_rewrite_rule(CreateTopicRewriteRuleRequest) returns(CreateTopicRewriteRuleReply) {}

    // connector
    rpc mqtt_broker_list_connector(MqttListConnectorRequest) returns(MqttListConnectorReply){}
    rpc mqtt_broker_create_connector(MqttCreateConnectorRequest) returns(MqttCreateConnectorReply){}
    rpc mqtt_broker_delete_connector(MqttDeleteConnectorRequest) returns(MqttDeleteConnectorReply){}
    rpc mqtt_broker_update_connector(MqttUpdateConnectorRequest) returns(MqttUpdateConnectorReply){}

    // schema
    rpc mqtt_broker_list_schema(MqttListSchemaRequest) returns(MqttListSchemaReply){}
    rpc mqtt_broker_create_schema(MqttCreateSchemaRequest) returns(MqttCreateSchemaReply){}
    rpc mqtt_broker_update_schema(MqttUpdateSchemaRequest) returns(MqttUpdateSchemaReply){}
    rpc mqtt_broker_delete_schema(MqttDeleteSchemaRequest) returns(MqttDeleteSchemaReply){}
    rpc mqtt_broker_list_bind_schema(MqttListBindSchemaRequest) returns(MqttListBindSchemaReply){}
    rpc mqtt_broker_bind_schema(MqttBindSchemaRequest) returns(MqttBindSchemaReply){}
    rpc mqtt_broker_unbind_schema(MqttUnbindSchemaRequest) returns(MqttUnbindSchemaReply){}
}

// --------- cluster --------
message ClusterStatusRequest {

}
message ClusterStatusReply {
    string cluster_name = 1;
    repeated string nodes = 2;
}

// --------- user --------
message ListUserRequest {

}

message ListUserReply {
    repeated bytes users = 1;
}

message CreateUserRequest {
    string username = 1;

    string password = 2;

    bool is_superuser = 3;
}

message CreateUserReply {

}

message DeleteUserRequest {
    string username = 1;
}

message DeleteUserReply {

}

// --------- acl --------
message ListAclRequest{
    string cluster_name = 1;
}

message ListAclReply{
    repeated bytes acls = 1;
}

message DeleteAclRequest{
    string cluster_name = 1;
    bytes acl = 2;
}

message DeleteAclReply{

}

message CreateAclRequest{
    string cluster_name = 1;
    bytes acl = 2;
}

message CreateAclReply{

}

// --------- blacklist --------
message ListBlacklistRequest{
    string cluster_name = 1;
}

message ListBlacklistReply{
    repeated bytes blacklists = 1;
}

message CreateBlacklistRequest{
    string cluster_name = 1;

    bytes blacklist = 2;
}

message CreateBlacklistReply{

}

message DeleteBlacklistRequest{
    string cluster_name = 1;

    string blacklist_type = 2;

    string resource_name = 3;
}

message DeleteBlacklistReply{

}

// --------- connection --------
message ListConnectionRequest {

}

message ListConnectionReply {
    repeated ListConnectionRaw list_connection_raw = 1;
}

message ListConnectionRaw {
    uint64 connection_id = 1;
    string connection_type = 2;
    string protocol = 3;
    string source_addr = 4;
    string info = 5;
}

// flapping detect
message EnableFlappingDetectRequest {
    bool is_enable = 1;
    uint32 window_time = 2;
    uint32 max_client_connections = 3;
    uint32 ban_time = 4;
}

message EnableFlappingDetectReply {
    bool is_enable = 1;
}

// --------- observability service --------
// --------- slow subscribe feature -------
message EnableSlowSubscribeRequest {
    bool is_enable = 1;
}

message EnableSlowSubScribeReply {
    bool is_enable = 1;
}

message ListSlowSubscribeRequest {
    uint64 list = 1;
    string sub_name = 3;
    string topic = 2;
    string client_id = 4;
    string sort = 5;
}

message ListSlowSubscribeReply {
    repeated ListSlowSubScribeRaw list_slow_subscribe_raw = 1;
}

message ListSlowSubScribeRaw {
    string client_id = 1;
    string topic = 2;
    uint64 time_ms = 3;
    string node_info = 4;
    uint64 create_time = 5;
    string sub_name = 6;
}


// --------- mqtt topic --------
enum MatchOption {
    E = 0;
    P = 1;
    S = 2;
}

message ListTopicRequest {
    string topic_name = 1;
    MatchOption match_option = 2;
}
message ListTopicReply {
    repeated MqttTopic topics = 1;
}
message MqttTopic {
    string topic_id = 1;
    string cluster_name = 2;
    string topic_name = 3;
    bool is_contain_retain_message = 4;
}

message DeleteTopicRewriteRuleRequest{
    //The action of the rewrite rule, one of the publish|subscribe|all.
    string action = 1;
    //The source topic of the rewrite rule.
    string source_topic = 2;
}

message DeleteTopicRewriteRuleReply{

}

message CreateTopicRewriteRuleRequest{

    //The action of the rewrite rule, one of the publish|subscribe|all.
    string action = 1;

    //The source topic of the rewrite rule.
    string source_topic = 2;

    //The dest topic of the rewrite rule.
    string dest_topic = 3;

    //The regex of the rewrite rule.
    string regex = 4;
}

message CreateTopicRewriteRuleReply{

}

// --------- mqtt topic --------
enum MqttConnectorType {
    File = 0;
    Kafka = 1;
}
message MqttListConnectorRequest{
    string connector_name = 1;
}

message MqttListConnectorReply{
    repeated bytes connectors = 1;
}

message MqttCreateConnectorRequest{
    string connector_name = 1;
    MqttConnectorType connector_type = 2;
    string config = 3;
    string topic_id = 4;
}

message MqttCreateConnectorReply{

}

message MqttDeleteConnectorRequest{
    string connector_name = 1;
}

message MqttDeleteConnectorReply{

}

message MqttUpdateConnectorRequest{
    bytes connector = 1;
}

message MqttUpdateConnectorReply{

}

// --------- mqtt schema --------
message MqttListSchemaRequest {
    string schema_name = 1;
}

message MqttListSchemaReply {
    repeated bytes schemas = 1;
}

message MqttCreateSchemaRequest {
    string schema_name = 1;
    string schema_type = 2;
    string schema = 3;
    string desc = 4;
}

message MqttCreateSchemaReply {}

message MqttUpdateSchemaRequest {
    string schema_name = 1;
    string schema_type = 2;
    string schema = 3;
    string desc = 4;
}

message MqttUpdateSchemaReply {}

message MqttDeleteSchemaRequest {
    string schema_name = 1;
}

message MqttDeleteSchemaReply {}

message MqttListBindSchemaRequest {
    string schema_name = 1;
    string resource_name = 2;
}

message MqttListBindSchemaReply {
    repeated bytes schema_binds = 1;
}

message MqttBindSchemaRequest {
    string schema_name = 1;
    string resource_name = 2;
}

message MqttBindSchemaReply {}

message MqttUnbindSchemaRequest {
    string schema_name = 1;
    string resource_name = 2;
}

message MqttUnbindSchemaReply {}