func (a *RebuildDroplet) Run() error { account := CurrentAccount() rsp, e := account.RebuildDroplet(a.DropletId, a.ImageId) if e != nil { return e } logger.Debugf("got response %+v", rsp) droplet := &digitalocean.Droplet{Id: a.DropletId, Account: account} return digitalocean.WaitForDroplet(droplet) }
func (a *CreateDroplet) Run() error { started := time.Now() droplet := &digitalocean.Droplet{ Name: a.Name, SizeId: a.SizeId, RegionId: a.RegionId, ImageId: a.ImageId, SshKey: a.SshKeyId, } droplet, e := CurrentAccount().CreateDroplet(droplet) if e != nil { return e } droplet.Account = CurrentAccount() logger.Infof("created droplet with id %d", droplet.Id) e = digitalocean.WaitForDroplet(droplet) logger.Infof("droplet %d ready, ip: %s. total_time: %.1fs", droplet.Id, droplet.IpAddress, time.Now().Sub(started).Seconds()) return e }