diff options
Diffstat (limited to 'add.go')
| -rw-r--r-- | add.go | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -1,7 +1,6 @@ package virtbuf import ( - "errors" "fmt" "time" @@ -9,6 +8,7 @@ import ( "go.wit.com/log" ) +/* func (c *Cluster) InitDroplet(hostname string) (*Droplet, error) { var d *Droplet d = new(Droplet) @@ -34,6 +34,7 @@ func (c *Cluster) appendDroplet(d *Droplet) { c.d.Droplets = append(c.d.Droplets, d) } +*/ // can the json protobuf output use a string and have a type handler // to convert it back to int64? @@ -94,8 +95,18 @@ func (c *Cluster) AddEvent(e *Event) { c.e.Events = append(c.e.Events, e) } -func (c *Cluster) AddDroplet(d *Droplet) { - c.d.Droplets = append(c.d.Droplets, d) +// creates a new droplet with default values +func NewDefaultDroplet(hostname string) *Droplet { + id := uuid.New() // Generate a new UUID + d := &Droplet{ + Uuid: id.String(), + Hostname: hostname, + Cpus: int64(2), + } + d.Memory = SetGB(2) + d.StartState = DropletState_OFF + + return d } func (c *Cluster) AddDropletSimple(uuid string, hostname string, cpus int, mem int) *Droplet { |
