42 lines
756 B
Go
42 lines
756 B
Go
package virtbuf
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
//
|
|
// This generates some sample data.
|
|
//
|
|
|
|
func CreateSampleDroplet(hostname string) *Droplet {
|
|
// TODO: flush this out to do all the fields
|
|
log.Println("CreateSampleDroplet() is generating a new droplet", hostname)
|
|
|
|
// Generate a new UUID
|
|
id := uuid.New()
|
|
d := &Droplet{
|
|
Uuid: id.String(),
|
|
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)
|
|
d.Comment = fmt.Sprintf("Sample Droplet %d", i)
|
|
|
|
c.Droplets = append(c.Droplets, d)
|
|
}
|
|
|
|
return c
|
|
}
|