Files
EdgeCommon/pkg/rpc/protos/service_ip_item.proto
2021-11-21 09:42:39 +08:00

183 lines
4.1 KiB
Protocol Buffer
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
option go_package = "./pb";
package pb;
import "models/rpc_messages.proto";
import "models/model_ip_item.proto";
import "models/model_ip_list.proto";
import "models/model_server.proto";
import "models/model_http_firewall_policy.proto";
// IP条目管理
service IPItemService {
// 创建IP
rpc createIPItem (CreateIPItemRequest) returns (CreateIPItemResponse);
// 修改IP
rpc updateIPItem (UpdateIPItemRequest) returns (RPCSuccess);
// 删除IP
rpc deleteIPItem (DeleteIPItemRequest) returns (RPCSuccess);
// 批量删除IP
rpc deleteIPItems(DeleteIPItemsRequest) returns (RPCSuccess);
// 计算IP数量
rpc countIPItemsWithListId (CountIPItemsWithListIdRequest) returns (RPCCountResponse);
// 列出单页的IP
rpc listIPItemsWithListId (ListIPItemsWithListIdRequest) returns (ListIPItemsWithListIdResponse);
// 查找单个IP
rpc findEnabledIPItem (FindEnabledIPItemRequest) returns (FindEnabledIPItemResponse);
// 根据版本列出一组IP
rpc listIPItemsAfterVersion (ListIPItemsAfterVersionRequest) returns (ListIPItemsAfterVersionResponse);
// 检查IP状态
rpc checkIPItemStatus (CheckIPItemStatusRequest) returns (CheckIPItemStatusResponse);
// 检查IP是否存在
rpc existsEnabledIPItem (ExistsEnabledIPItemRequest) returns (ExistsEnabledIPItemResponse);
// 计算所有IP数量
rpc countAllEnabledIPItems(CountAllEnabledIPItemsRequest) returns (RPCCountResponse);
// 列出所有名单中的IP
rpc listAllEnabledIPItems(ListAllEnabledIPItemsRequest) returns (ListAllEnabledIPItemsResponse);
}
// 创建IP
message CreateIPItemRequest {
int64 ipListId = 1; // IP列表ID
string ipFrom = 2; // 开始IP
string ipTo = 3; // 结束IP可选
int64 expiredAt = 4; // 过期时间戳(可选)
string reason = 5; // 加入理由(可选)
string type = 6; // 类型
string eventLevel = 7; // 级别
int64 nodeId = 8; // 所属节点ID
int64 serverId = 9; // 所属服务ID
int64 sourceNodeId = 10;
int64 sourceServerId = 11;
int64 sourceHTTPFirewallPolicyId = 12;
int64 sourceHTTPFirewallRuleGroupId = 13;
int64 sourceHTTPFirewallRuleSetId = 14;
}
message CreateIPItemResponse {
int64 ipItemId = 1;
}
// 修改IP
message UpdateIPItemRequest {
int64 ipItemId = 1;
string ipFrom = 2;
string ipTo = 3;
int64 expiredAt = 4;
string reason = 5;
string type = 6; // 类型
string eventLevel = 7; // 级别
}
// 删除IP
message DeleteIPItemRequest {
int64 ipItemId = 1; // IP条目的ID
}
// 批量删除IP
message DeleteIPItemsRequest {
repeated int64 ipItemIds = 1;
}
// 计算IP数量
message CountIPItemsWithListIdRequest {
int64 ipListId = 1;
string keyword = 2;
string ipFrom = 3;
string ipTo = 4;
}
// 列出单页的IP
message ListIPItemsWithListIdRequest {
int64 ipListId = 1;
string keyword = 4;
string ipFrom = 5;
string ipTo = 6;
int64 offset = 2;
int64 size = 3;
}
message ListIPItemsWithListIdResponse {
repeated IPItem ipItems = 1;
}
// 查找单个IP
message FindEnabledIPItemRequest {
int64 ipItemId = 1;
}
message FindEnabledIPItemResponse {
IPItem ipItem = 1;
}
// 根据版本列出一组IP
message ListIPItemsAfterVersionRequest {
int64 version = 1;
int64 size = 2;
}
message ListIPItemsAfterVersionResponse {
repeated IPItem ipItems = 1;
}
// 检查IP状态
message CheckIPItemStatusRequest {
int64 ipListId = 1;
string ip = 2;
}
message CheckIPItemStatusResponse {
bool isOk = 1; // 是否查询成功
string error = 2;
bool isFound = 3; // 是否找到
bool isAllowed = 4; // 是否允许
IPItem ipItem = 5; // 匹配的IPItem
}
// 检查IP是否存在
message ExistsEnabledIPItemRequest {
int64 ipItemId = 1;
}
message ExistsEnabledIPItemResponse {
bool exists = 1;
}
// 计算所有IP数量
message CountAllEnabledIPItemsRequest {
string ip = 1;
bool globalOnly = 2;
}
// 列出所有名单中的IP
message ListAllEnabledIPItemsRequest {
string ip = 1;
bool globalOnly = 2;
int64 offset = 3;
int64 size = 4;
}
message ListAllEnabledIPItemsResponse {
repeated Result results = 1;
message Result {
IPList ipList = 1; // 所属名单
IPItem ipItem = 2; // IP信息
Server server = 3; // 所属服务
HTTPFirewallPolicy httpFirewallPolicy = 4; // 所属WAF策略
}
}