diff options
Diffstat (limited to 'config.go')
| -rw-r--r-- | config.go | 36 |
1 files changed, 36 insertions, 0 deletions
@@ -22,6 +22,34 @@ func (e *Events) ConfigSave() error { return ConfigWriteTEXT(e, "events.text") } +func (c *Cluster) ConfigSave() error { + var d *Droplets + d = new(Droplets) + d.Droplets = c.Droplets + if err := ConfigWriteJSON(d, "newdroplets.json"); err != nil { + fmt.Println("droplets.json write failed") + return err + } + + var h *Hypervisors + h = new(Hypervisors) + h.Hypervisors = c.Hypervisors + if err := ConfigWriteJSON(h, "newhypervisors.json"); err != nil { + fmt.Println("hypervisors.json write failed") + return err + } + + var e *Events + e = new(Events) + e.Events = c.Events + if err := ConfigWriteJSON(h, "newEvents.json"); err != nil { + fmt.Println("newEvents.json write failed") + return err + } + + return nil +} + // read in the events log file // reads in from the prototext file // prototext file formats are not garrenteed to be stable. todo: hammer that out @@ -211,10 +239,18 @@ func (d *Droplets) FormatJSON() string { return protojson.Format(d) } +func (d *Droplet) FormatJSON() string { + return protojson.Format(d) +} + func (e *Events) FormatJSON() string { return protojson.Format(e) } +func (h *Hypervisors) FormatJSON() string { + return protojson.Format(h) +} + // apparently this isn't supposed to be used? // https://protobuf.dev/reference/go/faq/#unstable-text // this is a shame because this is much nicer output than JSON Format() |
