github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/pkg/providers/virtualbox/stop_instance.go (about) 1 package virtualbox 2 3 import ( 4 "github.com/emc-advanced-dev/pkg/errors" 5 "github.com/solo-io/unik/pkg/providers/virtualbox/virtualboxclient" 6 ) 7 8 func (p *VirtualboxProvider) StopInstance(id string) error { 9 instance, err := p.GetInstance(id) 10 if err != nil { 11 return errors.New("retrieving instance "+id, err) 12 } 13 if err := virtualboxclient.PowerOffVm(instance.Id); err != nil { 14 return errors.New("failed to stop instance "+instance.Id, err) 15 } 16 return nil 17 }