github.com/emc-advanced-dev/unik@v0.0.0-20190717152701-a58d3e8e33b7/pkg/providers/photon/start_instance.go (about)

     1  package photon
     2  
     3  import (
     4  	"github.com/emc-advanced-dev/pkg/errors"
     5  )
     6  
     7  func (p *PhotonProvider) StartInstance(id string) error {
     8  	instance, err := p.GetInstance(id)
     9  	if err != nil {
    10  		return errors.New("retrieving instance "+id, err)
    11  	}
    12  	task, err := p.client.VMs.Start(instance.Id)
    13  	if err != nil {
    14  		return errors.New("Starting vm", err)
    15  	}
    16  
    17  	task, err = p.waitForTaskSuccess(task)
    18  	if err != nil {
    19  		return errors.New("Starting vm", err)
    20  	}
    21  	return nil
    22  }