package registry import ( "encoding/json" "os" ) func ImportJSONPreGen(o *ObjRegistry, filename string) error { f, err := os.ReadFile(filename) if err != nil { return err } var pregenInfo PreGenerateInfo err = json.Unmarshal(f, &pregenInfo) if err != nil { return err } for _, obj := range pregenInfo.Objects { if obj.Bucket != "" { err = o.AddObject("", "", obj.Bucket, obj.Object, "") } else { err = o.AddObject(obj.Container, obj.Object, "", "", "") } if err != nil { return err } } return nil }