diff options
| author | Jeff Carr <[email protected]> | 2024-10-26 06:01:19 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-26 06:01:19 -0500 |
| commit | ade54fdedac3bf89636f914b89fd17eaa972947f (patch) | |
| tree | c1f00a440a436a3b0738b865d89a1a8c5e3a81f7 /config.go | |
| parent | a8484013dc62bc0750f780b04b46cd48fe85ee5b (diff) | |
events should not be plural
Signed-off-by: Jeff Carr <[email protected]>
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() |
