diff options
| author | Jeff Carr <[email protected]> | 2024-11-16 05:22:11 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-11-16 05:22:11 -0600 |
| commit | 81cbb6e9d7def6f34bda77bc6940377173dfae76 (patch) | |
| tree | ad993ce3c2758493778d26b137c005f6f6b58c30 /add.go | |
| parent | 74da63276ed73a78d66af45f2dca56a48f2f836a (diff) | |
things for create. might be duplicatesv0.2.7
Signed-off-by: Jeff Carr <[email protected]>
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 { |
