|
@@ -2,6 +2,7 @@ package service
|
|
|
|
|
|
import (
|
|
|
"context"
|
|
|
+ "errors"
|
|
|
"log/slog"
|
|
|
"time"
|
|
|
)
|
|
@@ -55,6 +56,24 @@ func (s *Resource) GetSoftwareInfo() *pb.SoftwareInfoReply {
|
|
|
return r
|
|
|
}
|
|
|
|
|
|
+func (s *Resource) GetOptions(ctx context.Context, group, flag *string) (*pb.OptionReply, error) {
|
|
|
+ if group == nil {
|
|
|
+ return nil, errors.New("group is nil")
|
|
|
+ }
|
|
|
+ if flag == nil {
|
|
|
+ return nil, errors.New("flag is nil")
|
|
|
+ }
|
|
|
+ r, err := s.configClient.GetOptions(ctx, &pb.OptionRequest{
|
|
|
+ Group: *group,
|
|
|
+ Flag: *flag,
|
|
|
+ })
|
|
|
+ if err != nil {
|
|
|
+ slog.Error("[rpc]GetOptions failed", "err", err)
|
|
|
+ }
|
|
|
+ slog.Info("[rpc]GetOptions result", "rows", len(r.Option))
|
|
|
+ return r, err
|
|
|
+}
|
|
|
+
|
|
|
func (s *Resource) GetConfigOptionList(ctx context.Context, flag string, enable bool) ([]*pb.ConfigOption, error) {
|
|
|
slog.Info("[rpc]GetConfigOptionList...")
|
|
|
r, err := s.configClient.ConfigOptionList(ctx, &pb.ConfigOptionListRequest{
|