mirror of
https://github.com/TeaOSLab/EdgeCommon.git
synced 2026-01-04 10:06:34 +08:00
添加快捷添加和删除网站源站API
This commit is contained in:
@@ -31,7 +31,7 @@ type CreateOriginRequest struct {
|
||||
OssJSON []byte `protobuf:"bytes,15,opt,name=ossJSON,proto3" json:"ossJSON,omitempty"` // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项
|
||||
Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"` // 描述,为可选项
|
||||
Weight int32 `protobuf:"varint,4,opt,name=weight,proto3" json:"weight,omitempty"` // 权重,不小于0,一般设置为10
|
||||
IsOn bool `protobuf:"varint,5,opt,name=isOn,proto3" json:"isOn,omitempty"` // 是否启用
|
||||
IsOn bool `protobuf:"varint,5,opt,name=isOn,proto3" json:"isOn,omitempty"` // 是否启用,一般为true
|
||||
ConnTimeoutJSON []byte `protobuf:"bytes,6,opt,name=connTimeoutJSON,proto3" json:"connTimeoutJSON,omitempty"` // 可选项,连接超时时间
|
||||
ReadTimeoutJSON []byte `protobuf:"bytes,7,opt,name=readTimeoutJSON,proto3" json:"readTimeoutJSON,omitempty"` // 可选项,读取超时时间
|
||||
IdleTimeoutJSON []byte `protobuf:"bytes,8,opt,name=idleTimeoutJSON,proto3" json:"idleTimeoutJSON,omitempty"` // 可选项,空闲超时时间
|
||||
@@ -417,7 +417,7 @@ type FindEnabledOriginRequest struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"`
|
||||
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"` // 源站ID
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginRequest) Reset() {
|
||||
@@ -464,7 +464,7 @@ type FindEnabledOriginResponse struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Origin *Origin `protobuf:"bytes,1,opt,name=Origin,proto3" json:"Origin,omitempty"`
|
||||
Origin *Origin `protobuf:"bytes,1,opt,name=Origin,proto3" json:"Origin,omitempty"` // 源站信息
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginResponse) Reset() {
|
||||
@@ -512,7 +512,7 @@ type FindEnabledOriginConfigRequest struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"`
|
||||
OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"` // 源站ID
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginConfigRequest) Reset() {
|
||||
@@ -559,7 +559,7 @@ type FindEnabledOriginConfigResponse struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
OriginJSON []byte `protobuf:"bytes,1,opt,name=originJSON,proto3" json:"originJSON,omitempty"`
|
||||
OriginJSON []byte `protobuf:"bytes,1,opt,name=originJSON,proto3" json:"originJSON,omitempty"` // 源站信息
|
||||
}
|
||||
|
||||
func (x *FindEnabledOriginConfigResponse) Reset() {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,8 @@ const (
|
||||
ServerService_CreateServer_FullMethodName = "/pb.ServerService/createServer"
|
||||
ServerService_CreateBasicHTTPServer_FullMethodName = "/pb.ServerService/createBasicHTTPServer"
|
||||
ServerService_CreateBasicTCPServer_FullMethodName = "/pb.ServerService/createBasicTCPServer"
|
||||
ServerService_AddServerOrigin_FullMethodName = "/pb.ServerService/addServerOrigin"
|
||||
ServerService_DeleteServerOrigin_FullMethodName = "/pb.ServerService/deleteServerOrigin"
|
||||
ServerService_UpdateServerBasic_FullMethodName = "/pb.ServerService/updateServerBasic"
|
||||
ServerService_UpdateServerGroupIds_FullMethodName = "/pb.ServerService/updateServerGroupIds"
|
||||
ServerService_UpdateServerIsOn_FullMethodName = "/pb.ServerService/updateServerIsOn"
|
||||
@@ -94,6 +96,10 @@ type ServerServiceClient interface {
|
||||
CreateBasicHTTPServer(ctx context.Context, in *CreateBasicHTTPServerRequest, opts ...grpc.CallOption) (*CreateBasicHTTPServerResponse, error)
|
||||
// 快速创建基本的TCP网站
|
||||
CreateBasicTCPServer(ctx context.Context, in *CreateBasicTCPServerRequest, opts ...grpc.CallOption) (*CreateBasicTCPServerResponse, error)
|
||||
// 为网站添加源站
|
||||
AddServerOrigin(ctx context.Context, in *AddServerOriginRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
||||
// 从网站中删除某个源站
|
||||
DeleteServerOrigin(ctx context.Context, in *DeleteServerOriginRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
||||
// 修改网站基本信息
|
||||
UpdateServerBasic(ctx context.Context, in *UpdateServerBasicRequest, opts ...grpc.CallOption) (*RPCSuccess, error)
|
||||
// 修改网站所在分组
|
||||
@@ -251,6 +257,24 @@ func (c *serverServiceClient) CreateBasicTCPServer(ctx context.Context, in *Crea
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serverServiceClient) AddServerOrigin(ctx context.Context, in *AddServerOriginRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
|
||||
out := new(RPCSuccess)
|
||||
err := c.cc.Invoke(ctx, ServerService_AddServerOrigin_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serverServiceClient) DeleteServerOrigin(ctx context.Context, in *DeleteServerOriginRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
|
||||
out := new(RPCSuccess)
|
||||
err := c.cc.Invoke(ctx, ServerService_DeleteServerOrigin_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *serverServiceClient) UpdateServerBasic(ctx context.Context, in *UpdateServerBasicRequest, opts ...grpc.CallOption) (*RPCSuccess, error) {
|
||||
out := new(RPCSuccess)
|
||||
err := c.cc.Invoke(ctx, ServerService_UpdateServerBasic_FullMethodName, in, out, opts...)
|
||||
@@ -801,6 +825,10 @@ type ServerServiceServer interface {
|
||||
CreateBasicHTTPServer(context.Context, *CreateBasicHTTPServerRequest) (*CreateBasicHTTPServerResponse, error)
|
||||
// 快速创建基本的TCP网站
|
||||
CreateBasicTCPServer(context.Context, *CreateBasicTCPServerRequest) (*CreateBasicTCPServerResponse, error)
|
||||
// 为网站添加源站
|
||||
AddServerOrigin(context.Context, *AddServerOriginRequest) (*RPCSuccess, error)
|
||||
// 从网站中删除某个源站
|
||||
DeleteServerOrigin(context.Context, *DeleteServerOriginRequest) (*RPCSuccess, error)
|
||||
// 修改网站基本信息
|
||||
UpdateServerBasic(context.Context, *UpdateServerBasicRequest) (*RPCSuccess, error)
|
||||
// 修改网站所在分组
|
||||
@@ -936,6 +964,12 @@ func (UnimplementedServerServiceServer) CreateBasicHTTPServer(context.Context, *
|
||||
func (UnimplementedServerServiceServer) CreateBasicTCPServer(context.Context, *CreateBasicTCPServerRequest) (*CreateBasicTCPServerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CreateBasicTCPServer not implemented")
|
||||
}
|
||||
func (UnimplementedServerServiceServer) AddServerOrigin(context.Context, *AddServerOriginRequest) (*RPCSuccess, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AddServerOrigin not implemented")
|
||||
}
|
||||
func (UnimplementedServerServiceServer) DeleteServerOrigin(context.Context, *DeleteServerOriginRequest) (*RPCSuccess, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DeleteServerOrigin not implemented")
|
||||
}
|
||||
func (UnimplementedServerServiceServer) UpdateServerBasic(context.Context, *UpdateServerBasicRequest) (*RPCSuccess, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateServerBasic not implemented")
|
||||
}
|
||||
@@ -1182,6 +1216,42 @@ func _ServerService_CreateBasicTCPServer_Handler(srv interface{}, ctx context.Co
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ServerService_AddServerOrigin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(AddServerOriginRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServerServiceServer).AddServerOrigin(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ServerService_AddServerOrigin_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServerServiceServer).AddServerOrigin(ctx, req.(*AddServerOriginRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ServerService_DeleteServerOrigin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DeleteServerOriginRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ServerServiceServer).DeleteServerOrigin(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ServerService_DeleteServerOrigin_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ServerServiceServer).DeleteServerOrigin(ctx, req.(*DeleteServerOriginRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ServerService_UpdateServerBasic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(UpdateServerBasicRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -2281,6 +2351,14 @@ var ServerService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "createBasicTCPServer",
|
||||
Handler: _ServerService_CreateBasicTCPServer_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "addServerOrigin",
|
||||
Handler: _ServerService_AddServerOrigin_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "deleteServerOrigin",
|
||||
Handler: _ServerService_DeleteServerOrigin_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "updateServerBasic",
|
||||
Handler: _ServerService_UpdateServerBasic_Handler,
|
||||
|
||||
@@ -29,7 +29,7 @@ message CreateOriginRequest {
|
||||
bytes ossJSON = 15; // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项
|
||||
string description = 3; // 描述,为可选项
|
||||
int32 weight = 4; // 权重,不小于0,一般设置为10
|
||||
bool isOn = 5; // 是否启用
|
||||
bool isOn = 5; // 是否启用,一般为true
|
||||
bytes connTimeoutJSON = 6; // 可选项,连接超时时间
|
||||
bytes readTimeoutJSON = 7; // 可选项,读取超时时间
|
||||
bytes idleTimeoutJSON = 8; // 可选项,空闲超时时间
|
||||
@@ -69,18 +69,18 @@ message UpdateOriginRequest {
|
||||
|
||||
// 查找单个源站信息
|
||||
message FindEnabledOriginRequest {
|
||||
int64 originId = 1;
|
||||
int64 originId = 1; // 源站ID
|
||||
}
|
||||
|
||||
message FindEnabledOriginResponse {
|
||||
Origin Origin = 1;
|
||||
Origin Origin = 1; // 源站信息
|
||||
}
|
||||
|
||||
// 查找源站配置
|
||||
message FindEnabledOriginConfigRequest {
|
||||
int64 originId = 1;
|
||||
int64 originId = 1; // 源站ID
|
||||
}
|
||||
|
||||
message FindEnabledOriginConfigResponse {
|
||||
bytes originJSON = 1;
|
||||
bytes originJSON = 1; // 源站信息
|
||||
}
|
||||
@@ -20,6 +20,12 @@ service ServerService {
|
||||
// 快速创建基本的TCP网站
|
||||
rpc createBasicTCPServer(CreateBasicTCPServerRequest) returns (CreateBasicTCPServerResponse);
|
||||
|
||||
// 为网站添加源站
|
||||
rpc addServerOrigin(AddServerOriginRequest) returns (RPCSuccess);
|
||||
|
||||
// 从网站中删除某个源站
|
||||
rpc deleteServerOrigin(DeleteServerOriginRequest) returns (RPCSuccess);
|
||||
|
||||
// 修改网站基本信息
|
||||
rpc updateServerBasic (UpdateServerBasicRequest) returns (RPCSuccess);
|
||||
|
||||
@@ -261,6 +267,19 @@ message CreateBasicTCPServerResponse {
|
||||
int64 serverId = 1; // 所创建的网站ID
|
||||
}
|
||||
|
||||
// 为网站添加源站
|
||||
message AddServerOriginRequest {
|
||||
int64 serverId = 1; // 网站ID
|
||||
int64 originId = 2; // 源站ID,通过 OriginService 创建和查询
|
||||
bool isPrimary = 3; // 是否为主要源站
|
||||
}
|
||||
|
||||
// 从网站中删除某个源站
|
||||
message DeleteServerOriginRequest {
|
||||
int64 serverId = 1; // 网站ID
|
||||
int64 originId = 2; // 源站ID,通过 OriginService 创建和查询
|
||||
}
|
||||
|
||||
// 修改网站基本信息
|
||||
message UpdateServerBasicRequest {
|
||||
int64 serverId = 1; // 网站ID
|
||||
|
||||
Reference in New Issue
Block a user