NamingManagerService
- gRPC服务地址:
/fusion.discoveryx.server.grpc.NamingManagerService
- REST URL前缀:
/fusion/discoveryx/console/naming
REST URL路径由 REST URL前缀 + 服务名组织,均使用 POST 方法的请求,JSON序例化格式。如查询服务列表接口访问地址为:POST /fusion/discoveryx/console/naming/ListService
。Protobuf与JSON格式转换请参阅: JSON 说明。
ListService
gRPC
// Query services
rpc ListService (fusion.discoveryx.server.protocol.ListService) returns (fusion.discoveryx.server.protocol.NamingResponse) {
}
请求
message ListService {
string namespace = 1;
int32 page = 2;
int32 size = 3;
string service_name = 4;
string group_name = 5;
// only return all healthy instances
bool all_healthy = 6;
}
响应
message NamingResponse {
int32 status = 1;
string message = 2;
oneof data {
ListedService listed_service = 3;
fusion.discoveryx.model.ServiceInfo service_info = 4;
fusion.discoveryx.model.Instance instance = 5;
}
}
oneof
的listed_service
字段将返回匹配查询的服务列表:
message ListedService {
repeated fusion.discoveryx.model.ServiceInfo service_infos = 1;
int32 page = 2;
int32 size = 3;
int32 total_elements = 4;
}
message ServiceInfo {
string namespace = 1;
string service_name = 2;
string group_name = 3;
double protect_threshold = 4;
map<string, string> metadata = 5;
// 实例数
int32 instance_total = 6;
// 健康实例数
int32 instance_healthy_count = 7;
repeated Instance instances = 8;
}
Instance
见 开放API#instance。
GetService
gRPC
// Get one service
rpc GetService (fusion.discoveryx.server.protocol.GetService) returns (fusion.discoveryx.server.protocol.NamingResponse) {
}
请求
message GetService {
string namespace = 1;
string service_name = 2;
google.protobuf.StringValue group_name = 3;
}
响应
message NamingResponse {
int32 status = 1;
string message = 2;
oneof data {
ListedService listed_service = 3;
fusion.discoveryx.model.ServiceInfo service_info = 4;
fusion.discoveryx.model.Instance instance = 5;
}
}
oneof
的listed_service
字段将返回匹配查询的服务列表:
message ServiceInfo {
string namespace = 1;
string service_name = 2;
string group_name = 3;
double protect_threshold = 4;
map<string, string> metadata = 5;
// 实例数
int32 instance_total = 6;
// 健康实例数
int32 instance_healthy_count = 7;
repeated Instance instances = 8;
}
CreateService
gRPC
// Create a service
rpc CreateService (fusion.discoveryx.server.protocol.CreateService) returns (fusion.discoveryx.server.protocol.NamingResponse) {
}
请求
message CreateService {
option (scalapb.message).extends = "fusion.discoveryx.server.naming.NamingService.Event";
string namespace = 1;
string service_name = 2;
string group_name = 3;
double protect_threshold = 4;
map<string, string> metadata = 5;
}
响应
message NamingResponse {
int32 status = 1;
string message = 2;
oneof data {
ListedService listed_service = 3;
fusion.discoveryx.model.ServiceInfo service_info = 4;
fusion.discoveryx.model.Instance instance = 5;
}
}
oneof
的listed_service
字段将返回匹配查询的服务列表:
message ServiceInfo {
string namespace = 1;
string service_name = 2;
string group_name = 3;
double protect_threshold = 4;
map<string, string> metadata = 5;
// 实例数
int32 instance_total = 6;
// 健康实例数
int32 instance_healthy_count = 7;
repeated Instance instances = 8;
}
ModifyService
gRPC
// Modify a service
rpc ModifyService (fusion.discoveryx.server.protocol.ModifyService) returns (fusion.discoveryx.server.protocol.NamingResponse) {
}
请求
message ModifyService {
option (scalapb.message).extends = "fusion.discoveryx.server.naming.NamingService.Event";
string namespace = 1;
string service_name = 2;
google.protobuf.StringValue group_name = 3;
google.protobuf.DoubleValue protect_threshold = 4;
map<string, string> metadata = 5;
bool replace_metadata = 6;
}
响应
message NamingResponse {
int32 status = 1;
string message = 2;
oneof data {
ListedService listed_service = 3;
fusion.discoveryx.model.ServiceInfo service_info = 4;
fusion.discoveryx.model.Instance instance = 5;
}
}
oneof
的listed_service
字段将返回匹配查询的服务列表:
message ServiceInfo {
string namespace = 1;
string service_name = 2;
string group_name = 3;
double protect_threshold = 4;
map<string, string> metadata = 5;
// 实例数
int32 instance_total = 6;
// 健康实例数
int32 instance_healthy_count = 7;
repeated Instance instances = 8;
}
RemoveService
gRPC
// Remove a service
rpc RemoveService (fusion.discoveryx.server.protocol.RemoveService) returns (fusion.discoveryx.server.protocol.NamingResponse) {
}
请求
message RemoveService {
option (scalapb.message).extends = "fusion.discoveryx.server.naming.NamingService.Event";
string namespace = 1;
string service_name = 2;
}
响应
message NamingResponse {
int32 status = 1;
string message = 2;
oneof data {
ListedService listed_service = 3;
fusion.discoveryx.model.ServiceInfo service_info = 4;
fusion.discoveryx.model.Instance instance = 5;
}
}
RemoveInstance
gRPC
// Remove a instance
rpc RemoveInstance (fusion.discoveryx.model.InstanceRemove) returns (fusion.discoveryx.model.NamingReply) {
}
请求
message InstanceRemove {
string namespace = 1;
string service_name = 2;
string instance_id = 3;
}
响应
删除实例没有oneof
字段返回。
message NamingReply {
int32 status = 1;
string message = 2;
oneof data {
Instance instance = 3;
ServiceInfo service_info = 4;
}
}
ModifyInstance
gRPC
// Modify a instance
rpc ModifyInstance (fusion.discoveryx.model.InstanceModify) returns (fusion.discoveryx.model.NamingReply) {
}
请求
message InstanceModify {
string namespace = 1;
string service_name = 2;
string instance_id = 3;
google.protobuf.StringValue group_name = 4;
google.protobuf.StringValue ip = 5;
google.protobuf.Int32Value port = 6;
// instance weight
google.protobuf.DoubleValue weight = 7;
// instance health status
google.protobuf.BoolValue health = 8;
// If instance is enabled to accept request
google.protobuf.BoolValue enable = 9;
// user extended attributes
map<string, string> metadata = 10;
// true:replace old metadata, false: merge old metadata
bool replace_metadata = 11;
HealthyCheckMethod healthy_check_method = 12;
// Healthy check per N seconds
google.protobuf.Int32Value healthy_check_interval = 13;
// Unhealthy check count
google.protobuf.Int32Value unhealthy_check_count = 14;
// 实例协议
HealthyCheckProtocol protocol = 15;
google.protobuf.BoolValue use_tls = 16;
google.protobuf.StringValue http_path = 17;
}
响应
message NamingReply {
int32 status = 1;
string message = 2;
oneof data {
Instance instance = 3;
ServiceInfo service_info = 4;
}
}
oneof
的instance
字段将返回修改后的实例信息。