From be296bd0e00a379f7ff69fe37e10fee99e781419 Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 14 Apr 2024 16:27:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BA=90=E7=AB=99=E5=A2=9E=E5=8A=A0=E5=BF=AB?= =?UTF-8?q?=E9=80=9F=E5=81=9C=E7=94=A8/=E5=90=AF=E7=94=A8=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/rpc.json | 17 +++ pkg/langs/codes/codes.go | 1 + pkg/langs/messages/messages_en_us.go | 1 + pkg/langs/messages/messages_zh_cn.go | 1 + pkg/langs/protos/zh-cn/server_origin.json | 3 +- pkg/rpc/pb/service_origin.pb.go | 166 ++++++++++++++++------ pkg/rpc/pb/service_origin_grpc.pb.go | 39 +++++ pkg/rpc/protos/service_origin.proto | 9 ++ 8 files changed, 193 insertions(+), 44 deletions(-) diff --git a/build/rpc.json b/build/rpc.json index bb7b6a0..0677ee6 100644 --- a/build/rpc.json +++ b/build/rpc.json @@ -9485,6 +9485,18 @@ "user" ], "isDeprecated": false + }, + { + "name": "updateOriginIsOn", + "requestMessageName": "UpdateOriginIsOnRequest", + "responseMessageName": "RPCSuccess", + "code": "rpc updateOriginIsOn(UpdateOriginIsOnRequest) returns (RPCSuccess);", + "doc": "设置源站是否启用", + "roles": [ + "admin", + "user" + ], + "isDeprecated": false } ], "filename": "service_origin.proto", @@ -23253,6 +23265,11 @@ "code": "message UpdateOrderMethodRequest {\n\tint64 orderMethodId = 1;\n\tstring name = 2;\n\tstring code = 3;\n\tstring description = 4;\n\n\tstring url = 5;\n\n\tbytes paramsJSON = 7; // 预设支付方式参数\n\n\tbool isOn = 6;\n\tstring clientType = 8;\n\tstring qrcodeTitle = 9;\n}", "doc": "修改支付方式\n不允许修改父级支付方式" }, + { + "name": "UpdateOriginIsOnRequest", + "code": "message UpdateOriginIsOnRequest {\n\tint64 originId = 1; // 源站ID\n\tbool isOn = 2; // 是否启用\n}", + "doc": "设置源站是否启用" + }, { "name": "UpdateOriginRequest", "code": "message UpdateOriginRequest {\n\tint64 originId = 1; // 源站ID\n\tstring name = 2; // 可选项\n\tNetworkAddress addr = 3; // 源站网络地址\n\tbytes ossJSON = 16; // OSS配置信息,源站网络地址中protocol为oss:开头时需要设置此项\n\tstring description = 4; // 可选项\n\tint32 weight = 5; // 权重,不小于0,一般设置为10\n\tbool isOn = 6; // 是否启用\n\tbytes connTimeoutJSON = 7; // 可选项\n\tbytes readTimeoutJSON = 8; // 可选项\n\tbytes idleTimeoutJSON = 9; // 可选项\n\tint32 maxConns = 10; // 可选项\n\tint32 maxIdleConns = 11; // 可选项\n\trepeated string domains = 12; // 可选项\n\tbytes certRefJSON = 13; // 可选项\n\tstring host = 14; // 可选项\n\tbool followPort = 15; // 可选项\n\tbool http2Enabled = 17; // 可选项,是否支持HTTP/2,只在HTTPS源站时生效\n}", diff --git a/pkg/langs/codes/codes.go b/pkg/langs/codes/codes.go index edd17ae..6cd50a1 100644 --- a/pkg/langs/codes/codes.go +++ b/pkg/langs/codes/codes.go @@ -607,6 +607,7 @@ const ( ServerOrigin_LogCreateOrigin langs.MessageCode = "server_origin@log_create_origin" // 创建源站 %d ServerOrigin_LogDeleteOrigin langs.MessageCode = "server_origin@log_delete_origin" // 删除源站 %d ServerOrigin_LogUpdateOrigin langs.MessageCode = "server_origin@log_update_origin" // 修改源站 %d + ServerOrigin_LogUpdateOriginIsOn langs.MessageCode = "server_origin@log_update_origin_is_on" // 修改源站 %d 启用状态 ServerPage_LogCreatePage langs.MessageCode = "server_page@log_create_page" // 创建自定义页面 %d ServerPage_LogUpdateClusterPages langs.MessageCode = "server_page@log_update_cluster_pages" // 修改集群 %d 自定义页面策略 ServerPage_LogUpdatePage langs.MessageCode = "server_page@log_update_page" // 修改自定义页面 %d diff --git a/pkg/langs/messages/messages_en_us.go b/pkg/langs/messages/messages_en_us.go index 37b6f22..2e9bcf1 100644 --- a/pkg/langs/messages/messages_en_us.go +++ b/pkg/langs/messages/messages_en_us.go @@ -608,6 +608,7 @@ func init() { "server_origin@log_create_origin": "", "server_origin@log_delete_origin": "", "server_origin@log_update_origin": "", + "server_origin@log_update_origin_is_on": "", "server_page@log_create_page": "", "server_page@log_update_cluster_pages": "", "server_page@log_update_page": "", diff --git a/pkg/langs/messages/messages_zh_cn.go b/pkg/langs/messages/messages_zh_cn.go index a2462c4..cd0b08e 100644 --- a/pkg/langs/messages/messages_zh_cn.go +++ b/pkg/langs/messages/messages_zh_cn.go @@ -608,6 +608,7 @@ func init() { "server_origin@log_create_origin": "创建源站 %d", "server_origin@log_delete_origin": "删除源站 %d", "server_origin@log_update_origin": "修改源站 %d", + "server_origin@log_update_origin_is_on": "修改源站 %d 启用状态", "server_page@log_create_page": "创建自定义页面 %d", "server_page@log_update_cluster_pages": "修改集群 %d 自定义页面策略", "server_page@log_update_page": "修改自定义页面 %d", diff --git a/pkg/langs/protos/zh-cn/server_origin.json b/pkg/langs/protos/zh-cn/server_origin.json index a36a6d7..a08b19e 100644 --- a/pkg/langs/protos/zh-cn/server_origin.json +++ b/pkg/langs/protos/zh-cn/server_origin.json @@ -1,5 +1,6 @@ { "log_create_origin": "创建源站 %d", "log_delete_origin": "删除源站 %d", - "log_update_origin": "修改源站 %d" + "log_update_origin": "修改源站 %d", + "log_update_origin_is_on": "修改源站 %d 启用状态" } \ No newline at end of file diff --git a/pkg/rpc/pb/service_origin.pb.go b/pkg/rpc/pb/service_origin.pb.go index fe51a9c..f3722bb 100644 --- a/pkg/rpc/pb/service_origin.pb.go +++ b/pkg/rpc/pb/service_origin.pb.go @@ -601,6 +601,62 @@ func (x *FindEnabledOriginConfigResponse) GetOriginJSON() []byte { return nil } +// 设置源站是否启用 +type UpdateOriginIsOnRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OriginId int64 `protobuf:"varint,1,opt,name=originId,proto3" json:"originId,omitempty"` // 源站ID + IsOn bool `protobuf:"varint,2,opt,name=isOn,proto3" json:"isOn,omitempty"` // 是否启用 +} + +func (x *UpdateOriginIsOnRequest) Reset() { + *x = UpdateOriginIsOnRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_origin_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateOriginIsOnRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateOriginIsOnRequest) ProtoMessage() {} + +func (x *UpdateOriginIsOnRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_origin_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateOriginIsOnRequest.ProtoReflect.Descriptor instead. +func (*UpdateOriginIsOnRequest) Descriptor() ([]byte, []int) { + return file_service_origin_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateOriginIsOnRequest) GetOriginId() int64 { + if x != nil { + return x.OriginId + } + return 0 +} + +func (x *UpdateOriginIsOnRequest) GetIsOn() bool { + if x != nil { + return x.IsOn + } + return false +} + var File_service_origin_proto protoreflect.FileDescriptor var file_service_origin_proto_rawDesc = []byte{ @@ -697,28 +753,37 @@ var file_service_origin_proto_rawDesc = []byte{ 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0a, - 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x32, 0xc1, 0x02, 0x0a, 0x0d, 0x4f, - 0x72, 0x69, 0x67, 0x69, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x17, 0x2e, 0x70, - 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x37, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, - 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, - 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, - 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x1c, 0x2e, - 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, - 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, - 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, - 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x17, 0x66, 0x69, - 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x46, - 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0x49, 0x0a, 0x17, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x73, 0x4f, 0x6e, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, + 0x64, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x04, 0x69, 0x73, 0x4f, 0x6e, 0x32, 0x82, 0x03, 0x0a, 0x0d, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x18, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, + 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x11, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, + 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x62, 0x0a, 0x17, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, + 0x12, 0x22, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, + 0x61, 0x62, 0x6c, 0x65, 0x64, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x43, 0x6f, 0x6e, 0x66, 0x69, + 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3f, 0x0a, 0x10, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, 0x73, 0x4f, 0x6e, 0x12, 0x1b, 0x2e, + 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x49, + 0x73, 0x4f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x70, 0x62, 0x2e, + 0x52, 0x50, 0x43, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -733,7 +798,7 @@ func file_service_origin_proto_rawDescGZIP() []byte { return file_service_origin_proto_rawDescData } -var file_service_origin_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_service_origin_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_service_origin_proto_goTypes = []interface{}{ (*CreateOriginRequest)(nil), // 0: pb.CreateOriginRequest (*CreateOriginResponse)(nil), // 1: pb.CreateOriginResponse @@ -742,27 +807,30 @@ var file_service_origin_proto_goTypes = []interface{}{ (*FindEnabledOriginResponse)(nil), // 4: pb.FindEnabledOriginResponse (*FindEnabledOriginConfigRequest)(nil), // 5: pb.FindEnabledOriginConfigRequest (*FindEnabledOriginConfigResponse)(nil), // 6: pb.FindEnabledOriginConfigResponse - (*NetworkAddress)(nil), // 7: pb.NetworkAddress - (*Origin)(nil), // 8: pb.Origin - (*RPCSuccess)(nil), // 9: pb.RPCSuccess + (*UpdateOriginIsOnRequest)(nil), // 7: pb.UpdateOriginIsOnRequest + (*NetworkAddress)(nil), // 8: pb.NetworkAddress + (*Origin)(nil), // 9: pb.Origin + (*RPCSuccess)(nil), // 10: pb.RPCSuccess } var file_service_origin_proto_depIdxs = []int32{ - 7, // 0: pb.CreateOriginRequest.addr:type_name -> pb.NetworkAddress - 7, // 1: pb.UpdateOriginRequest.addr:type_name -> pb.NetworkAddress - 8, // 2: pb.FindEnabledOriginResponse.Origin:type_name -> pb.Origin - 0, // 3: pb.OriginService.createOrigin:input_type -> pb.CreateOriginRequest - 2, // 4: pb.OriginService.updateOrigin:input_type -> pb.UpdateOriginRequest - 3, // 5: pb.OriginService.findEnabledOrigin:input_type -> pb.FindEnabledOriginRequest - 5, // 6: pb.OriginService.findEnabledOriginConfig:input_type -> pb.FindEnabledOriginConfigRequest - 1, // 7: pb.OriginService.createOrigin:output_type -> pb.CreateOriginResponse - 9, // 8: pb.OriginService.updateOrigin:output_type -> pb.RPCSuccess - 4, // 9: pb.OriginService.findEnabledOrigin:output_type -> pb.FindEnabledOriginResponse - 6, // 10: pb.OriginService.findEnabledOriginConfig:output_type -> pb.FindEnabledOriginConfigResponse - 7, // [7:11] is the sub-list for method output_type - 3, // [3:7] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 8, // 0: pb.CreateOriginRequest.addr:type_name -> pb.NetworkAddress + 8, // 1: pb.UpdateOriginRequest.addr:type_name -> pb.NetworkAddress + 9, // 2: pb.FindEnabledOriginResponse.Origin:type_name -> pb.Origin + 0, // 3: pb.OriginService.createOrigin:input_type -> pb.CreateOriginRequest + 2, // 4: pb.OriginService.updateOrigin:input_type -> pb.UpdateOriginRequest + 3, // 5: pb.OriginService.findEnabledOrigin:input_type -> pb.FindEnabledOriginRequest + 5, // 6: pb.OriginService.findEnabledOriginConfig:input_type -> pb.FindEnabledOriginConfigRequest + 7, // 7: pb.OriginService.updateOriginIsOn:input_type -> pb.UpdateOriginIsOnRequest + 1, // 8: pb.OriginService.createOrigin:output_type -> pb.CreateOriginResponse + 10, // 9: pb.OriginService.updateOrigin:output_type -> pb.RPCSuccess + 4, // 10: pb.OriginService.findEnabledOrigin:output_type -> pb.FindEnabledOriginResponse + 6, // 11: pb.OriginService.findEnabledOriginConfig:output_type -> pb.FindEnabledOriginConfigResponse + 10, // 12: pb.OriginService.updateOriginIsOn:output_type -> pb.RPCSuccess + 8, // [8:13] is the sub-list for method output_type + 3, // [3:8] is the sub-list for method input_type + 3, // [3:3] is the sub-list for extension type_name + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name } func init() { file_service_origin_proto_init() } @@ -858,6 +926,18 @@ func file_service_origin_proto_init() { return nil } } + file_service_origin_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateOriginIsOnRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -865,7 +945,7 @@ func file_service_origin_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_origin_proto_rawDesc, NumEnums: 0, - NumMessages: 7, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/pkg/rpc/pb/service_origin_grpc.pb.go b/pkg/rpc/pb/service_origin_grpc.pb.go index f3bfd98..66750b5 100644 --- a/pkg/rpc/pb/service_origin_grpc.pb.go +++ b/pkg/rpc/pb/service_origin_grpc.pb.go @@ -23,6 +23,7 @@ const ( OriginService_UpdateOrigin_FullMethodName = "/pb.OriginService/updateOrigin" OriginService_FindEnabledOrigin_FullMethodName = "/pb.OriginService/findEnabledOrigin" OriginService_FindEnabledOriginConfig_FullMethodName = "/pb.OriginService/findEnabledOriginConfig" + OriginService_UpdateOriginIsOn_FullMethodName = "/pb.OriginService/updateOriginIsOn" ) // OriginServiceClient is the client API for OriginService service. @@ -37,6 +38,8 @@ type OriginServiceClient interface { FindEnabledOrigin(ctx context.Context, in *FindEnabledOriginRequest, opts ...grpc.CallOption) (*FindEnabledOriginResponse, error) // 查找源站配置 FindEnabledOriginConfig(ctx context.Context, in *FindEnabledOriginConfigRequest, opts ...grpc.CallOption) (*FindEnabledOriginConfigResponse, error) + // 设置源站是否启用 + UpdateOriginIsOn(ctx context.Context, in *UpdateOriginIsOnRequest, opts ...grpc.CallOption) (*RPCSuccess, error) } type originServiceClient struct { @@ -83,6 +86,15 @@ func (c *originServiceClient) FindEnabledOriginConfig(ctx context.Context, in *F return out, nil } +func (c *originServiceClient) UpdateOriginIsOn(ctx context.Context, in *UpdateOriginIsOnRequest, opts ...grpc.CallOption) (*RPCSuccess, error) { + out := new(RPCSuccess) + err := c.cc.Invoke(ctx, OriginService_UpdateOriginIsOn_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // OriginServiceServer is the server API for OriginService service. // All implementations should embed UnimplementedOriginServiceServer // for forward compatibility @@ -95,6 +107,8 @@ type OriginServiceServer interface { FindEnabledOrigin(context.Context, *FindEnabledOriginRequest) (*FindEnabledOriginResponse, error) // 查找源站配置 FindEnabledOriginConfig(context.Context, *FindEnabledOriginConfigRequest) (*FindEnabledOriginConfigResponse, error) + // 设置源站是否启用 + UpdateOriginIsOn(context.Context, *UpdateOriginIsOnRequest) (*RPCSuccess, error) } // UnimplementedOriginServiceServer should be embedded to have forward compatible implementations. @@ -113,6 +127,9 @@ func (UnimplementedOriginServiceServer) FindEnabledOrigin(context.Context, *Find func (UnimplementedOriginServiceServer) FindEnabledOriginConfig(context.Context, *FindEnabledOriginConfigRequest) (*FindEnabledOriginConfigResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FindEnabledOriginConfig not implemented") } +func (UnimplementedOriginServiceServer) UpdateOriginIsOn(context.Context, *UpdateOriginIsOnRequest) (*RPCSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateOriginIsOn not implemented") +} // UnsafeOriginServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to OriginServiceServer will @@ -197,6 +214,24 @@ func _OriginService_FindEnabledOriginConfig_Handler(srv interface{}, ctx context return interceptor(ctx, in, info, handler) } +func _OriginService_UpdateOriginIsOn_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateOriginIsOnRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(OriginServiceServer).UpdateOriginIsOn(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: OriginService_UpdateOriginIsOn_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(OriginServiceServer).UpdateOriginIsOn(ctx, req.(*UpdateOriginIsOnRequest)) + } + return interceptor(ctx, in, info, handler) +} + // OriginService_ServiceDesc is the grpc.ServiceDesc for OriginService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -220,6 +255,10 @@ var OriginService_ServiceDesc = grpc.ServiceDesc{ MethodName: "findEnabledOriginConfig", Handler: _OriginService_FindEnabledOriginConfig_Handler, }, + { + MethodName: "updateOriginIsOn", + Handler: _OriginService_UpdateOriginIsOn_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_origin.proto", diff --git a/pkg/rpc/protos/service_origin.proto b/pkg/rpc/protos/service_origin.proto index 8016df2..ceec87b 100644 --- a/pkg/rpc/protos/service_origin.proto +++ b/pkg/rpc/protos/service_origin.proto @@ -20,6 +20,9 @@ service OriginService { // 查找源站配置 rpc findEnabledOriginConfig (FindEnabledOriginConfigRequest) returns (FindEnabledOriginConfigResponse); + + // 设置源站是否启用 + rpc updateOriginIsOn(UpdateOriginIsOnRequest) returns (RPCSuccess); } // 创建源站 @@ -83,4 +86,10 @@ message FindEnabledOriginConfigRequest { message FindEnabledOriginConfigResponse { bytes originJSON = 1; // 源站信息 +} + +// 设置源站是否启用 +message UpdateOriginIsOnRequest { + int64 originId = 1; // 源站ID + bool isOn = 2; // 是否启用 } \ No newline at end of file