virtbuf/sampleData.go

40 lines
778 B
Go

package virtbuf
import (
"fmt"
"log"
)
//
// This generates some sample data. It *should* match the .proto file
//
func CreateSampleDroplet(hostname string) *Droplet {
// TODO: flush this out to do all the fields
log.Println("CreateSampleDroplet() is generating a new droplet", hostname)
d := &Droplet{
Uuid: "6a1c571b-1d02-462b-9288-63d205306d76",
Hostname: hostname,
Comment: "this is a droplet for testing",
}
return d
}
func CreateSampleCluster(total int) *Cluster {
var c *Cluster
c = new(Cluster)
for i := 0; i < total; i++ {
hostname := fmt.Sprintf("bmath%d.wit.com", i)
d := CreateSampleDroplet(hostname)
// e.Id += 1000 + int32(i)
d.Comment = fmt.Sprintf("Sample Droplet %d", i)
c.Droplets = append(c.Droplets, d)
}
return c
}