- rtmgr.Logger.Debug("file.fileWriteAll writes data: %v", (*xapps))
- byteValue, err := json.Marshal(xapps)
+ rtmgr.Logger.Debug("file.fileWriteAll writes data: %v", *rcs)
+ byteValue, err := json.Marshal(rcs)
+ if err != nil {
+ return errors.New("cannot convert data due to: " + err.Error())
+ }
+ err = ioutil.WriteFile(file, byteValue, 0644)
+ if err != nil {
+ return errors.New("cannot write file due to: " + err.Error())
+ }
+ return nil
+}
+
+func (f *File) WriteXApps(file string, xApps *[]rtmgr.XApp) error {
+ rtmgr.Logger.Debug("Invoked sdl.WriteXApps")
+ rtmgr.Logger.Debug("file.fileWriteXApps writes into file: " + file)
+ rtmgr.Logger.Debug("file.fileWriteXApps writes data: %v", *xApps)
+
+ ricData, err := NewFile().ReadAll(file)
+ if err != nil {
+ rtmgr.Logger.Error("cannot get data from sdl interface due to: " + err.Error())
+ return errors.New("cannot read full ric data to modify xApps data, due to: " + err.Error())
+ }
+ ricData.XApps = *xApps
+
+ byteValue, err := json.Marshal(ricData)