diff options
| author | cai6489 <caichunbo@beyondcent.com> | 2023-11-28 16:27:37 +0800 |
|---|---|---|
| committer | cai6489 <caichunbo@beyondcent.com> | 2023-11-28 16:27:37 +0800 |
| commit | 34222ca63f588cd3b62b37a1dfa154294e4a0b48 (patch) | |
| tree | 329c0f680ad4952f09266fd25ecca3a25afc71e0 /staging/src/github.com | |
| parent | Merge branch 'master' into v1beta1-dmi (diff) | |
| download | kubeedge-34222ca63f588cd3b62b37a1dfa154294e4a0b48.tar.gz | |
modify pushMethod location
Signed-off-by: cai6489 <caichunbo@beyondcent.com>
Diffstat (limited to 'staging/src/github.com')
| -rw-r--r-- | staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go b/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go index a88d7778a..cd5aa44b3 100644 --- a/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go +++ b/staging/src/github.com/kubeedge/mapper-framework/pkg/util/parse/grpc.go @@ -155,6 +155,24 @@ func buildPropertiesFromGrpc(device *dmiapi.Device) []common.DeviceProperty { Influxdb2ClientConfig: clientconfig, Influxdb2DataConfig: dataconfig, } + case "redis": + clientConfig, err := json.Marshal(pptv.PushMethod.DBMethod.Redis.RedisClientConfig) + if err != nil { + klog.Errorf("err: %+v", err) + return nil + } + dbconfig = common.DBConfig{ + RedisClientConfig: clientConfig, + } + case "tdengine": + clientConfig, err := json.Marshal(pptv.PushMethod.DBMethod.Tdengine.TdEngineClientConfig) + if err != nil { + klog.Errorf("err: %+v", err) + return nil + } + dbconfig = common.DBConfig{ + TDEngineClientConfig: clientConfig, + } } } // get pushMethod filed by grpc device instance @@ -176,50 +194,6 @@ func buildPropertiesFromGrpc(device *dmiapi.Device) []common.DeviceProperty { klog.Errorf("err: %+v", err) return nil } - dbconfig = common.DBConfig{ - Influxdb2ClientConfig: clientconfig, - Influxdb2DataConfig: dataconfig, - } - case "redis": - clientConfig, err := json.Marshal(pptv.PushMethod.DBMethod.Redis.RedisClientConfig) - if err != nil { - klog.Errorf("err: %+v", err) - return nil - } - dbconfig = common.DBConfig{ - RedisClientConfig: clientConfig, - } - case "tdengine": - clientConfig, err := json.Marshal(pptv.PushMethod.DBMethod.Tdengine.TdEngineClientConfig) - if err != nil { - klog.Errorf("err: %+v", err) - return nil - } - dbconfig = common.DBConfig{ - TDEngineClientConfig: clientConfig, - } - } - } - - // get pushMethod filed by grpc device instance - pushMethodName, err := getPushMethodFromGrpc(pptv) - if err != nil { - klog.Errorf("err: %+v", err) - return nil - } - var pushMethod []byte - switch pushMethodName { - case "http": - pushMethod, err = json.Marshal(pptv.PushMethod.Http) - if err != nil { - klog.Errorf("err: %+v", err) - return nil - } - case "mqtt": - pushMethod, err = json.Marshal(pptv.PushMethod.Mqtt) - if err != nil { - klog.Errorf("err: %+v", err) - return nil } } |
