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